These examples are all tested to work with IDE v13 or higher, so try to use that if possible!
This library uses a lot of RAM, if you are using an older '168 or '8 Arduino, you must upgrade to an ATmega328. The shield was designed with the expectation that this upgrade would be available.
If you want a human voice in your project, you can use the free generator at AT&T Text-to-Speech demo page.
It will create a 16KHz, 16-bit audio file so you can use the audio 'right out of the box.'
Here is huge collection of C.C. Attribution licensed sound samples! A lot of it is already mono, 16 or 22KHz.
This is the simplest example. It plays every audio file it finds on the SD card in a loop. This sketch is also included in the library.
This example shows how to use the AT&T text-to-speech website to speak the first n digits of pi. The number is stored in flash, each digit is spoken one at a time.
- Zip file containing the digits 0 thru 9 and 'point' place the wave files onto the SD card in the root directory.
- Sketch (for the waveHC library also check the WaveHC library zip for any newer revision) there's a walkthrough here.
Here is a collection of different playback techniques with 6 buttons (connected to analog 0-5).
You can change the # of buttons and what they're wired to easily. This isn't an exhaustive list but will give you some ideas about how you can do a lot with the WaveHC library. Note that all the changes occur in loop(). The button checking and everything else is the same.
- Play the wave file all the way through, and only once.
- Play one wave file all the way through, in a loop.
- Play all the pressed wave files all the way through, in a loop.
- Play the wave file only when the button is held down and only once (kind of like a musical keyboard).
- Play the wave file only when the button is held down and loop it (kind of like a sampler keyboard).
- Play the wave file all the way through and loop it, but allow other buttons to interrupt.
- Play the wave file all the way through once, but allow other buttons to interrupt.
This similar example plays 6 different files but its for WaveHC library (there's a walkthrough here).
This one plays 4 different files depending on serial characters, good if you have say an xbee you want to use.
By messing with the playback interrupt, you can change the speed of playback for an interesting effect.
Here is the sketch, connect the potentiometer to analog pin 0 (or change the code).