Humanophone


 

 

 

 

Concept:

Most musical instruments only require one operator to create the music in the performance.  The audio gauntlet is a cooperative musical instrument.  By dividing control of the sound produced between the “player” and the “instrument” the audio gauntlet forces the two performers to coordinate their actions.  The player controls the pitch and rythm, the instrument controls the duration and volume.

Technical:

The audio gauntlet uses an infrared proximity sensor, a 3-axis accelerometer, and one amplified speaker all controlled by an arduino microcontroller.  Power is provided by onboard battery packs for logic and amplification.

Components:

Arduino Mega
Sharp IR Proximity sensor
Sparkfun accelerometer breakout
LM 386 op amp
Toggle switch
Potentiometer for baseline volume control
8 ohm 1/2 watt speaker
6 volt battery pack
9 volt battery pack
Protoboard
Hot Topic gauntlet

Source Code:

//AVERAGING FOR X AXIS

const int numReadings2 = 10;
int readings2[numReadings2];      // the readings from the analog input
int index2 = 0;                  // the index of the current reading
int total2 = 0;                  // the running total
int average2 = 0;                // the average

//AVERGAGEING FOR Y AXIS
const int numReadings = 10;
int readings[numReadings];      // the readings from the analog input
int index = 0;                  // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average
int speakerOut = 3;                             // Speaker pin
int duration;                                  //related ti x axis
int volume;                                    //related to y axis
unsigned long x;                               //input from x axis
unsigned long y;                               //input from y axis
unsigned long distance = 0;                     // variable for storing the distance, used as pitch
int IRpin = 1;                                    // analog pin for reading the IR sensor

void setup() {

Serial.begin(9600);                             // start the serial port
pinMode(speakerOut, OUTPUT);                  // sets pin 6 as output
for (int thisReading = 0; thisReading < numReadings; thisReading++)
readings[thisReading] = 0;
for (int thisReading2 = 0; thisReading2 < numReadings2; thisReading2++)
readings2[thisReading2] = 0;
}

//FUNCTION TO PLAY TONE, USES X AXIS TO CONTROL DURATION, Y AXIS TO CONTROL VOLUME

void playTone(int distance, int duration) {
for (long i = 0; i < duration * 1000L; i += distance*2) {
analogWrite(speakerOut, average);
delayMicroseconds(distance/2);
analogWrite(speakerOut, LOW);
delayMicroseconds(distance/2);
}
}

void loop() {

x = analogRead(4);
y = analogRead(5);
volume =map(y,300,415,1,255);
duration =map(x,270,370,40,450);
volume = constrain(volume,1,255);
// subtract the last reading:
total= total – readings[index];
// read from the sensor:
readings[index] = volume;
// add the reading to the total:
total= total + readings[index];
// advance to the next position in the array:
index = index + 1;
// if we’re at the end of the array…
if (index >= numReadings)
// …wrap around to the beginning:
index = 0;
// calculate the average:
average = total / numReadings;
// send it to the computer (as ASCII digits)
// subtract the last reading:
total2= total2 – readings2[index2];
// read from the sensor:
readings2[index2] = duration;
// add the reading to the total:
total2= total2 + readings2[index2];
// advance to the next position in the array:
index2 = index2 + 1;
// if we’re at the end of the array…
if (index2 >= numReadings2)
// …wrap around to the beginning:
index2 = 0;
// calculate the average:
average2 = total2 / numReadings2;
// send it to the computer (as ASCII digits)
float volts = analogRead(IRpin)*0.0048828125;   // value from sensor * (5/1024) – if running 3.3.volts then change 5 to 3.3
float distance = 65*pow(volts, -2);   //creates a large range of frequencies  in our small
Serial.println(distance);                       // print the distance
if (distance < 100) {
playTone(distance,average2);
}
}

Reference Links:
http://luckylarry.co.uk/arduino-projects/arduino-using-a-sharp-ir-sensor-for-distance-calculation/
http://luckylarry.co.uk/arduino-projects/arduino-a-basic-theremin/
http://www.arduino.cc/en/Tutorial/PlayMelody
http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html

Making of Images: