A collection of MicroPython examples for using the I2S protocol to play and record audio on microcontrollers.
MicroPython I2S Examples is a collection of code samples that demonstrate how to use the I2S protocol for audio playback and recording on MicroPython-supported microcontrollers. It solves the problem of implementing digital audio on embedded devices by providing tested examples for common hardware like the ESP32, Raspberry Pi Pico, and Teensy boards.
Embedded developers and hobbyists working with MicroPython on microcontrollers who need to add audio playback or recording capabilities to their projects.
Developers choose this project because it offers practical, hardware-tested examples across multiple platforms, reducing the trial-and-error typically associated with I2S audio implementation on microcontrollers.
Examples for I2S support on microcontrollers that run MicroPython
Supports four MicroPython ports (stm32, esp32, rp2, mimxrt), providing versatile code that works across popular microcontroller families like ESP32 and Raspberry Pi Pico.
Includes tested configurations for common boards, DACs, and microphones, such as the INMP441 and PCM5102, reducing guesswork and ensuring reliability.
Offers specific FAQ advice on internal and user buffer sizing to prevent audio gaps, based on real-world testing with WAV playback and recording.
Provides clear pin mapping tables and images for hardware connections, ensuring correct setups with recommended wire types and lengths for optimal audio quality.
Limited to uncompressed WAV files, requiring conversion from MP3 or other formats and increasing storage needs, which can be cumbersome for projects with space constraints.
Examples contain port-specific blocks (e.g., for stm32, esp32), making them lengthy and harder to simplify for a single board, as noted in the README about large files.
Many examples require SD cards for WAV playback, adding hardware cost and setup complexity, especially for boards like Raspberry Pi Pico that need external modules.
Certain devices, such as the SPH0645LM4H microphone, require manual bit-shifting due to non-standard I2S timing, adding extra steps and potential for errors.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.