Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

Make: Projects

Custom Sound

Learn to shape sound waves with timer chips to create your own digital sampling system emulator.

Sound Synthesis Basics

Anyone familiar with a 555 timer knows that it can create audible frequencies. What you may not have considered is that a timer can manipulate waveforms to create different kinds of sounds. You can actually custom-build your own audio waveform, one digital slice at a time.

The Output Device

Because accidents may happen, you may not want to use a high-quality loudspeaker in this experiment. Still, you do need one that can reproduce a reasonable range of frequencies. A 3″ (75mm) speaker costing around $5 should be adequate, provided it’s mounted in a resonant enclosure such as a project box. See photos below.

FigureA

Installation of a 3″ speaker in a plastic project box. Nuts have nylon inserts to guard against loosening from vibration. The rear panel of the box must be attached to achieve acceptable sound.

Holes must be large enough to transmit sound while providing protection for the speaker cone. Start with a 1/16" drill bit and work up in small steps to the final size, to avoid fracturing the plastic.

Holes must be large enough to transmit sound while providing protection for the speaker cone. Start with a 1/16″ drill bit and work up in small steps to the final size, to avoid fracturing the plastic.

Versatile Timing

I chose a 14538B chip for my first venture into sound synthesis, because it’s loaded with options that were missing from the old 555 chip. It contains two monostable timers, each with two trigger pins and two output pins. One trigger is sensitive to a rising edge, while the other responds to a falling edge. One output is active-high, while the other is active-low. Pinouts are shown below.

(C) The 14538B chip contains two monostable timers. Reset pins and falling-edge trigger pins must be tied to positive ower if they are not used. Unused rising-edge trigger pins must be grounded. Unused output pins must be left unconnected.

The 14538B chip contains two monostable timers. Reset pins and falling-edge trigger pins must be tied to positive ower if they are not used. Unused rising-edge trigger pins must be grounded. Unused output pins must be left unconnected.

The pulse duration from each timer is set with one resistor and one capacitor. If R is resistance in kilohms and C is capacitance in microfarads, you can determine the pulse time, in seconds, using this formula:

= (R × C) / 1,000

For example, a 22µF capacitor with a 100K resistor will create a pulse lasting 2.2 seconds.

Each timer only runs in monostable mode, but they can trigger each other to create a pulse stream. A circuit to achieve this is shown in the photo below.

(D) This test circuit will generate pulse pairs summing to approximately 2 seconds.

This test circuit will generate pulse pairs summing to approximately 2 seconds.

My plan is for Timer 1 to create a pulse, after which Timer 2 will create a delay before the next pulse, and the combination will constitute a single cycle in a sound wave. To make the changes in sound quality easier to hear, the frequency must remain constant, which is achieved by controlling the two timers with two sides of a potentiometer. When one timer speeds up, the other slows down by an equal amount, and the output should look like the graphs.

(E) Output pulses from one timer in the 14538B chip are separated by pauses created by the other timer. The trimmer potentiometer creates different waveforms that have the same frequency.

Output pulses from one timer in the 14538B chip are separated by pauses created by the other timer. The trimmer potentiometer creates different waveforms that have the same frequency.

Powering Up

The 14538B operates with a supply of 5V to 18V, and it can be powered with a 9V battery. No voltage regulation is required. Output current is restricted to 10mA, so a 1K resistor must be used with each LED.

When you apply power, nothing happens — because the two timers are waiting for each other. Press and release the tactile switch to create the falling edge required at Pin 11 to trigger Timer 2. When its high output ends, Timer 2 triggers Timer 1 on Pin 5. This to-and-fro process continues indefinitely, as the timers play tag with each other.

Small signal diodes prevent each timer from trying to force a positive voltage into the output of the other. The LEDs show what’s going on. Turn the trimmer to and fro, and watch how they swap the long and short cycles.

Mini Project 1: The Sound of Sound

Difficulty: Easy

If the concept is now clear, let’s crank the frequency to an audible value. I chose 600 pulses per second — that is, 600Hz. Remove the two 22µF capacitors and substitute two 0.015µF capacitors. If your meter will measure capacitance, select capacitors whose actual values are as close to each other as possible. This will ensure that the output frequency remains constant when you turn the trimmer.

(F) This simplest configuration of the LM386 amplifier chip creates a gain of 20:1. The 100-ohm trimmer potentiometer may affect sound quality slightly, but is the most effective way to adjust volume.

This simplest configuration of the LM386 amplifier chip creates a gain of 20:1. The 100-ohm trimmer potentiometer may affect sound quality slightly, but is the most effective way to adjust volume.

The 14538B isn’t powerful enough to drive a speaker, so you will need an amplifier. An LM386 chip will do. Wire it as shown in above. A photograph of the complete breadboarded circuit appears below.

(G) In this breadboarded circuit, the red and black wires supply 9VDC from a battery while the gray wires go to the loudspeaker.

In this breadboarded circuit, the red and black wires supply 9VDC from a battery while the gray wires go to the loudspeaker.

Connect the power, press the tactile switch, and listen while you turn the trimmer. When the high pulse and the low pulse are about equal, the sound is mellow, but at opposite ends of the scale it becomes edgier. This is because the shape of the sound wave determines how many harmonics will be audible — the higher frequencies that are a multiple of the one that’s dominant.

Remove the 100K trimmer and substitute a 250K trimmer. This creates a richer range of sounds, because the lower frequency allows more room for harmonics. If you mounted your speaker in a resonant box as I suggested, a 500K trimmer should sound best of all. To learn more about harmonics, try the online tutorial at thedawstudio.com/Tips/Soundwaves.html.

Mini Project 2: Advanced Wave Building

Difficulty: Moderate

(H) Pulses of differing voltage and duration may be superimposed to create a stairstepped audio waveform. Three bipolar 555 timers run in monostable mode, synchronized by a fourth astable timer.

Figure H: Pulses of differing voltage and duration may be superimposed to create a stairstepped audio waveform. Three bipolar 555 timers run in monostable mode, synchronized by a fourth astable timer.

You can go much further into shaping a sound wave. The diagram above shows a concept for a circuit using four 555 timers of the old bipolar type (also known as the TTL type) which can drive a loudspeaker directly. The first timer creates a stream of pulses, triggering the other three timers simultaneously. Each of them is running in one-shot mode for durations that are separately adjustable, and each output goes through a trimmer that is tapped to provide a variable voltage for the loudspeaker. The unequal pulse lengths combine to create different sized horizontal slices of a sound wave. See I for the breadboard schematic.

(I) Breadboardable schematic for block diagram in Figure H

Figure I: Breadboardable schematic for block diagram in Figure H above

Wave forms generated by Figure I:

waveform1 Custom Sound

No smoothing

waveform2 Custom Sound

1μF smoothing capacitor

waveform5 Custom Sound

.22μF smoothing capacitor

 

Mini Project 3: Digital Sampling System Emulator

Difficulty: Advanced

If you want to go still further, you can build an ultrasimple, bargain-basement circuit that emulates the sampling system used in all digital recordings. Figure J below shows the concept. A multiplexer samples each potentiometer very rapidly and sends its voltage through an amplifier to the speaker. Figure K is the breadboard schematic for this.

FigJ

Figure J: In this concept, a multiplexer rapidly selects voltages adjusted by potentiometers to build a symmetrical audio waveform.

 

FigK

Figure K: Breadboardable schematic for block diagram in Figure J.

We’ve been listening to digitally replicated sounds ever since Sony and Philips developed the first audio CDs some 35 years ago. Because the frequencies are actually quite slow by digital standards, all you need is a little imagination to process them with that most basic and familiar component, the timer chip.

Related
Charles Platt

Charles Platt

Charles Platt is the author of Make: Electronics, an introductory guide for all ages. He is completing a sequel, Make: More Electronics, and is the author of Volume One of the Encyclopedia of Electronic Components. Volumes Two and Three are in preparation. makershed.com/platt


Fredrik Jansson

Fredrik Jansson

Fredrik Jansson is a physicist from Finland, currently living in Amsterdam, where he simulates sea animals. He enjoys cheese, Belgian beer, and tinkering with electronics. Occasionally he blogs about projects together with his wife.


blog comments powered by Disqus

Related Supplies at Maker Shed

Follow

Get every new post delivered to your Inbox.

Join 26,154 other followers