Using Pre-recorded Sounds

with the Arduino or Other microcontroller

With just a bit of extra hardware, your Arduino or other microcontroller can play pre-recorded sounds -- tunes to help wake you up, sirens to warn you of impending danger, bleeps, bloops, and chirps to talk to you in some fanciful Droidian dialect only you (and your robot) know.

Recorded sound is stored in memory, typically on external flash memory like an SD or µSD card. Your microcontroller reads the sound data from the card, and processes it through an amplifier and speaker. Popular sound-making hardware for the Arduino include the Wave Shield from Adafruit and the MP3 Player Shield from SparkFun.

Many other microcontrollers, like the Parallax Propeller, can use these and similar hardware; the Propeller Board of Education can handle standard WAV audio files directly. Except for an external amp and speaker, no extra hardware is required.

This article details where to find and make various sounds for your robots. If you're interested in the actual hardware and coding techniques to reproduce sounds on your robot, check out my Sounding Off series in SERVO Magazine, particularly parts 3 and 4, which detail MP3 and WAV sound reproduction on the Arduino.

In this article...

Finding Free (and paid) Sounds on the Web

The Internet is full of pre-recorded music and sound effects, some of it well crafted and professionally recorded. A simple Web search will locate the dozens of sources of free and paid sounds. Or, you may want to skip to the chase and register at Freesound.org, which is perhaps the Internet's premier site for free open source and public domain sounds. (And, if you like what you find, consider a donation to help in maintaining the Web site.)

Freesound allows you to preview any of the clips, then download the ones you like. Though there are some clips with musical elements in the collection, most are sound effects created and recorded using various techniques, including pure synthesis, nature recordings, "found objects" (Coke bottles knocking together, that sort of thing), notes from musical instruments, and much more. Typical duration is from 5 to 15 seconds, perfect for use on bots.

All sounds are free, but most are copyrighted and provided under the Creative Commons license. As with most open source material these days, redistribution may involve providing attribution to the original composer or recordist. A few clips are marked public domain, where no copyright is claimed.

Using Pre-Recorded Sound CDs

One of the best sources of audio clips is sound effects CDs. These are collections of various whoops, cries, gunshots, explosions, and other FX sounds. The CDs are not always current issue and are sometimes “rare,” so you may have to buy new or used from specialty sources.

A few CDs are also available as MP3 downloads, but I really recommend the CD if you can get it. The quality is better as the clips haven’t already been compressed. You’ll lose audio quality as you recompress them to individual edited MP3 clips.

Where to buy

Amazon is always a good choice for finding that special sound clip CD for your next project. Here are a few links. Those with a star beside them are CDs I’ve owned, and are among my personal favorites.

* Hanna Barbera Cartoon Sound Fx

Collection of dozens of actual sound effects used in various Hanna Barbera cartoons, most from the 60s and 70s. The Jetson Space Capsule sounds are ideally suited for any robot (or other sci-fi project). Even if you don't use the actual recordings on this disc, you'll learn how to create all kinds of sound FX using different kinds of musical instruments.

The Web site sound-ideas.com sells a much larger collection of Hanna Barbera sound effects at a much higher price. The collection covers some 2,200 effects, and is offered with a license intended for professional use.

* Star Trek: Sound Effects From The Original TV Soundtrack

Enterprise bridge sounds, phasers, transporter beam-ups, warp drive, Atavacron, they’re all here, in glorious mid-1960s hi-fi (don’t let that fool you; the quality is quite good).

Many of the clips, like Red Alert Klaxons #2 and Tribble Coos are short and sweet, easily re-digitized for use in your robo.

But some are fairly long -- like Alien Planet Surface (used in The City on the Edge of Forever, and others), which is a minute 35 seconds . Unless you plan on using it as background music, you’ll want to edit down to a reasonable length.

Sound Effects: Hollywood Style

This CD is a collection of general purpose non-synthesized sound effects, such as Baby Crying and Snoring. Also available: More Hollywood Sound Effects)

Crash Bang Boom: The Best of WB Sound Fx

Never one to be outdone by Hanna and Barbera, this CD brings together a smallish collection of sound effects used in classic Warner Brothers cartoons. This one’s different, and that it’s intended more as entertainment, with “new” voice actors (Joe Alasky is good, but no one compares to the late great Mel Blanc) adding banter and commentary. Tedious and disappointing if what you’re looking for is sound effects, but you can edit out all the dialog.

Sound Effects of Horror & Science Fiction, the Weird

Sound effect collection along the theme of horror and science fiction.  Sixty four clips in all.

See also Scary Sound Effects, which includes clips some better-than-decent flying saucer loops made with theremins and oscillators.

As you listen through the cues on these discs keep in mind that you don't have to use the tracks exactly as recorded. Use a sound editing program to try different techniques, like slowing down or speeding up playback, adding heavy reverb, even reversing the track. Be creative!

Honorary Mentions

Star Trek Generations: Original Motion Picture Soundtrack

Combination musical soundtrack with selected sound effect clips from the movie.

Environmental & Ecological Sounds (various titles)

Various CDs packed with sound effects. Most appear to be actual recordings rather than synthesized.

How to Make Your Own “Classic” Sound Effects

So-called “classic” sound effects harkens back to the bad B-movies of the 1950s, where sound engineers spent their days fiddling with tube oscillators and slide flutes. They created distinctive sounds simply by slowing down a recording, playing it backwards, or mixing together two or more sounds to produce a new and eerie effect.

Armed with some basic sound generator gear you can readily produce your own effects that match or even rival anything you’ve heard in the movies. You can build up your equipment repertoire using second-hand gear. Example: an old reel-to-reel tape recorder is still useful in making sound effects -- manually interfere with the tape as it goes through the machine to make “phasing” and warbling sounds.

The Modern Way to Recording Sound

For recording any sound you can use either the sound card on your PC, or better yet a digital recording and playback deck. Even a basic digital voice recorder (under $60) will do. These record to SD cards, and have a built-in microphone. Plan to spend a little more for better quality and additional features.

For example, the Tascam DR-05 Portable Digital Recorder records in stereo on a 2GB microSD card. A separate mic/line input allows you to record broadcast WAV (96 kHz as opposed to 44.1 kHz for CD) from a separate microphone or other line-level device.

For a few dollars more you can upscale to the Tascam DR-07MKII

Most PC sound cards have a monophonic microphone input. The jack is 1/8", so if your microphone has the larger 1/4" or professional-style XLR connector you’ll need an adapter. Read the instructions for the card to determine if the mic input can double for recording line level audio. Quality suffers if the card is designed to only accept a microphone.

If your PC doesn’t have a sound card capable of recording you can opt for an external USB audio adapter, such as the StarTech.com 7.1 USB Audio Adapter. Despite its low cost (under $40), this handy box is packed with features, and is well rated. It has separate (stereo) microphone and line inputs. It connects to your computer through a standard USB cable..

Zounds! - Old-School Sound Makers

You can always produce sound effects using various free and paid software on your computer. In fact, this is often the easiest method. You can record the sound directly to a file. One of the most popular sound editing and effects software is Audacity.

Though older technologies, analog audio gear provides a hands-on method of creating sound effects.

Audio Signal Generator This device, also called an audio oscillator, creates square, saw, and/or triangle waves over the sound spectrum -- about 20 Hz to 20,000 Hz. You dial in the frequency range you want, then turn a dial to fine-tune. This fine-tuning is how a number of Hollywood sci-fi movie sounds were created. Just twist the dial for warbles, sirens, and other effects.

eBay or ham radio conventions are your best bet audio oscillators. Avoid the museum pieces and opt for one that’s in clean shape and doesn’t cost too much. Heathkit made good audio signal generators, so that’s a brand worth looking for.

LP Turntable
If you were born after about 1985 you might never have played a song on an old-fashioned vinyl “record.” An LP record player is a simple motorized turntable with a tone arm that transforms the grooves in the record into audio signal. (LP means “long play,” a turntable large enough for a 12” album.)

The turntable was the mainstay for DJ “scratching,” now the domain of specialty CD players and digital playback, and these days you’ll mostly find them used to transfer old LPs to MP3. But you can still use most any turntable -- and most any record, including beat-up ones from the thrift store -- to make exotic sounds.

Try various techniques like dragging the tone arm across the grooves of the record, manually spitting the turntable (including backwards), and of course scratching. Use your sound editing software to transform the scratches into unusual sounds. (Keep in mind that scratching and dragging wears down the turntable needle and damages the LP. Don't do this to LPs you want to keep, and be sure to have spare needles for replacement.)

Analog Theremin
The theremin is a musical instrument that’s played by waving your hands over a pair of radio antennas. These antennas pick up the capacitance of your body, and translate the proximity of your fingers and hands into audio tones. The overall effect is an eerie but distinctive “shimmering wall” of sound. Theremins were heavily used during the 40s through 60s to produce background music and sound effects for movies, including the original The Day the Earth Stood Still.

There are many cheap copy-cat theremins available that use digital techniques to mimic the sound of a theremin. Most are poor substitutes; in a real theremin the sound is made by mixing together a very low frequency signal with a very high (well beyond human hearing) frequency. The difference between these two signals is what produces the actual sound that comes from a theremin.

Performance-grade theremins are much too expensive to buy just for creating sound effects -- the Moog Etherwave is over $350. The PAiA Theremax is a good alternative choice. It comes as a kit, with and without wooden case.

The version without case is $160. I do recommend putting it into a cabinet or case of some type, as that helps playability. The home circuit boards are more sensitive to your body capacitance. (Kit construction requires intermediate and above skill; don’t try it if you’re a beginner.)

Modern Stand-Alone Sound Generators

Adding to your audio arsenal are a wide variety of modern stand-alone (not computer software) generators. Most are based on some kind of microcontroller that either generates the sound independently, or manages a separate sound-producing integrated circuit. Two of most popular, and affordable, are the Speakjet and Babblebot. Both are single ICs that are commanded either from a serial port on your PC, or through a microcontroller like the Arduino, BASIC Stamp, or Parallax Propeller.

You can use the Speakjet and Babblebot as either real-time sound makers, or for recording voice and effects. When recorded you can further manipulate the sounds. Use a program like Audacity to alter different aspects of the sound - the combination of effects is nearly limitless.

Speakjet

The Speakjet is intended to synthesize human speech. That speech is really made up of several dozen distinct sounds called phonemes. By grouping phonemes together the speed is heard as words and sentences.

While the Speakjet is made for speech, there’s no reason you can’t create oddball sound effects with just the separate phonemes -- the “ssssss” of the letter s, for instance.

Babblebot/Soundgin

The Babblebot (used to be called the Soundgin) is similar to the Speakjet; in fact one of the developers of the Speakjet went on to produce the Babblebot. In addition to speech, Babblebot generates sound effects and music. It does this by combining the waveforms of multiple audio oscillators built into the chip.

The Babblebot is not easy to program, though separately available PC-based demo software lets you play with many of the features. But it’s an ideal and very low cost all-electronic sound effect maker. By mixing several signal sources into one output you can create unusual flying saucer, ray gun, and teleportation effects.

Keyboard Synthesizer

Digital keyboards are like electronic pianos, but are capable of reproducing many instruments. Most keyboards have presets allowing you to select a particular sound or effect, without having to know how the elements of the sound, or how it’s being produced. You can select the frequency of the sound by pressing a key on the keyboard.

Keyboard synths can be either stand-alone or connected to a PC. You can directly record the sound from a stand-alone synthesizer; for a PC synth you need to connect it to your computer with a USB cable. Software running on the computer generates the notes you play. The software has an option for recording.

Of all the sound-making equipment you may get the keyboard synthesizer is likely to be the most expensive. You don’t want a toy -- it won’t have any features. That leaves the keyboards in the $400+ range, with many costing even more.

One reasonably affordable option is the Korg microKorg Analog Modeling Synthesizer. It includes a vocoder, a device that can alter the pitch of your voice. Analog modeling keyboards simulate the older fashioned analog synthesizers, but do it using completely digital means. They’re not exactly easy to use, but they offer a great deal of flexibility.

Other Music & Sound Components

The world is awash with music equipment that can be used for sound generation. Amazon, Musician’s Friend, B&H Photo, Bets Buy, Sam Ash, zZounds, and many others carry a large inventory of electronic devices for producing, recording, altering, and otherwise working with music and sound. Do a virtual stroll down their aisles, and if the site doesn’t have any demonstration videos, check on YouTube.

Microcontrolled MIDI Sound

One of my favorite techniques of producing sound is using a breadboard-level MIDI synthesizer, such as the SparkFun Musical Instrument Shield. Connected to a microcontroller like the Arduino, this board creates synthesized versions of over a 100 instruments. The MIDI board accepts simple serial commands from the microcontroller, and sounds a single note.

You can choose such instruments as an acoustic piano, saxophone, or drum. Record the sound, then digitally modify the clip it to make it more interesting. Free and paid audio editing software like Audacity and Goldwave provide numerous pre-set effects that you can apply to the sound clip. For example, you can very easily play the sound backwards, or add heavy echo.

Use the MIDI synthesizer to record sounds. You can leave the sounds as-is, or process them through sound software -- increase or decrease speed, layer the sound with others, add heavy reverb and other effects, and more.

For more on using MIDI with microcontrollers see my article in the April 2012 issue of SERVO magazine, where I explore using an Arduino to produce sounds on a small desktop robot.