Changing i2s sample rate dynamically

AntonioTesta
Posts: 7
Joined: Wed Jun 21, 2023 11:47 am

Changing i2s sample rate dynamically

Postby AntonioTesta » Wed Jun 21, 2023 12:55 pm

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

tempo.tian
Posts: 40
Joined: Wed Jun 22, 2022 12:10 pm

Re: Changing i2s sample rate dynamically

Postby tempo.tian » Tue Jun 27, 2023 3:57 am

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

Who is online

Users browsing this forum: No registered users and 42 guests