Skip to content

Using Audio Files on a SD Drive

Phil Schatzmann edited this page Feb 20, 2022 · 8 revisions

You can also store the audio samples on a SD drive. This has the advantage that you do not waste any program memory. All you have to do is to load the files into a subdirectory (e.g. "/tts") of the SD drive and adapt the Dictionary class that is used in your sketch:

#include "AudioDictionarySD.h"

AudioDictionarySD dictionary("/tts","mp3", PIN_CS);

This indicates that the audio files are stored in the tts directory and have the extension mp3. The SD drive is accessed with the PIN_CS chip select pin. By default we use the SdFat library. If you add a #define USE_SD before the include "AudioDictionarySD.h", the SD library is used instead.

For the example sketches I used an AI Thinker Audiokit: SD

You can also simply use a SD module:

SD

Clone this wiki locally