esp-hal icon indicating copy to clipboard operation
esp-hal copied to clipboard

I2S: feature request or RFC about changing sample_freq "on-the-fly"

Open maxwen opened this issue 1 year ago • 1 comments

While hacking my MP3 player/ Web radio app (which you can find here https://gitlab.com/esp322054205/esp32s3-radio)

I came across the issue that web radio streams can have different sample frequencies (typically 48000 or 44100) and I did not found a way to change an I2S channel frequency after creation.

So I took the "crowbar approach" and created this https://github.com/maxwen/esp-hal/commit/b5e73680d61a22b7b40bd08fa907cada06fcdc3c

While this works I am wondering if

  1. did I simply miss a way to do this already right now?
  2. would this be a reasonable feature that would make sense to be added in general
  3. and if yes if someone could guide me what would be an acceptable way to do this so I might be able to contribute that feature.

maxwen avatar Jun 17 '24 10:06 maxwen

That's a very nice project!

  1. The only way right now would be to destroy the instance and re-create it
  2. I guess yes - would be a nice enhancement
  3. An update_config function would be good to have. Probably it doesn't need to be a trait - just an additional function on the I2s struct as the user-facing API would be more convenient

bjoernQ avatar Jun 24 '24 06:06 bjoernQ

This is being tracked in #2416

MabezDev avatar Nov 22 '24 23:11 MabezDev