If you have used the tone() function on the Arduino, you probably won't have been too impressed as it's limited to outputting a monophonic square wave. In this section you'll be using the Wave Shield to turn the Arduino into a music player.

What's on the board?

The first thing you'll notice, aside from the SD card slot, are the three integrated circuit chips. The largest of these handles conversion of the 5V signals used by the Arduino with the 3.3V which the SD card expects. Also on the board is a digital-to-analog convertor (DAC) which takes output from the Arduino's digital output pins and changes it to an analog signal, and also an op-amp which boosts the signal so that it can drive a speaker or the headphone output. The volume control knob adjusts the amplifier's gain.

Audio files stored on the card need to be converted in order to be read by the software. The input file needs to be a 16 bit mono .wav file with 22KHz sample rate. Various methods of converting files are listed here. Choose one which is convenient for your system.

Place the converted file on the SD card in the root directory.

The Arduino software can be fetched from here. Compile and upload the daphc.pde file to the Arduino. This will play all .wav files on the card.

If the audio does not start playing, the serial monitor can be used to view logging. Some SD cards may not be compatible with the SD library, which will give an initialisation error.

What next?

There are other ways to improve sound output from the Arduino without use of a shield.

The DAC chip from the circuit isn't really necessary, and can be replaced by a 1-bit DAC using just one pin and capacitor.

And here is a similar SD-card-based audio player using a 1-bit DAC. It can also produce stereo sound, or a '16 bit quality' mode.

Possibilities for the SD card reader are endless, and can be used with the web server example, with the LCD as a simple e-reader, or for any application where the Arduino's onboard data memory is not enough. The Wave Shield makes use of the Arduino SD card library: http://arduino.cc/en/Reference/SD , which can be used in your own projects independently of the Wave Shield code.

challenge_yourself.jpg Easy
(1) Make a sample player. Connect some buttons to trigger a number of samples. How about using a potentiometer to adjust the sample rate?

Intermediate
(1) Using the Ethernet shield, make a speaking clock. Try using NTP http://arduino.cc/en/Tutorial/UdpNTPClient to get the current time, then construct a sentence from short samples to indicate the time.
(2) Make a synthesiser. Here http://makezine.com/projects/make-35/advanced-arduino-sound-synthesis you can see how to generate waveforms using the Arduino. This could allow you to make more interesting synthesised music than with the tone() function.

Harder
(1) Make your sample player into a full sampler by making it record samples direct to the SD card.