Page 1 of 1

Filling pipeline with software generate sine wave

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

I'm looking at as many examples I can but can't find the trick. My application needs to provide users with alternating tones in each ear via bluetooth. I think I've sorted the A2DP part with audio files but need to create tones 'on the fly' with varying frequencies which I plan to create with is DDS sine wave generator. I expect to feed a ring buffer with generated stereo samples assuming downstream decoding at 44100 16bits/sample but don't know how to feed the input stream.

Any pointers gratefully received.

Thanks

Re: Filling pipeline with software generate sine wave

Posted: Fri Mar 06, 2020 8:44 am
by ESP_Sprite
You could modify this example: https://github.com/espressif/esp-idf/tr ... 2dp_source

The audio is generated in this function, so you could just replace that by a read from a queue or ring buffer. Have another task push the sine wave data into this queue/ringbuffer and you're done.

Re: Filling pipeline with software generate sine wave

Posted: Sat Mar 07, 2020 8:19 pm
by colinives
Thank you so much for your reply,

I guess I missed it as it doesn’t use a pipeline/stream.

Can I assume that the format is:

Sample Rate: 44100
Data size: 16 bits
Format: L-R. 16 bit little-endian?

Thank you again.

Colin

Re: Filling pipeline with software generate sine wave

Posted: Mon Mar 09, 2020 9:56 am
by ESP_Sprite
From the existing function, it seems the samples are 16-bit little endian, but I'm not familiar enough with that code to tell you more about the other parameters, sorry.

Re: Filling pipeline with software generate sine wave

Posted: Tue Mar 10, 2020 10:33 am
by colinives
Thank you.

I can confirm that I have success delivering various tones to standard A2Dp headset at a sample rate of 44100.

The big problem now is that the after 110 seconds from connecting the A2DP disconnects - then reconnects for another 110 seconds and repeats. I have looked around the code and cannot find any built-in time limit lined to the a2dp source example. Is there a limit built in somewhere for the example code?

Thank you.

Re: Filling pipeline with software generate sine wave

Posted: Sun Feb 05, 2023 5:08 pm
by julienD
Hello,

Did you find some solution to this timeout?

Thanks
Julien