Instructables
Picture of Arduino Vocal Effects Box
IMG_9975 copy.jpg
main pic.jpg
This Arduino-powered vocal effects box pitch shifts and distorts incoming audio signals to produce a wide variety of vocal effects.  This project is my first experiment with real-time digital signal processing using Arduino.  It samples an incoming microphone signal at a rate of about 40kHz, manipulates the audio digitally, and then outputs 8 bit audio at 40kHz.  To minimize the amount of computation required by the Arduino, I used a technique called granular synthesis to manipulate the incoming audio signal.  Essentially, as audio comes into the Arduino it gets cut up and stored as small (millisecond or microsecond sized) samples called "grains."  These grains are then individually manipulated and played back; they may be lengthened or shortened, stretched or compressed, played back in reverse, copied several times, or mixed with other grains.  You can hear a (somewhat creepy) audio sample from the effects box below:


Granular synthesis creates a unique type of distortion caused by discontinuities between individual grains in the outgoing signal.  Sometimes this distortion creates an effect I can only describe as a "ripping" sound, other times it introduces new frequencies into the audio that were not present before.  Here is an example by Aphex Twin, the granular synthesis is especially prominent in the bridge at around 3min in. Another example of granular synthesis, this time applied to vocals for pitch shifting and textural effects, is from Paul Lansky.  My favorite thing to do with this effects box is to use subtle pitch shifting to achieve an androgynous vocal sound, I got the idea for the project after listening to copious amounts of Fever Ray this past winter, you can hear how she pitch shifts her voice to sound somewhat masculine at times.



PARTS LIST

(1x) Arduino Uno REV 3 Radioshack 276-128
(7x) 10K Ohm 1/4-Watt Carbon Film Resistor (2 packages) Radioshack #271-1335
(9x) 20K Ohm 1/4-Watt Carbon Film Resistor (2 packages)
(1x) 1K Ohm 1/4-Watt Carbon Film Resistor Radioshack 271-1321
(1x) 50K-Ohm Linear-Taper Potentiometer Radioshack #271-1716
(1x) 10KOhm Audio Control Potentiometer with SPST Switch Radioshack #271-215 (this will be used to control volume and turn the device on/off)
(5x) 0.25" Knurled Knob Radioshack 274-424
(2x) 9V Alkaline Battery Radioshack #23-866
(2x) Heavy-Duty 9V Snap Connectors Radioshack #270-324
(1x) PC Board with Copper Radioshack #276-147
(1x) SPST PC-Mountable Submini Toggle Switch Radioshack #275-645
(2x) Male Header Pins Jameco 103393
(3x) 8 pin socket Radioshack 276-1995
(1x) TL082 Wide Dual JFET Input Op Amp Radioshack 276-1715
(3x) 100K Ohm 1/4-Watt Carbon Film Resistor (1 package) Radioshack 271-1347
(1x) 10uF electrolytic capacitor
(1x) 47nF capacitor
(3x) 0.1uf capacitor Radioshack 55047557
(2x) 1M-Ohm Linear Taper Potentiometer Radioshack 271-211
(1x) 1MOhm logarithmic potentiometer
(1x) 2kOhm 1/4-Watt Carbon Film Resistor
(1x) male header pins Jameco 103393
(1x) 10K-Ohm Linear-Taper Potentiometer Radioshack 271-1715
(1x) DPDT Flatted Metal Lever Toggle Switch Radioshack 275-636
(2x) 1/4" stereo jack Radioshack 274-141 or Radioshack 274-312
(2x) 5mm High-Brightness White LED (1 package) Radioshack 276-017
(2x) 100 ohm 1/4W 5% Carbon Film Resistor Radioshack 271-1311
(2x) TS922IN Dual Op Amp Digikey 497-3049-5-ND (one TS924 would also work, but they are not available on digikey at the moment)

Additional Materials:
22 Gauge Wire Radioshack #278-1224
Solder Radioshack #64-013
sand paper
plywood
wood glue
hot glue
screws

Download Arduino IDE
 
Remove these adsRemove these ads by Signing Up
1-40 of 75Next »
ryuchan115 months ago

Hi Amanda, the audio potentiometer with control switch isn't available in radioshack and I can't find anywhere to buy it. May I know the replacement for it, or can I use regular potentiometer as the replacement?

amandaghassaei (author)  ryuchan115 months ago

that's a bummer:

http://www.futurlec.com/Potentiometers/POT10KBSWIT...

or you can just use a regular pot and a switch.

thanks for the reply. right now, I have 1M logarithmic potentiometer with switch. will this potentiometer works with this project since the one you used is the regular without switch?

amandaghassaei (author)  ryuchan115 months ago
You can use that in place of a 1m log pot without a switch
fightdu7 months ago
If I brought a dac device how would it change coding its 2wire serial divice ?
machineslave9 months ago
Hi Amanda,
do you know would it be ok to plug an external instrument ie. a drum machine or synthesizer into the input of the box? or would that cause some issues with power?
amandaghassaei (author)  machineslave8 months ago

that would work

Bosleymusic10 months ago
The capacitor isn't really a DC offset - it's a blocking cap which allows AC to pass and there is a major difference. DC offset is constant while blocking caps must take charge and discharge times into account, and also act as a high pass filter by default. The larger the cap the slower the response of blocking DC will be, while the lower the value the higher the cutoff or corner frequency of the Filter. Trade-offs...
excellent
Hey amanda !

What can I do if TS922IN and TS924 have not available in my country?

What is the possible trouble if i try to use another kind of Op Amp?

Cheers !
amandaghassaei (author)  Simon Belmont1 year ago
you can use any op amp - 072/82 are fine. the great thing about the TS922 was that it runs off 0-5V, meaning the arduino could send it power.
ReeveC1 year ago
How about arduino Due ? I'm looking at that. It seem capable enough, am i right?
amandaghassaei (author)  ReeveC1 year ago
it's capable enough, but a bunch of the code will need to be modified. The analog input setup code especially.
ReeveC1 year ago
Sorry, i am having some problem with the CAPTCHA. Hence, i am posting a new comment..

Thanks for the reply amanda!
This is an interesting project. Would love to try it out as a toy for my niece! Do you have any idea is there another model of arduino's with higher processing power and with the similar schematic?
amandaghassaei (author)  ReeveC1 year ago
there isn't unfortunately, the speed of the mega is the same.
ReeveC1 year ago
Hey amanda !

May i check where do you store the recorded file being processed ? In the temporary storage in the arduino board itself?

Is there any way that i could store the recorded files in a SD/MMC?

Cheers !
amandaghassaei (author)  ReeveC1 year ago
right now it just get's stored in the arduino's memory, you can theoretically record to an SD card, but I have a feeling you will run into speed problems. The audio in/out is hogging most of the arduino's processing power, so it's difficult to do too many more things in parallel.
knutolai1 year ago
For some reason the anti-spam captcha box won't appear when I wish to post a reply. Ill just add my reply as a new post:

I see. Yeah I was actually quite surprised at the relatively high samplerate you managed to achieve! I though the atmega328 was way to slow/simple to handle that. Have you considered using a audio codec (external ADC and DAC) (http://uk.rs-online.com/web/c/?sra=oss&r=t&searchTerm=audio+codec&x=-608&y=-21) for both input and output? I don't think there is very much point in increasing the fidelity after the processing when the audio is compressed to 8-bit fidelity when 'entering' the Arduino.
This could also be something to look into: http://soniccrayon.blogspot.no/2012/08/anti-nautilus-or-autoglitch.html (the schematic, first image below the youtube video)
knutolai1 year ago
Hi Amandaghassaei! First of; Great project! Im gonna have to build one this summer :) Something came to mind though. I saw you mentioned you were looking to increase the fidelity by adding a DAC chip. Have you considered the option of using the output PWM-stream option of the atmega328 chip? That would be a option to building a resistor-ladder as you have done. You would only need one digital output channel and a low-pass filter (preferably a two pole, or steeper, filter).
amandaghassaei (author)  knutolai1 year ago
theoretically this idea is possible, but I think in practice the arduino is just not fast enough to handle audio input and PWM output at 38kHz. The resistor ladder is the most minimally processing intensive way to get the audio out. This project pushed the limits of what the arduino is capable of, I think you would find some very odd behavior if you tried to push it more. great idea though, would totally work in another context! I'm curious about how the fidelity would compare.
An easier alternative to that would be just buying a resistor pack.
Normally, the pitch of a perf board is actually not 2.54 mm but 0.1 inch (although they are almost exactly the same length) - the standard that established that spacing used inches, not mm, so the size should be quoted in inches, not mm.
tmdrake1 year ago
I might have to try this project...I really want to get my hands dirty with DSP...this looks like the easiest way to learn so far.
manuel1231 year ago
I'm working on a similar project, how did you power the arduino, I see no connection to the Vin pin in any of your diagrams.
amandaghassaei (author)  manuel1231 year ago
sorry, I must have forgotten to draw that in the schematic, I'll change it asap.  Vin is connected the the +9V supply that is powering the TL082 mic amplifier op amp. It is just a 9V battery supply. be sure to connect the negative terminal of the battery to Arduino's ground. I actually wrote an instructable about it here.
Also, is it possible to use a ac-dc power supply instead of two batteries? A voltage divider should provide positive and negative current to the op amp but I'm not sure how you'd ground the arduino.
amandaghassaei (author)  manuel1231 year ago
yes it is possible. you should look up dual rail supply circuitls. Here is a good start:
http://www.instructables.com/id/Split-rail-power-supply-from-a-single-rail-supply/
you can see in this project how there's a +V, -V, an 0V supply. Connect the 0V supply to Arduino ground.
Got it, thanks a lot. Built a buffered voltage divider using an op-amp to save space. One last question, I want to use a DAC instead of the resistor ladder to save space and improve the sound quality, I have a bunch of DAC0800 ICs and I know the basics of how to work them but my current setup doesn't seem to be getting any sound out of the arduino (I'm using your sine wave generator code) how would you set up the DAC?
amandaghassaei (author)  manuel1231 year ago
funny you ask me that today, I just posted a relevant project here:
http://www.instructables.com/id/Stereo-Audio-with-Arduino/
your dac setup should be similar, let me know if you still can't get it up and running, I can take a look at the data sheet.
I got it to run but it turns out the buffer is not doing it's job properly. It works when I invert the voltage inputs but it gives me negative voltage. I tested the divider and I'm getting 4v on one end and 10 on the other I need some kind of buffer that has a small outline (I'm short on space)
I'm thinking either a rail splitter or a BUF634 buffer.
AMC921 year ago
Hey so I am currently putting this project together for a class. I am around step 10 and you say to use a 2kOhm resistor, except in the supplies list there is not one listed, or at least not that I can find. I wanted to make sure this is the resistor I need to get. If you could let me know that'd be great! :)
amandaghassaei (author)  AMC921 year ago
yes, it's in there. sorry I'll update the parts list!
Vee201 year ago
Hi, there was just a glitch in my connections. Got my sound working all right :)
I had this hooked up and was messing around with sound on my PC speakers and was wondering if this voice stream could get sent to my PC via ethernet. Say using the ethernet shield connected to the arduino being used?
amandaghassaei (author)  Vee201 year ago
I think it could work. The ethernet shield uses pins 10-13 to communicate:
http://www.arduino.cc/en/Main/ArduinoEthernetShield
so you will need keep those pins free. If you keep the clipping indicator, you will need to move it to another digital pin (like pin 9)
Check out this piece of code:
http://www.instructables.com/id/Arduino-Audio-Input/step7/Interrupt/
you should try to send your serial data via ethernet inside the interrupt routine. Hopefully the Ethernet Shield is fast enough to send data at 38.5kHz, I'm not sure.
code with clipping indicator is at the bottom of this page:
http://www.instructables.com/id/Arduino-Audio-Input/step8/Clipping-Indicator/
change all the 13's to 9's
amandaghassaei (author) 1 year ago
do you have an amplifier connected to the DAC? your headphones may be putting too much of a load on the DAC and causing the signal to sag. do you have an oscilloscope? is there any way for you to measure the amplitude of the incoming/outgoing signals? maybe even a multimeter in ac mode?
Vee201 year ago
Hi, such an awesome instructable. Very clear, especially for a novice like me!
I'm working on a project and wondering if this can also work with voice input, via an electret (specifically using this one: http://www.sparkfun.com/products/9964) ?
Thanks for your assistance!
amandaghassaei (author)  Vee201 year ago
thanks! yes, this will work. I actually just bought a few of these myself to mess around with, I'm sure I'll be posting more about them soon. I'm not sure how big the signal coming out of these mic elements is, you may need to adjust the gain of the amplifier (by changing the resistor values). I go into a lot more detail about setting up a mic input for an Arduino here. I also did a fun frequency detection project here that you might like.
Let me know what you make! and definitely let me know if you have questions!
HI, so I got to work connecting up my board, with said electret. As it has the break out board (with 100x gain and dc offset) I just connected it straight to the Arduino. (analogue pin 0, gnd and 5V).
I connected up the DAC as per your instructions. However, using the sketch in step 27, I don't get any sound through to my headphones (zero output). I find this odd as my serial monitor is giving me an endless stream of symbols (input from electret).
Please help, I have no idea what I could be doing wrong, may have missed something.
Oh, for now I'm just working on inputting voice, through a mic and out through headphones, manipulating it with arduino. This seems pointless at the moment but it will be implemented into a larger project with arduino at it's core. Will keep you updated as I go along.
Thanks again for your help :)
dfodel11 year ago
Hey Amanda... this thing looks great. I am wanting to build one to use to process ambient room sounds that one could then listen to in headphones. I was just wondering if you could try that and post a recording, just so I'd know what the result might sound like?
Thanks for the super clear images and directions.
1-40 of 75Next »