Closed ftab closed 7 months ago
Resample only support fixed sample rate like (8k, 16k, 44.1, 48k) and not support other rate which not in it You can try to use sonic module if the sample rate does not change too much.
void esp_sonic_set_speed(void* handle, float speed);
Thanks for the info. I have dusted off some of my old code that does the small sample rate adjustment and ported it to esp-adf, so I have solved the problem. But thank you for pointing out esp_sonic as well.
Environment
git describe --tags
in $IDF_PATH folder to find it): // v5.0.3-147-gdc9a3c43ea - my fork https://github.com/radiosound-com/esp-idf/tree/release/v5.0+0634bb9+adfpatchgit describe --tags
in $ADF_PATH folder to find it): // v2.5-76-g6207836f - my fork https://github.com/radiosound-com/esp-adf/tree/radiosound-modded-v2.5-66-g49e63cd5xtensa-esp32-elf-gcc --version
in your project folder to find it): // xtensa-esp32-elf-gcc (crosstool-NG esp-2022r1) 11.2.0Problem Description
I am using a pipeline with a2dp_stream -> filter_resample -> dsp (my own code) -> i2s and trying to adjust for differences in clocks / playback rate. I am trying to work around https://github.com/espressif/esp-idf/issues/11688#issuecomment-1830316668
Initial config:
I have a thread that estimates the actual src playback rate (by looking at the output ringbuffer filled percentage average, sampled every 10ms for 500ms), and then for example, after determining that the buffer is getting too full and it should play faster (stream_sample_adj = -1) calls
The intent is to make minor adjustments in sample rate (create a small number of samples to play slower, destroy a small number of samples to play faster) to account for differences in source device's clock vs. my clock.
Expected Behavior
Resample filter should take small adjustments
Actual Behavior
Steps to Reproduce
Currently unable to share code / steps as this is all on a custom board.
If I can reproduce on LyraT I will share that. But I figured I would ask first to see if the resample filter is even supposed to be able to handle this sort of small adjustment. It would seem like it should, but I'm often wrong.