Music Instrument
Materials Used:
Arduino Uno
3 Force sensors
1 Photocell
3 Piezo speakers
Resistors
Team Members:
Divya Karthikeyan
Shubham Goel
Peter Tu Nguyen
Meena Vempaty
Justin sampson
Divya Anand
Description
The aim of this assignment was to create a collaborative musical instrument.
Our first idea was to create a collaborative instrument that had rubber-bands around a center scaffolding so people could pull at the bands to create music. While setting it up, we used force sensors and piezos to create the notes. However, we realized that the rubber bands did not exert enough pressure to actually create any output so we reworked the instrument.
We thus decided to use a combination of the input and output devices we’ve used so far to create a squeeze-mechanism that triggers a scale of notes. This squeezebourine is still collaborative, as it allows for a thumb wrestling game between two people, while the third person can use the photo-cell to create beats.
Inputs:
3 Force sensors
1 Photocell
Output:
Tone from 3 Piezo speakers (modified by the Tone.h library)
We built a triangular instrument that can be played by pressing against the force sensors on each side. Two force sensors control the tone of the music played back. One force sensor controls the tempo of playback. The photocell acts as a beatbox. The on and off produces a buzz from one piezo speaker that sounds like a drum beat.
A video of the working is available at https://drive.google.com/file/d/0B3eGwnwfPagccFhUb1VSdmdpbW8/edit?usp=sharing
Code:
#include <Tone.h>
int in1 = A0;
int in2 = A1;
int in3 = A2;
int in4 = A3;
int val1 = 0;
int val2 = 0;
int val3 = 0;
int val4 = 0;
int maxIn = 50;
int interval = 0;
Tone out1;
Tone out2;
Tone out3;
int scale[] = {NOTE_D4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_C4};
void setup() {
Serial.begin(9600);
out1.begin(7);
out2.begin(8);
out3.begin(12);
interval = maxIn/5;
}
void loop() {
val1 = analogRead(in1);
val2 = analogRead(in2);
val3 = analogRead(in3);
val4 = analogRead(in4);
Serial.println(val4);
Serial.println(val3);
if(val1 > 10) {
out1.play(scale[val1/interval], val3*20);
} else {
out1.stop();
}
if(val2 > 10) {
out2.play(scale[val2/interval], val3*20);
} else {
out2.stop();
}
if(val4 < 650) {
out3.play(NOTE_D1, 300);
}
}
- Login to post comments