Page 1 of 1

How to play a beep during MP3 playback?

Posted: Mon Feb 24, 2020 2:36 am
by felixcollins
Our application needs to play a short beep as audio feedback when certain buttons are pressed. This needs to happen while an MP3 track is playing but it is okay if the mp3 track stops for the duration of the beep..

I've tried having two pipelines set up, pausing one, and playing the other then swapping back. This causes problems because the two i2s stream writers conflict.

I found the Downmix component but my beep track is a fixed 16000 samples per second and the MP3 tracks can be anything. I suppose I could install the Resample filter on the beep pipeline so the sample rates can match but this is starting to seem like overkill.

Is there a way to simply pause the MP3 pipeline and "unhook" the i2s writer element from the driver? I could then play the beep, reconnect the mp3 pipeline's i2s stream writer and resume the pipeline.

Can anyone offer any advice on this? I expect it is quite a common issue as many music players offer audio feedback.

Re: How to play a beep during MP3 playback?

Posted: Thu Mar 05, 2020 3:55 pm
by colinives
Hi there.

Did you get anywhere. My need is simpler in that the source is a program generated wav 'tone' and I'm still working out how to insert it at the start of the pipeline. Clearly you must be doing something similar unless you are reading the wav/mp3 file from SDCard or memory.

Any tips. I assume I need to fill in upstream ring buffer and keep it topped up for as long as I need it. Just no really clue how to do it. Thanks

Re: How to play a beep during MP3 playback?

Posted: Fri Mar 06, 2020 7:38 am
by Jakobsen
HI
Very interesting problem - and I expect that has been just done at application level in many ways.

I think this all also call for a best practice one the IDF and the ADF.

I my framework (build on IDF) I have inserted a DSP processing task at the last stage prior to sending audio sample off to the I2S driver.
Here I have define various audio processing flow, EQ, Crossover channel separation, channel mute.... I would add a flow here that will add an audio source (generated or sampled) at a given level. You could add volume envelope one each channel to make the mixing process sound good.

You need to have this kind of sonic feedback as late in the pipeline as possible to min. response of system.

Looking forward to hear your results :-)

Regards Jakobsen

Re: How to play a beep during MP3 playback?

Posted: Mon Aug 24, 2020 11:09 pm
by felixcollins
That sounds awesome Jakobsen. Is your code open source? Is your DSP task implemented as an audio element? I could probably put something together myself for this but unfortunately the time expenditure is not justified for this project. In the end I have just played the beep if there is no other audio playing at the time (using a wav from flash). Better than nothing but not ideal.

Re: How to play a beep during MP3 playback?

Posted: Thu Sep 03, 2020 9:40 pm
by Jakobsen
Hi Felix

Check the dsp_processor in my githup repo

https://github.com/jorgenkraghjakobsen/merus_bt

It should be straigh forward to mix in a beep - but please do a nice beep - not just 440hz sine.

No im not working in the ADF.

Hope that will give you some thing to work with.
/Jakobsen