The Arduino Synthesizer

by audreyobscura in Circuits > Microcontrollers

276880 Views, 633 Favorites, 0 Comments

The Arduino Synthesizer

_MG_2410_edit.jpg


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.




How It Works

how does it work.jpg
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.

Materials and Tools

parts_edit_03.jpg
IMG_0501.jpg
parts_edit_11.jpg
parts_edit_02.jpg
parts_edit_12.jpg
parts_edit_01.jpg

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

Parts:

(5X) 5K potentiometer
(5X) Potentiometer knobs
(3X) LEDs
(1X) SPDT switch
(1X) Light Dependent Photo Resistor
(1X) Arduino
(1X) Arduino Protoboard
(1X) Tactile Switch
(1X) Project enclosure
(1X) 1/8" Audio Jack
(1X) a whole lot of solid core wire
(1X) heat shrink
(1X) breadboard
(1X) jumper wire
(3X) 10K ohm resistors
(3X) 220 resistors
(1X) 9V battery
(1X) 9V battery clip
(1X) size M coaxial DC power plug

Tools:

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

Code, Circuit Diagram, and Power.

arduinocable.jpg
IMG_0552.jpg
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.

Using a Breadboard.

parts_edit_02.jpg
parts_edit_08.jpg
IMG_0521.jpg
IMG_0523.jpg
IMG_0524.jpg
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

Wire Your Audio Jack.

IMG_0533.jpg
IMG_0534.jpg
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.

Connect Your Photoresistor.

IMG_0532.jpg
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.

Connect a SPDT Switch.

IMG_0535.jpg
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.

Wire the Tactile Switch.

IMG_0544_edit.jpg
IMG_0537.jpg
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.

Connect the LEDs.

IMG_0547_edit.jpg

Test It!

IMG_0553.jpg
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.

Drill the Enclosure.

IMG_0699.jpg
IMG_0700.jpg
IMG_0701.jpg
IMG_0703.jpg
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.

Start Adding Components to the Enclosure.

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


Add the Rest of the Components.

_MG_1340.jpg
IMG_1332.jpg
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.

Wire the Audio Jack to the Protoboard.

_MG_1412.jpg
_MG_1414.jpg
_MG_1434.jpg
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.

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

_MG_1430_edit.jpg
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.

Solder Your LEDs Into Place

_MG_1437.jpg
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.

Wire the Potentiometers to the Protoboard.

_MG_1365.JPG
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

Attach Your Knobs to Your Potentiometers.

_MG_2424_edit.jpg
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.


Connect the Protoboard to the Arduino.

_MG_1454.jpg
_MG_1456.jpg
_MG_2408_edit.jpg
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!

Play With It!

_MG_2416.JPG
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