EasyManuals Logo

Adafruit ESP32-S3 User Manual

Adafruit ESP32-S3
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #179 background imageLoading...
Page #179 background image
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
CircuitPython I2S WAV file playback.
Plays a WAV file once.
"""
import audiocore
import board
import audiobusio
audio = audiobusio.I2SOut(board.A0, board.A1, board.A2)
with open("StreetChicken.wav", "rb") as wave_file:
wav = audiocore.WaveFile(wave_file)
print("Playing wav file!")
audio.play(wav)
while audio.playing:
pass
print("Done!")
Now you'll hear the wave file play, and on completion, print Done Playing! to the
serial console.
You can play a different WAV file by updating "StreetChicken.wav" to be the name
of your CircuitPython-compatible WAV file.
You can do other things while the WAV file plays! There is a pass in this example
where you can include other code, such as code to blink an LED.
CircuitPython I2S-Compatible Pin Combinations
I2S audio is supported on specific pins. The good news is, there's a simple way to find
out which pins support audio playback.
In the example 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 directory CircuitPython_Templates/i2s_find_pins/ and then click on the
directory that matches the version of CircuitPython you're using and copy the
contents of that directory to your CIRCUITPY drive.
Your CIRCUITPY drive should now look similar to the following image:
©Adafruit Industries Page 179 of 263

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Adafruit ESP32-S3 and is the answer not in the manual?

Adafruit ESP32-S3 Specifications

General IconGeneral
Microcontroller/ChipESP32-S3
Clock Speedup to 240 MHz
RAM512 KB
Flash Memory8MB
GPIO Pins45
DAC Channels2
Operating Voltage3.3 V
Input Voltage5 V
I2C2
I2S2
CPUXtensa LX7 dual-core
Wi-Fi802.11 b/g/n
BluetoothBluetooth 5.0

Related product manuals