#574 MicroSD WAV Player
A basic demonstration of playing a sound file (WAV) from an SD card with an Arduino.
Here’s a quick demo..
Microcontrollers generally have very limited memory, so playing audio samples of any complexity usually requires external storage. An SD card is a convenient option, as it can easily be prepared on most computers.
This is a quick test of an SD card reader with an Arduino to play an audio file from the SD card.
MicroSD Card Module
I’m using one of the very common Micro SD card reader modules from an aliexpress seller.
The module uses SPI, and includes level shifting and regulation so that it is 5V tolerant.
|Supported cards||MicroSD < 2Gb||MicroSDHC < 32Gb|
I’m just using a pieze buzzer for output, without any current limiting resistor R1 (may be required depending on the piezo component). Of course, any other audio output device could be substituted here.
I’ve kept the demo code in
WavePlayer.ino super-simple - it just plays a single given file (
SAMPLE.WAV) when the push-button is pressed.
Preparing the Audio
I’m using a short sample - included in the
sample folder as an Audacity project.
The sample has been reduced to mono 16kHz, and exported to
sample.wav as an unsigned 8-bit PCM file.
This file is then written to the SD card.