Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Audio lib for non real-time processing?

  1. #1
    Senior Member
    Join Date
    Oct 2015
    Location
    Vermont, USA
    Posts
    107

    Audio lib for non real-time processing?

    Hi All,

    I'm used to using the Audio Library with my Teensy Audio Board to do real-time processing. But, how do I use the audio library for non-real-time processing?

    The scenario that I need to address is that my audio processing algorithms are too slow. To figure out which parts of my algorithm are too slow, I need to be able to run the whole stack, even if it takes longer than real time. But, on my setup (with the Teensy Audio Board), the whole thing freezes if it takes longer than real time. How can I use the Audio Library without the real-time requirement imposed by the Teensy Audio Board?

    Ideally, I'd do something like: (1) read audio from SD card, (2) process with my too-slow algorithms, (3) debug by watching Serial.println() to the Serial Monitor, (4) write the processed audio to the SD card to confirm that it sounds OK.

    Any idea how I'd do that?

    Chip

  2. #2
    Junior Member
    Join Date
    Feb 2015
    Posts
    7
    You could try to call the update functions of your blocks individually, and take a look at the consumed cycles.
    In most cases in the audiolibrary the output block takes care of calling the audio update functions of all connected blocks. (there is a static variable in audiostream which is the start of the list of audioblocks)
    If you write your own audio output library which writes to sd you should be able to control the speed.
    Last edited by borgert; 02-05-2017 at 09:12 PM.

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    13,324
    You could try using the queue objects. They give your Arduino sketch access to the raw 128 sample blocks.

    Perhaps grab a several dozen blocks of data. Then turn off the data with a mixer, or just ignore the incoming blocks and let the audio library run out of memory (it'll be forced to discard data).

    Do your audio processing at your leisure. When you're ready to use the library again, if it ran out of memory rapidly receive & discard all queued blocks. Then you can transmit your data into a play queue if you want to push it back into the library, to hear it or do other things.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •