Audio Hacker Voice Changer

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.

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.

Published by Michael, on July 5th, 2013 at 9:55 am. Filed under: Audio. | 8 Comments |

8 Responses to “Audio Hacker Voice Changer”

  1. Is there a way to make this work in real time
    And be portable with a mic and power supply say like mounted
    In a helmet? If yes do you make them and sell them

    Comment by Fel3000ft on January 14, 2014 at 10:33 PM

  2. If it were possible to do it in realtime, I certainly would have!

    Comment by Michael on January 15, 2014 at 1:33 PM

  3. Wait. If it’s not possible to do this in real time, then why does the audio hacker page have “electret microphone” under “input type” as an option?

    Comment by Kurt on February 12, 2014 at 1:05 AM

  4. You can use a microphone as input. That has nothing to do with whether you can manipulate the audio in realtime with this project. You can record your voice on the Audio Hacker and then manipulate it, but you cannot manipulate it while you are speaking (realtime).

    Comment by Michael on February 12, 2014 at 7:20 AM

  5. Can this project be done using standalone avr mcu rather than using arduino?
    If possible please give details.

    Comment by john on July 6, 2014 at 12:57 PM

  6. Yes, if you build a standalone Arduino circuit and connect the Audio Hacker to it with all the shield pins connected to the corresponding ATmega328 pins.

    Comment by Michael on July 6, 2014 at 5:45 PM

  7. Is there an upgrade for this project? All the other Audio Hacker examples work except the voice changer. I’m running on a Duemilanove 328. The program just dies in the middle of sending the first serial report. Do I need a faster Arduino for this?

    Comment by Danny on March 5, 2015 at 6:59 PM

  8. A Duemilanove should work just fine. It has the same chip as an Uno. Have you tried turning off debugging by commenting out
    #define DEBUG

    ? There’s not much reason to have the debugging on and maybe it is interfering with the audio interrupt.

    Comment by Michael on March 5, 2015 at 7:06 PM

Leave a Reply