Page 1 of 1

Changing i2s sample rate dynamically

Posted: Wed Jun 21, 2023 12:55 pm
by AntonioTesta
Does anybody know how to change the i2s sample rate during execution time ? The .sample_rate bellow i2s_config_t i2s_config = ... accepts only constants, so there is no way to change that value during the program execution. Any help will be appreciated. Thanks

Re: Changing i2s sample rate dynamically

Posted: Tue Jun 27, 2023 3:57 am
by tempo.tian
i2s has following API:
esp_err_t i2s_stream_set_clk(audio_element_handle_t i2s_stream, int rate, int bits, int ch);

the rate setting is the sample_rate settings, please make sure the input data rate and I2S sample rate is matched or else the tone will listen to be strange