minimum reasonable buffer size on ESP32? #1674
-
Are there any lower limits in terms of what a resonable buffer size is for low latency applications on an ESP32? My goal is to instantly have audio feedback when a key is pressed, with the least possible latency and an envelope to avoid clicks (ADSR). Application is a sine wave sidetone for a morse/cw trainer, and goal is to avoid resp. minimize any delay between pressing the key and hearing the sidetone. So it's pretty much a simple on and off for a sine. thanks in advance, Hari |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
If my calculation is right: for mono 16 bit at 44100 samples per second, a 1024 bytes buffer leads to a delay of 11 ms. Studies have shown that sound reflections in an acoustic space must be delayed by 20 to 30 ms before your brain will perceive them as separate. So a buffer size of 16 does not really make any sense and most likely will not render a clean tone because of the involved overhead. I would start with 1024 bytes and half the values until you get some acceptable result. Did you measure the effective delay ? I am surprised that you even consider this as an issue.... ps. ADSR is trying to simulate some "instrument". If you are interrested just to output a sine tone, I would recommend to use Fade functionality instead. |
Beta Was this translation helpful? Give feedback.
-
Not sure what you mean with 18 words per minute. |
Beta Was this translation helpful? Give feedback.
-
If you select the copy size to contains always (a multiple of) full sine waves, you should be able to get away with the need to do any Fade/ADSR. Another option would be to use the PoppingSoundRemover converter class which removes the audio before and/or after the first or last 0 transition. |
Beta Was this translation helpful? Give feedback.
If my calculation is right: for mono 16 bit at 44100 samples per second, a 1024 bytes buffer leads to a delay of 11 ms.
Studies have shown that sound reflections in an acoustic space must be delayed by 20 to 30 ms before your brain will perceive them as separate.
So a buffer size of 16 does not really make any sense and most likely will not render a clean tone because of the involved overhead. I would start with 1024 bytes and half the values until you get some acceptable result.
Did you measure the effective delay ? I am surprised that you even consider this as an issue....
ps. ADSR is trying to simulate some "instrument". If you are interrested just to output a sine tone, I would recomm…