Moonshine Klatt on Pre-Wired Boards
Feather RP2040 Prop-Maker
The Adafruit Prop-Maker Feather has both an RP2040 microcontroller and an I2S amplifier on-board. Two of the terminal block connectors are for audio out directly to a speaker with + (red) and - (black) terminals.
For pinouts, the I2S pins are I2S_BIT_CLOCK, I2S_WORD_SELECT, and I2S_DATA. In the code, the EXTERNAL_POWER must be turned on, as the amplifier is on the switched power rail.
Using a small screwdriver, wire your speaker per the diagram below:
Click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file. Extract the contents of the zip file, open the folder that matches your CircuitPython version.
# SPDX-FileCopyrightText: 2026 Mikey Sklar for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# An example using the Adafruit_Moonshine_klatt library to generate speech using an Adafruit Feather
# RP2040 Prop-Maker with an on-board I2S amplifier
import time
import audiobusio
import board
import digitalio
import adafruit_moonshine_klatt as speech
external_power = digitalio.DigitalInOut(board.EXTERNAL_POWER)
external_power.switch_to_output(value=True)
audio = audiobusio.I2SOut(board.I2S_BIT_CLOCK, board.I2S_WORD_SELECT, board.I2S_DATA)
tts = speech.TTS(audio)
while True:
for voice in tts.voices:
tts.voice = voice
start = time.monotonic()
tts.say(f"Hello from Circuit Python. This is the {voice} voice.")
print(f"{voice}: {time.monotonic() - start:.2f} s")
time.sleep(1)
time.sleep(3)
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
- code.py
Your Feather CIRCUITPY drive should look like this after copying the files and folders:
And this is how it sounds:
Fruit Jam
The Fruit Jam is an all-in-one board with an RP2350 microcontroller and a TLV320DAC3100 DAC built-in. Headphones may be used in the audio jack, or a speaker on the Fruit Jam speaker port.
Connect the small speaker that comes with the Fruit Jam to the speaker port.
Click the Download Project Bundle button below to download the necessary libraries and the code.py file in a zip file. Extract the contents of the zip file, open the folder that matches your CircuitPython version.
# SPDX-FileCopyrightText: 2026 Anne Barela for Adafruit Industries
# SPDX-FileCopyrightText: 2026 Mikey Sklar for Adafruit Industries
#
# SPDX-License-Identifier: MIT
# An example using the adafruit_moonshine_klatt library to generate speech using an
# Adafruit Fruit Jam RP2350 with an onboard TLV320DAC3100 I2S amplifier
# Moonshine Klatt talks at 16 kHz, but the TLV320 library has no 16 kHz setting.
# The code sets two DAC registers by hand below to get there, so pylint is told that is OK.
# pylint: disable=protected-access
import time
import adafruit_tlv320
import audiobusio
import board
import pwmio
import adafruit_moonshine_klatt as speech
VOLUME = 0.85 # 0.0 to 1.0
mclk = pwmio.PWMOut(board.I2S_MCLK, frequency=15_000_000, duty_cycle=2**15)
dac = adafruit_tlv320.TLV320DAC3100(board.I2C())
# The driver has no 16 kHz clock setting. Set up 48 kHz, then raise the DAC oversampling
# (DOSR, page 0 registers 0x0D and 0x0E) from 128 to 384 on the same PLL, giving 16 kHz.
dac.configure_clocks(sample_rate=48000, bit_depth=16, mclk_freq=mclk.frequency)
dac._page0._write_register(0x0D, 384 >> 8)
dac._page0._write_register(0x0E, 384 & 0xFF)
dac.headphone_output = True
dac.speaker_output = True
dac.dac_volume = -63 + VOLUME * 86
audio = audiobusio.I2SOut(board.I2S_BCLK, board.I2S_WS, board.I2S_DIN)
tts = speech.TTS(audio)
while True:
for voice in tts.voices:
tts.voice = voice
start = time.monotonic()
tts.say(f"Hello from Circuit Python. This is the {voice} voice.")
print(f"{voice}: {time.monotonic() - start:.2f} s")
time.sleep(1)
time.sleep(3)
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
- code.py
Your Feather CIRCUITPY drive should look like this after copying the files and folders:
And this is how it sounds:
Page last edited October 06, 2026