Here’s another fun but simple project using the Audio Hacker shield for Arduino. This is a realtime voice changer, which is an improvement upon the original voice changer example I provided with the Audio Hacker library.
This project uses a technique called granular synthesis to change the pitch of the input. Granular synthesis 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 realtime voice changer only lowers pitch. Raising pitch would require a lag to record something and play snippits of it faster. Lowering the pitch is accomplished by recording the input and then simultaneously playing it slower. That is, the “play head” moves slower than the “record head”. Occasionally, the play head needs to skip ahead over some of the input and catch up to the record head. This way, the playback takes the same amount of time as the recording, making it seem realtime. It is realtime, we are just playing only part of what was input (slowly) and skipping the rest so that the overall time is the same.
The example is in the Audio Hacker Library examples folder so you can load it into the Arduino IDE with
File->Examples->Audio Hacker->RealtimeVoiceChanger
As always, get the Audio Hacker library from GitHub: https://github.com/nootropicdesign/audio-hacker
Would you be able to put this device in a mask?
Hi, how do I buy this exact setup? With the pitch lowering knob and everything.
Follow the link in the article for the product information about Audio Hacker and how to buy it.
https://nootropicdesign.com/audio-hacker/
Hello may I ask if you build this voice changer device and can I buy it from you . kind regards Marcus
Can the modified audio be routed to a PC’s Mic input instead of speakers? Say you want to change your voice and do the recording via the PC so to speak.
The output is headphone level on a 3.5mm jack, so if you can connect it to an input, yes.
What pins are the pitch pot connected to?
It’s connected to A0.
See in the code:
counterMod = map(analogRead(0), 0, 1024, 2, 11);