Playback Using Feather Boards
The Adafruit_CircuitPython_FLAC and Adafruit_CircuitPython_OGG CircuitPython libraries have been tested with the following Adafruit Feather boards. Not all Feather boards will work. The processor must have sufficient speed to decode the audio and the board must have I2S out.
Wiring
Wire the Feather to the MAX98357 I2S amplifier as shown on the Feather + MAX98357A Wiring page.
Code
For each type of file for playback (FLAC or Ogg), click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file.
# SPDX-FileCopyrightText: Copyright (c) 2026 Mikey Sklar for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Play a FLAC file once on a Feather through a MAX98357A I2S amp and a speaker.
Wiring: Feather A0 to BCLK, A1 to LRC, A2 to DIN, 3V to Vin, GND to GND. The amp mixes
stereo files down to mono.
"""
import audiobusio
import board
import adafruit_flac
# Make the decoder first: it decodes faster with its buffers in internal RAM.
decoder = adafruit_flac.FLACDecoder("song.flac")
audio = audiobusio.I2SOut(bit_clock=board.A0, word_select=board.A1, data=board.A2)
player = adafruit_flac.FLACPlayer(audio, level=0.1) # 0.0 (silent) to 1.0 (full)
print("Playing FLAC file!")
player.play(decoder)
while player.playing:
player.update() # decode the next piece; call this often while playing
print("Done!")
# SPDX-FileCopyrightText: Copyright (c) 2026 Mikey Sklar for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""Play an Ogg Vorbis file once on a Feather through a MAX98357A I2S amplifier and a speaker.
Wiring: Feather A0 to BCLK, A1 to LRC, A2 to DIN, 3V to Vin, GND to GND. The amp is mono,
so a mono file at 22 kHz or lower sounds the same and decodes several times faster. On an
ESP32-S3, use 22 kHz or lower: 44.1 kHz stereo does not decode in real time there.
"""
import audiobusio
import board
import adafruit_ogg
# Make the decoder first: it decodes faster with its buffers in internal RAM.
decoder = adafruit_ogg.OggDecoder("song.ogg")
audio = audiobusio.I2SOut(bit_clock=board.A0, word_select=board.A1, data=board.A2)
player = adafruit_ogg.OggPlayer(audio, level=0.1) # 0.0 (silent) to 1.0 (full)
print("Playing Ogg file!")
player.play(decoder)
while player.playing:
player.update() # decode the next piece; call this often while playing
print("Done!")
The code for each is very similar, just varying in the library used.
Upload the Code and Libraries to the Feather
After downloading the Project Bundle, plug your Feather into your computer's USB port with a known good USB data+power cable. You should see a new flash drive appear in the computer's File Explorer or Finder (depending on your operating system) called CIRCUITPY. Unzip the folder and copy the following items to the Feather's CIRCUITPY drive.
- lib folder: contains adafruit_flac and/or adafruit_ogg subfolders
- code.py
Your Feather CIRCUITPY drive should look like this after copying the files and folders:
Sample Files
The following files are open source CC0 clips of FLAC and Ogg audio segments you can use with the code:
- FLAC (stereo, 22050 Hz)
- FLAC (stereo, 39kHz)
- FLAC (mono)
- Ogg (stereo, 22050 Hz)
- Ogg (stereo, 39kHz)
- Ogg (mono)
FLAC Source. Ogg files are files converted from FLAC to Ogg at the website here.
Copy them to the root CIRCUITPY directory, naming them song.flac or song.ogg. You could also change the code to a filename of your choice.
And this is how it sounds:
On the ESP32-S3, there appears to be a bit of clipping or light stuttering. Getting audio bitrates to stream smoothly may take some experimentation. Also I set the audio levels higher to get it to record well, likely straining the speaker capacity.
Page last edited October 27, 2026