How to play a beep during MP3 playback?

Posts: 6
Joined: Fri May 24, 2019 2:02 am

How to play a beep during MP3 playback?

Postby felixcollins » Mon Feb 24, 2020 2:36 am

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.

Posts: 12
Joined: Tue Mar 03, 2020 2:53 pm

Re: How to play a beep during MP3 playback?

Postby colinives » Thu Mar 05, 2020 3:55 pm

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

User avatar
Posts: 84
Joined: Mon Jan 16, 2017 8:12 am

Re: How to play a beep during MP3 playback?

Postby Jakobsen » Fri Mar 06, 2020 7:38 am

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
Analog Digital IC designer / DevOps @ Merus Audio, Copenhagen, Denmark.
We do novel and best in class Audio amplifiers for consumer products.
Programmed assembler for C-64 back in 1980's, learned some electronics - hacking since then

Who is online

Users browsing this forum: No registered users and 6 guests