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

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

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

"""
Circuit Playground Bluefruit WAV Playback

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

while True:
    if cp.button_a:
        cp.play_file("dip.wav")
    if cp.button_b:
        cp.play_file("rise.wav")

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

This page (Bluefruit WAV Playback) was last updated on Jun 24, 2024.

Text editor powered by tinymce.