Maker.io main logo

How to Add Sophisticated Sound Effects to Your Hobby or DIY Projects

2021-04-13 | By Clive Maxfield

License: See Original Project

As you may have gathered from my recent blogs Create a Cunning Chronograph with Arduino, Audio-Reactive Artifact with Arduino – Part 1: The Initial Hardware Setup, and Audio-Reactive Artifact with Arduino – Part 2: Making it Smarter, I invariably have a cornucopia of hobby projects on the go. One day, I hope to actually complete one of these little beauties, but that will be a story for another day.

Some of these projects, like my Audio-Reactive Artifact, respond to sound. Others can be enhanced by the ability to produce interesting sound effects to complement whatever it is they are doing at the time.

Take my Vetinari Clock, for example. This project commenced a few years ago when I picked up a bunch of antique analog meters from a local Hamfest and I decided to use some of the more distinctive items to implement a clock. The idea was to use a large meter to reflect the hours, two medium-sized meters to display the minutes and seconds, and a small meter to flip back and forth once each second like a metronome (Figure 1).

clock_1

Figure 1: A prototype of the Vetinari clock with its four antique meters, five antique switches, and a defunct vacuum tube just for show. (Image source: Max Maxfield)

Lest you think I’m getting sloppy, I should note that the front panel shown in Figure 1 was a quick mockup I threw together from a bit of scrap wood to experiment with the “floating above the tabletop” effect and to verify the placement of the meters and switches. However, having embarrassed myself in this way, I feel I have to redeem myself by showing some of the thought that went into this layout (Figure 2).

layout_2

Figure 2: When they see the final artifact, most people don’t realize how much thought goes into creating a layout for something like the Vetinari Clock. (Image source: Max Maxfield)

I should perhaps point out that I’ve never had any formal training in product design, so I’m not claiming that I have a clue as to what I’m doing. All I am saying is that I put a lot of effort into doing it.

In the case of the meters, a graphics artist friend, Denis Crowder, created new graphics for the faceplates. I then turned to another friend, Jason Dueck, at Instrument Meter Specialties. These folks are experts at repairing and restoring analog meters, and Jason was kind enough to refurbish my meters and add the new faceplates.

This tempting timepiece is controlled by an Arduino A000066 Uno R3 development platform based on the ATMEGA328P microcontroller from Microchip Technology. Accurate timing is maintained by means of a 255 ChronoDot Ultra-Precise Real-Time Clock (RTC) from Adafruit, which is based on the DS3231 integrated circuit (IC) from Maxim Integrated. Although you can’t see it in Figure 1, underneath the vacuum tube is one of Adafruit’s 2854 rings with 16 tricolor light-emitting diodes (LEDs) in the form of NeoPixels.

Now, unless you are a fan of the Discworld novels by the late, great Terry Pratchett (RIP), you may have been wondering as to the “Vetinari” moniker associated with this project. Well, Lord Vetinari is the scary dictator of the city-state of Ankh-Morpork. The clock in his waiting room keeps time accurately overall, but it sometimes ticks and tocks out of sync: “tick-tock, tick-tock... tick-tock-tick... tock...” it occasionally misses a tick or tock altogether. As a result, after sitting in Vetinari’s waiting room for any length of time, a visitor’s nerves will be completely frazzled by the time they are eventually granted an audience.

Initially, I was thinking of adding only a simple “tick-tock” sound. Later, I decided to randomize things a bit to reflect Vetinari’s tortuous creation. Later, it struck me that I could add all sorts of audio effects. For example, we could add the sound of clockwork gears and other mechanical mechanisms manically beavering away in the background. Alternatively, we could go for a pneumatic-hydraulic effect with the sounds of air bursts accompanying drips of water.

There’s also something I’ve been calling the “straining mode.” The idea here is that we have full control of the positions of the needles on the meters. Take the hour meter, for example. We could make the needle gradually move from one hour to the next over the course of that hour. Alternatively, we could leave it on the current hour until we reach the start of the new hour, at which time the needle could flip from the old to the new. Now, this is where things get interesting. A few seconds before the turn of the hour, the needle on the hour meter could start to quiver in anticipation, accompanied by some sort of a straining sound. The tension (frequency, volume) could build until… the virtual mechanism releases (with an appropriate sound effect) and the needle flips over to point to the new hour.

I was really rather taken with this idea, so I started to look around for suitable sound cards, but nothing appeared to be available. I did discover a variety of cheap-and-cheerful cards that could play MP3 audio files from an SD-Micro card, but they could play only a single file at a time, and I wanted to be able to “layer” multiple effects to reflect things like someone flicking a switch causing a new sound effect to occur while the clock was in the middle of its “straining” effect, for example.

To be honest, I’d pretty much given up hope. A few of my maker friends and I were thinking about designing our own sound card from the ground up. Then one of our members, Duane Benson, discovered the WIG-13660 WAV Trigger board from SparkFun (Figure 3).

This high-fidelity polyphonic audio player is the answer to my dreams. In its simplest mode, you start by loading your sounds as uncompressed 16-bit, 44.1 kilohertz (kHz) WAV files (the same quality as an audio CD) on a micro SD card, which you insert into the board. The name of each of these files starts with a number, like 0001xxx.WAV, 0002xxx.WAV, and so forth.

board_3

Figure 3: The WAV Trigger allows you to play up to 16 tracks of uncompressed 16-bit, 44.1 kHz WAV files simultaneously. (Image source: Max Maxfield)

Now observe the sixteen trigger inputs—each with an associated ground pin—arranged as two groups of eight on the lower right-hand side of Figure 3. By default, applying a falling edge to a trigger (like connecting it to ground via a switch or push-button) will cause the corresponding sound file to play. The great thing is that the board acts as a mixer, allowing you to play up to 16 tracks (voices) simultaneously, thereby allowing your audio effects to overlap.

But this is just the beginning. As opposed to using switches or pushbuttons to launch the sounds, you can use sensors or a microcontroller to trigger the desired effects. Also, as described in the WAV Trigger Hookup Guide, you can actually load up to 2,048 audio files onto your micro SD card, and then you can use the InitMaker application to configure the trigger inputs to play sequential or random tracks, pause and resume groups of tracks, control the volume, and more. Also, an Arduino library allows for complex serial control like real-time mixing, starting multiple tracks in sample-sync, and smooth cross-fading between tracks.

Conclusion

Adding sound effects to your hobby projects increases their interest and boosts their “Ooh” and “Aah” factor. There are myriad free sound samples available on the internet, plus you can easily record and edit your own. Now, imagine the faces of your audience if, when you flick a toggle switch on your creation, instead of a simple “click”, they hear the sounds of weird and wonderful virtual mechanisms performing their magic. As always, we are limited only by our imaginations.

TechForum

Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.

Visit TechForum