There is a speaker and two buttons on your Circuit Playground Bluefruit, and CircuitPython includes the ability to play MP3 files. This example plays a different MP3 for each button pressed. Be aware, the speaker is small, so you will not get high quality MP3 playback using the built-in speaker.

Try pressing each button individually to hear a different MP3 file.

# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
#
# SPDX-License-Identifier: MIT

"""
Circuit Playground Bluefruit MP3 Playback

Press each button on the Circuit Playground Bluefruit to play a different MP3.
"""
from adafruit_circuitplayground import cp

while True:
    if cp.button_a:
        cp.play_mp3("happy.mp3")
    if cp.button_b:
        cp.play_mp3("beats.mp3")

This guide was first published on Nov 17, 2021. It was last updated on Nov 17, 2021.

This page (Bluefruit MP3 Playback) was last updated on Mar 31, 2023.

Text editor powered by tinymce.