Beginner Percussion and Melody Synth

by womensaudiomission in Circuits > Audio

1421 Views, 19 Favorites, 0 Comments

Beginner Percussion and Melody Synth

IMG_6558.JPG
Beginner Percussion and Melody Synth 2

Make a cool mashup of a percussion and oscillator synth using arduino!

Set Up Arduino

Screen Shot 2014-07-29 at 4.44.20 PM.png

I used both analog pins as outputs, so set pins 5 and 9 as outputs in Arduino. I set up Serial.begin so that I could print any incoming values while troubleshooting.

Set Up Variables

IMG_6565.jpg

The only variable I used in this code was for the fader, which controlled the tone of the oscillator (by altering the mix of Arduino's voltage output with that of the oscillator) and the brightness of the lights. The fader was coming into analog input 1, so I created the variable "PotVal" to equal "analogRead(A1)". Because the oscillator and lights read a different scale than the fader outputs, I used the "map" function to create a "scaledPotVal" as well.

Set Initial Voltages

IMG_6566.jpg

In order for Arduino to output audio signal it needs to write a voltage. When the synth is turned on, the micro-sequencer should be silent and the oscillator should match the tone of the fader. So the initial voltage to pin 5 (micro-sequencer) should be 0 and the initial voltage of pin 9 (oscillator and lights) should be the "scaledPotVal".

Activate Button

IMG_6567.jpg

To make the button turn the micro-sequencer on and off, it has to act like a switch. I used the latch bit to create this effect. In an analog setting, the button reads 1023 when it is "on" (HIGH) and 0 when it is "off". I created an if/else that sent a voltage of 37 to pin 5 if analog input 1 read 1023 and sent 0 voltage to pin 5 if else.

Add Effects

IMG_6564.jpg

To make the melody aspect of the synth more customizable, I added filter and delay to the oscillator. The cut off of the filter seemed to have the biggest impact on the effect of the fader.

Lights

Beginner Percussion and Melody Synth 1

To make the effect of the fader more obvious, I used a splitter bit to connect lights to pin 9, the same pin as the oscillator. This means that the lights are also reading the "scaledPotVal", which affects the brightness rather than the tone of the lights.