I2S is now in the main branch so you should be able to use the nightly builds. If you follow this video then you’ll need to replace “bufferlen” with “ibuf” - thanks Anders Weile for flagging this up.
Does Micropython support I2S Audio on the ESP32? Almost - let’s build a custom version that includes support and try it out.
Thanks to PCBWay for sponsoring this video, PCBWay offer PCB Production, CNC and 3D Printing, PCB Assembly and much much more. You can find their details here: https://www.PCBWay.com/?from=atomic
I2S is not yet officially supported, but there is a Pull Request on GitHub that adds it in.
We can build a custom version of Micropython pretty easily. We just need the ESP-IDF from here: https://github.com/espressif/esp-idf.
And then we can get a copy of Micropython from here: https://github.com/micropython/micropython
and merge in the pull request with I2S support: https://github.com/micropython/micropython/pull/7183
The full commands to set up the IDF are:
git clone -b v4.2 –recursive https://github.com/espressif/esp-idf.git cd esp-idf ./install.sh . export.sh
And then to build our custom version of Micropython:
git clone firstname.lastname@example.org:micropython/micropython.git git fetch origin pull/7183/head:i2s_support git merge i2s_support make -C mpy-cross cd ports/esp32 make submodules make BOARD=UM_TINYPICO
You can find a bunch of sample code here for the I2S pull request: https://github.com/miketeachman/micropython-i2s-examples
And I’ve pushed up my sample code here: https://github.com/atomic14/micropython-i2s-esp32-test
You can pick up the I2S Amplifier (MAX98357) here - https://amzn.to/3cg88Z5 And the TinyPico I’m using here - https://amzn.to/3vVoONp
Patreon: https://www.patreon.com/atomic14 ko-fi: https://ko-fi.com/atomic14