How to play a beep during MP3 playback?

felixcollins
Posts: 123
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.

colinives
Posts: 37
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
Jakobsen
Posts: 89
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

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
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

felixcollins
Posts: 123
Joined: Fri May 24, 2019 2:02 am

Re: How to play a beep during MP3 playback?

Postby felixcollins » Mon Aug 24, 2020 11:09 pm

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.

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

Re: How to play a beep during MP3 playback?

Postby Jakobsen » Thu Sep 03, 2020 9:40 pm

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
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 44 guests