Page 1 of 1

Playing audio asynchronously while doing other processing

Posted: Fri Mar 29, 2019 7:11 am
by sidewaysRAM
I have an Arduino application (must be open source HW and SW) in mind that requires reading ADC values and performing significant compute, while audio is also being played. Because of the compute need I think I need a Zero card so need an async music library for this - anyone know of a solution? Or have any other suggestions? Thanks

Re: Playing audio asynchronously while doing other processing

Posted: Tue Apr 02, 2019 7:12 pm
by sparky
If it were me (and forgive me for self-promoting my own widget) I'd use a Qwiic MP3 Trigger: https://www.sparkfun.com/products/15165

You just say 'play track 2' and go on with your reading of ADC values and such and the Trigger autonomously plays the track.

It's OSHW, I licensed the examples and even the original firmware under ... MIT? I forget, but it's all open. There's even a bunch of examples to get you started within the MP3 Trigger library.

Re: Playing audio asynchronously while doing other processing

Posted: Fri Apr 05, 2019 2:51 am
by sidewaysRAM
Thanks Sparky - couple of questions - what is the latency between the command to play and the playback starting? I need to play around 40 or so different sounds and also alter their playback speed by +/-20% or so, could this requirement be met?
Thanks

Re: Playing audio asynchronously while doing other processing

Posted: Fri Apr 05, 2019 9:16 am
by sparky
Hmm - good question, I don't know. I believe it's on the order of milliseconds between command being sent via I2C and MP3 being started, but unfortunately the WT2003S doesn't call this out in their datasheet: https://cdn.sparkfun.com/assets/7/c/0/c ... _V1.03.pdf

The Qwiic trigger cannot change the playback speed, and off the top of my head I don't know of an embedded MP3 player that supports slower track playing. I'd pre-record the various tracks at the various speeds into regular speed MP3s and just play the track that is needed.

Re: Playing audio asynchronously while doing other processing

Posted: Fri Apr 05, 2019 2:00 pm
by robertsonics
Both the WAV Trigger and Tsunami have a trigger-to-sound output time of between 5 and 12 milliseconds. Tsunami is probably a bit better than this because it scans the input triggers continuously.

In addition to being polyphonic, both products also allow you to change the playback speed of any sound (independently) in real time.

Neither product will play MP3 files, but you can convert any MP3 file to a wav file in about 30 seconds: https://youtu.be/B9iIxnMUk7E

Re: Playing audio asynchronously while doing other processing

Posted: Mon Apr 08, 2019 8:13 am
by sidewaysRAM
OK thanks - I shall look into these...