Introduction: The Arduino Synthesizer



The Arduino is able to output sound through a library that has been developed called the Tone Library.

By creating an interface and a program that can call certain values to be output to an audio out, the Arduino Synthesizer is a robust tool for making a rudimentary noise machine. It uses granular synthesis techniques to generate a distinctive sound that can be a whole lot of fun for musicians, artists, tinkerers, and hobbyists.




Step 1: How It Works

Sound is created by playing the same sound grain, or samples (small pieces of around 1 to 50ms) over and over again at very high speed. Our ears and brains turn this into an audible hybrid of the repetition rate and the original grain, and it sounds like a constant tone.

The grain consists of two triangular waves of adjustable frequency, and adjustable decay rate.

The repetition rate is set by another control.

Step 2: Materials and Tools

To make this project, you will need the following things.

Parts:
(5X) 5K potentiometer- (Radioshack #271-1714)
(5X) Potentiometer knobs - (Radioshack #274-416)
(3X) LEDs - (Radioshack #276-307)
(1X) SPDT switch - (Radioshack #275-1549)
(1X) Light Dependent Photo Resistor - (Radioshack #276-1657)
(1X) Arduino - (Radioshack #276-128)
(1X) Arduino Protoboard - (Radioshack #276-140)
(1X) Tactile Switch - (Radioshack #275-002)
(1X) Project enclosure - (Radioshack #270-1807)
(1X) 1/8" Audio Jack- (Radioshack #274-251)
(1X) a whole lot of solid core wire - (Radioshack #278-1222)
(1X) heat shrink - (Radioshack #278-1627)
(1X) breadboard - (Radioshack #276-002)
(1X) jumper wire - (Radioshack #276-173)
(3X) 10K ohm resistors - (Radioshack #2271-1335)
(3X) 220 resistors - (Radioshack #271-1313)
(1X) 9V battery - (Radioshack #23-866)
(1X) 9V battery clip - (Radioshack #270-324)
(1X) size M coaxial DC power plug - (Radioshack #274-1569)

Tools:
  • soldering iron
  • solder
  • flux
  • glue
  • multimeter
  • drill

Step 3: Code, Circuit Diagram, and Power.

I have attached the code for the Arduino to this Instructable. You will need a USB 2.0 to upload it to your board. After you have uploaded the code from your computer, go ahead and attach the Proto Shield to your Arduino. 

You have many options when it comes to power. The Arduino is capable of running on a 9v wall wart power supply, or you may use a 9V battery with a battery clip to a size M coaxial DC power plug. You may also power via your USB cable.

The circuit diagram was made with Fritzing, it has also been attached to this step.

Step 4: Using a Breadboard.

By using a breadboard to build the circuit first, it is much easier to transfer the circuit to your Protoboard later. Run wires from the GND and 5V to the - and + rails of your breadboard.

Then, connect the signal wires from the potentiometers to Analog Input 0-4 on the Arduino. The right and left side leads will get connected to the ground rail, and positive rail of the breadboard.

Connecting the potentiometers will control the grain, frequency, and decay of the synthesizer.

Analog in 0: Grain 1 pitch
Analog in 1: Grain 2 decay

Analog in 2: Grain 1 decay
Analog in 3: Grain 2 pitch

Analog in 4: Grain repetition frequency

Step 5: Wire Your Audio Jack.

Solder wires to the your 1/8" mono audio jack, make your leads fairly long. Connect your positive lead to PWM~ 3 on the Arduino. You will need a 10K ohm resistor between the arduino board and the positive lead of your audio jack. Connect the negative lead of your jack to ground rail of the breadboard.

Step 6: Connect Your Photoresistor.

One lead of your photoresistor is wired directly to your 5V positive rail on the breadboard, as well as Analog Input 5 on the Arduino. The other lead of the photoresistor is connected to a 10K ohm resisted ground rail.

Step 7: Connect a SPDT Switch.

Connect the signal, middle, lead of your SPDT switch to Digital pin 02 on the Arduino. The remaining leads are connected to ground, and the 5V positive rail that is resisted by a 10K ohm resistor.

Step 8: Wire the Tactile Switch.

The tactile switch has four leads. Allow the switch to straddle the bridge of the breadboard. Connect one of the two parallel pins to your 5V positive rail on the bread board, and the other to a 10K ohm resisted ground pin.  The last connection of your tactile switch connects a signal wire between the switch and Digital Pin 6 on the Arduino.

Step 9: Connect the LEDs.

Step 10: Test It!

This is the completed breadboarded circuit. Test with a pair of headphones, or connect to a small speaker. If you are using headphones, this is a mono output, and it will be loud. Do not put your headphones directly near your ear when firing up this synth.

Step 11: Drill the Enclosure.

Drill out holes in the project enclosure for each of the components that were placed in the breadboard. I used a gold paint pen to mark where I wanted my holes.

Drill five holes for the potentiometers.

Five small holes in a square for the tactile switch.

Three pairs of small holes for each of the LEDs

Two holes close together for the photoresistor.

One hole for your audio jack.

One additional hole for the SPDT switch.

Step 12: Start Adding Components to the Enclosure.

Thread the five potentiometers through the holes that have been drilled, then secure them into place.


Step 13: Add the Rest of the Components.

Secure the LEDs, SPDT switch, tactile switch, audio jack, and photoresistor into place. A dab of hot glue worked great to quickly mount all of these components.

Step 14: Wire the Audio Jack to the Protoboard.

The next few steps outline how to move the circuit from the breadboard to the Protoboard. Because all of your components are secured to the enclosure, it will be simple to run wires from your components to the board.

Solder lead wires to all of the components within the the enclosure, using red and black wires respectively to denote which leads are positive and negative.

On the Protoboard, connect one wire to digital pin 3, and solder into place, run a jumper wire to the center of the board so that you may break the line with the same 10K ohm resistor from the breadboard.

When you solder these into place, make sure you drop enough solder on to the board to connect the wire to the resistor.

Step 15: Solder in the Resistors for Photo Resistor, Tactile Switch, and SPDT Switch

Extend two jumper wires from the ground rail, and a jumper wire from the positive rail, out to the middle of the board. Form connections to your remaining 10K ohm resistors.

Connect a small jumper wire from Analog 5 that will run to the lead of the photo resistor.

Step 16: Solder Your LEDs Into Place

Connect 3 220 Ohm resisotrs to pins 9-11 on the Protoboard, sink the other ends of the resistors into the open holes of the protoboard, and then solder those wires to you LEDs.

Daisy chain the ground wires for the LEDs, then run a single grounding wire back to the ground rail on the Protoboard.

Step 17: Wire the Potentiometers to the Protoboard.

Daisy chain the positive and ground leads from the potentiometers together, then insert them into their respective rails on the Protoboard.

Wire the signal wires of the potentiometers to Analog 0-4, I kept the grain and frequency knobs on the first row of knobs, and the sync knobs below them.

Again, the signal wires sync accordingly:

Analog in 0: Grain 1 pitch
Analog in 1: Grain 2 decay

Analog in 2: Grain 1 decay
Analog in 3: Grain 2 pitch

Analog in 4: Grain repetition frequency

Step 18: Attach Your Knobs to Your Potentiometers.

Zero all of your potentiometers out, then align the line on the knob with the zero position on the potentiometer shaft.

Using a small flathead screwdriver, attach your potentiometer knobs.


Step 19: Connect the Protoboard to the Arduino.

Connect the short jumper wires on the Protoboard to the long leads in the enclosure. Solder the remaining wires to the ground rail, and 5V rail on the Protoboard, respectively.

Snap the Protoboard into place on top of the Arduiono.

Plug it in, seal it up, and you're ready to jam!

Step 20: Play With It!

All of the switches and potentiometers are completely interchangeable! instead of using all those potentiometers try replacing each of them with photo resistors, or combinations of the two.

References:
http://blog.lewissykes.info/daves-auduino/
http://code.google.com/p/rogue-code/wiki/ToneLibraryDocumentation
http://arduino.cc/en/Tutorial/Tone
http://itp.nyu.edu/physcomp/Labs/ToneOutput
http://code.google.com/p/tinkerit/wiki/Auduino

Comments

author
claude_cundiff made it! (author)2017-03-10

This is great! Thank you! One of my goals before my departure from this world is to recreate the TB303 and perhaps make my own synths...so I guess that's more than one item in the ole bucket list.

author
LoekJ made it! (author)2017-03-07

could you tell me what to do when you get this error?

Arduino: 1.8.1 (Windows 10), Board:"Arduino/Genuino Uno"

De schets gebruikt 4324 bytes (13%) programma-opslagruimte. Maximum is 32256 bytes.
Globale variabelen gebruiken 967 bytes (47%) van het dynamisch geheugen. Resteren 1081 bytes voor lokale variabelen. Maximum is 2048 bytes.
avrdude: ser_open(): can't open device "\\.\COM4": Het systeem kan het opgegeven bestand niet vinden.

The translation:

Sketch Uses 4324 bytes (13%) program storage. Max is 32256 bytes.
Global variables using 967 bytes (47%) of the dynamic memory. This leaves 1081 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open (): Unable to open device "\\ \ COM4.": The System Can not Find The specified file.


Probleem bij het uploaden naar het board. Zie http://www.arduino.cc/en/Guide/Troubleshooting#up... voor suggesties.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
author
sergio4688 made it! (author)2016-09-06

In addition to the input Jack, How could add another input Mini Jack?

author
ColinM74 made it! (author)2016-09-03

could you tell me what values the photoresistor needs please?

author
R Jordan Kreindler made it! (author)2016-07-11

A great idea.

author
licheong made it! (author)2016-07-07

When the output connect it to headphone, it is too loud because it is speaker-out level. Better add a 10k-1k resistor divider to protect your headphone!

author
EmirK1 made it! (author)2016-05-30

Its on bread board for now and looks little nasty but I am making a wooden box to build in it. Sounds great btw!

IMG_1082.JPG
author
ninuxi made it! (author)2015-11-26

I've play my bike With this arduino synth and Ipad with audiobus (Caramel, Stereo Designer, Muckraker, GliderVerb) https://youtu.be/mlR3V7W1JzA

author
solohust made it! (author)2015-11-03

All the links to RadioShack 404.

author
leolodreamland made it! (author)2015-11-02

i cannot compile this. added the latest tone library but it just sticks compiling. tried classic 1.05 and classic 1.06 as well as latest full...

author
leolodreamland made it! (author)leolodreamland2015-11-02

arduin uno btw

author
codeduino made it! (author)2015-06-11

This is pretty cool. Are there any more audio examples?

author
mathesen1097 made it! (author)2015-03-12

What do the switches, photoresistor, and leds do? I wanted to replace the photoresistor with a distance sensor that used a laser and phototransistor.

author
randelia made it! (author)2013-12-10

Code does not work on Leonardo. Code uses timer2 - leonardo does not have a timer2.
Does anyone have an update for how to run this on a Leonardo? I read something about using timer3 & tuning it's 16bit timer as compared to timer2 being 8bit...
Using Arduino 1.0.5 IDE - i get these compiler errors (all relating to timer2):
sketch_dec10b.ino: In function 'void audioOn()':
sketch_dec10b:259: error: 'TCCR2A' was not declared in this scope
sketch_dec10b:259: error: 'COM2B1' was not declared in this scope
sketch_dec10b:259: error: 'WGM20' was not declared in this scope
sketch_dec10b:260: error: 'TCCR2B' was not declared in this scope
sketch_dec10b:260: error: 'CS20' was not declared in this scope
sketch_dec10b.ino: In function 'void loop()':
sketch_dec10b:481: error: 'OCR2B' was not declared in this scope
sketch_dec10b.ino: In function 'void TIMER2_OVF_vect()':
sketch_dec10b:525: error: 'OCR2B' was not declared in this scope

author
AlexD6 made it! (author)AlexD62014-10-26

Did you ever find a solution? I'm trying to use a micro arduino and am having the same issue.

author
randelia made it! (author)randelia2014-11-16

Never found a solution - reworking timers & interrupts for a new architecture is over my head! However you should check out Mozzi - it runs on Leonardo so it should work on Micro. I haven't played with it much but if you're looking to make cool noises/music on an arduino you should check it out.

http://sensorium.github.io/Mozzi/

author
jservin1 made it! (author)2013-07-25

Hello,
I was wondering if the a5k pots are a necessity? I have a bunch of b5k pots laying around but am not certain that this would effect the sound of the unit. I don't believe it would because the pots are processing data and not audio signal. Please correct
me if im wrong.

author
audreyobscura made it! (author)audreyobscura2013-07-25

the A or B orientation just indicates which direction you have to turn them to add resistance..... either one should work :D

author
albertderaal made it! (author)albertderaal2014-09-14

the a and b indicates if its log or lin.

author
Dodgy DinghyG made it! (author)2014-08-07

Is there any way to edit the code to run on an arduino leonardo. When I try to upload it gives me errors and i think this is because the leonardo does not have a timer2, is there any way to edit the code so it doesn' use timer2

author
Mr Arduino made it! (author)2014-05-08

can you make this without LED'S?

author
Mr Arduino made it! (author)2014-05-08

How do you read the data?

author
jcarroll3 made it! (author)2013-11-11

Has anyone gotten the code to work for Leonardo / Micro?

author
darenager made it! (author)2013-10-27

Great job, thanks for tutorial.

author
builder321 made it! (author)2013-09-23

hey nice projekt you did there ! I just have problems running the code on the arduino it always shows me the info that some classes are not declared please help !

author
audreyobscura made it! (author)audreyobscura2013-09-24

which board are you using? can you screen cap your error message?

author
builder321 made it! (author)builder3212013-09-30

i use the arduino uno board but now it unfortunally runs the code but no signal is coming out of the audio jack box :/

author
Parosprint made it! (author)2013-09-24

Hi Audry,
Nice project.
I have a question. The sound that you creat can be stored some how on the computer or you just have the speaker as an output?

Thank you.

author
audreyobscura made it! (author)audreyobscura2013-09-24

if you use a male-male cord you can put it in the line-in of your computer and record.

author
Parosprint made it! (author)Parosprint2013-09-24

Hi Audrey,
thank you for your reply.
Im in the phase learn by doing in this type of project as i dont have a big background in electronics. Could you explain me in more details instead of what I should put a male to male cable or in plus I should hook it up in the arduino board? Thank you again.

Luca

author
bird123457 made it! (author)2013-05-10

They don't sell the arduino proto board in the uk, is there another alternative?

author
audreyobscura made it! (author)audreyobscura2013-07-25

you can build your own proto board with header pins

author
Javastar18 made it! (author)2013-06-12

Your directions are spot on, I have never before seen an instructables project so neat and professional. Great job, try to make it for an attiny or even better, a picaxe chip!

author
audreyobscura made it! (author)audreyobscura2013-07-25

thanks!

author
bird123457 made it! (author)2013-05-31

Hey! I love this project and I tweeted about it:
https://twitter.com/BIPTEC

author
Alastor136 made it! (author)2013-05-26

Followed instructions to the letter, doesn't work. IDK what went wrong.

author
audreyobscura made it! (author)audreyobscura2013-05-26

I would check your circuit - make sure no wires are crossed. I Have built this many times over now, and have used them in many ways. If you are still having trouble please PM me and we can try and work together to figure it out :)

author
audreyobscura made it! (author)audreyobscura2013-05-26

Or it could be your jack - check the wiring on your output jack. do you have access to an oscilloscope?

author
krlos16 made it! (author)2013-05-02

the code does not run on arduino leonardo, help me please, my email is carlosmbernal@outlook.com

author
audreyobscura made it! (author)audreyobscura2013-05-03

it does run on a leonardo - confirmed. i would check your board settings from the aruduino programming language.

author
jaybeesco made it! (author)2013-05-03

I having a hard time understanding what the pushbutton and switch do. Any help is appreciated!

author
krlos16 made it! (author)2013-04-29

hi my friend,, please might upload the code for arduino leonardo, thanks, regards from Bogota Colombia

author
audreyobscura made it! (author)audreyobscura2013-05-02

i believe the code is the same, but you will have to some how connect an additional pcb to contain your wires, before connecting them to the leonardo board.

i haven't used the leonardo arduinos yet, do you like them?

author
audreyobscura made it! (author)audreyobscura2013-05-02

i believe the code is the same, but you will have to some how connect an additional pcb to contain your wires, before connecting them to the leonardo board.

i haven't used the leonardo arduinos yet, do you like them?

author
faziefazie made it! (author)2013-04-13

Can I using this mono audio jack and this SPDT toggle switch which instead in your instructables?

mono_jacks.jpgimages.jpg
author
audreyobscura made it! (author)audreyobscura2013-05-02

yup.

author
krlos16 made it! (author)2013-04-29

hi my friend,, please upload the code for arduino leonardo, thanks, regards from Bogota Colombia

author
DJsoundestroyer made it! (author)2012-06-04

This is so sweet! all the ardunino instruments ive seen so far have just been digital Atari punk consoles. Do you think you could somehow set it up with Midi, or with a keyboard?

I cant wait to make one of these and run it through my bit crusher!

author
Jordan arduino made it! (author)Jordan arduino2012-07-26

agreed

author
boscopsoultrane made it! (author)2012-06-22

Very nice. Just completed it on a breadboard and works great. Had to hook it up to an amplifier to crank it up! I didn't have any 5k pots around so i used 10k instead. Thanks for a great ible and great project!

About This Instructable

182,549views

440favorites

License:

Bio: I'm an Instructables success story! After relying on the site to DIY my way through art school, I was able to join the Instructables ... More »
More by audreyobscura:Flock a Figurine With Spray AdhesiveCollage Postcards Using Glue SticksKintsugi Bowls With Tinted Epoxy
Add instructable to: