Barebones Arduino Synth
Two potentiometers, one speaker, and an hour of spare time combined to form my first (real) Arduino circuit and the beginning of a beautiful friendship.
// based on "Arduino Sound Hello World"
// originally by David Fowler of uCHobby.com
// modifications and adaptations by
// Adam Bachman of adambachman.org
// Open the Arduino serial monitor at 9600 baud to see debug output
/*
circuit:
digital pin 9 -> pot 1 outer -> speaker A
speaker B -> ground
analog pin 0 -> pot 2 inner
5V in -> pot 2 outer 1
pot 2 outer 2 -> ground
*/
int soundPin = 9; // the I/O pin for our sound output
int sensorPin = 0; // input pin for the potentiometer
int sensorValue = 0; // control frequency
void setup(void){
//Set the sound out pin to output mode
Serial.begin(9800);
Serial.println("I'm alive!");
pinMode(soundPin,OUTPUT);
}
void loop(void){
sensorValue = analogRead(sensorPin);
//Set the pin high and delay for sensorValue uS
digitalWrite(soundPin,HIGH);
delayMicroseconds(sensorValue);
//Set the pin low and delay for sensorValue uS
digitalWrite(soundPin,LOW);
delayMicroseconds(sensorValue);
// spit out the sensor value (sanity check)
Serial.println(sensorValue);
}

The scene of the crime. I had to sit close enough to the computer to program the ‘duino and read the references. All soldering (wires to speaker) was done elsewhere.

The circuit (as described in the code) is one potentiometer between the speaker and the arduino to control volume, and one sending data directly to the analog input to control frequency. When I took the second potentiometer out, frequency was all over the place. Depending on where I touched the wires, I could pretty reliably get some interesting electronic pops and squeals. Almost more fun than twisting dials.
Nowhere to go but up.