CHAPTER18

Audio

This chapter discusses the following functions of the Audio library:

  • begin()
  • prepare()
  • write()

The hardware needed to use the examples in this chapter includes:

  • Arduino Due
  • Ethernet Shield (Arduino, SainSmart, etc.)
  • Micro-SD card
  • Breadboard
  • LM35 Temperature Sensor
  • Wires
  • 3.5-mm audio jack
  • An audio amplifier

NOTE The Audio library is only found in Arduino IDE version 1.5 and later. It is still considered experimental and under development.

You can find the code download for this chapter at http://www.wiley.com/go/arduinosketches on the Download Code tab. The code is in the Chapter 18 folder and the filename is Chapter18.ino.

Introducing Audio

Science fiction films from the 1980s were full of strange machines with lots of flashing lights and annoying beeps. The first PCs sold had only a buzzer, and the first versions could only do that, buzz. A while later, people played with the buzzer, making tones and even music for games. There are various videos on YouTube that show what games used to be like. Don't laugh; we really did play like that, and we liked it!

The gaming industry was driving sound development at the time, and gamers wanted more advanced music. It wasn't long before MIDI sound cards were released. MIDI is a protocol for connecting musical devices together. (A computer can also be a musical instrument.) Some sound cards could be programmed with “instruments” to be played back at different notes. Although the sound fidelity was much better than the ...

Get Arduino Sketches: Tools and Techniques for Programming Wizardry now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.