Select Page

This Audio Hacker example shows how you can manipulate audio to radically change recorded samples. This project uses a technique called granular synthesis, to raise and lower the pitch of a sample. It’s easy to change the pitch of a sample by playing it slower or faster, but granular synthesis allows you to alter the pitch without changing duration of the sample. So if a recorded sample was 5 seconds long, we can play it back at a higher or lower pitch, but the played sample will still have a duration of 5 seconds.

The technique is rather complex, but it involves dividing the sample up into small fragments called “grains”. When playing back a sample, if we want the pitch higher, we play the grain at a higher speed, but we play it over and over again until it takes the same amount of time as the grain played at original speed. Likewise, to lower pitch, we play each grain at a slower speed, but move onto the next grain sooner so that the overall sample has the same duration.

This technique introduces some noise, but it works really well with voice recordings. To send your voice into the Audio Hacker, I recommend using Audacity. Enable the monitoring feature for the microphone so that anything picked up by the computer’s microphone to the computer’s audio output, which is connected to the Audio Hacker input.
audacityMonitoring


For this project I used the DJ Shield because it has 5 buttons and 3 pots. Record a sample with a button on D5, and playback with a button on D6. A potentiometer connected to A0 changes the pitch after recording. Before recording, set the A0 pot to the midpoint. When playing back a sample, use A0 to alter the pitch.

But there’s more! A potentiometer connected to A1 changes the size of the grains. And a potentiometer on A2 allows you to “stretch” each grain and play it multiple times. Now using all of these controls, we can do some really fun stuff! Here’s a video showing what you can do:

The Arduino sketch source code is an example in the Audio Hacker library: File->Examples->Audio Hacker->VoiceChanger.