top of page
Blog: Blog2
sal5014

Confused by The Music?

This week Helen and I tried as best we could to understand the aspects of music theory and how it's played. At the moment we're struggling a little to make an instrument that can play not only notes but also triads and sustain notes as well. We'd like it to be as complete as possible. We're basing our concept on a Theremin but ideally we'd like it to have some automatized aspects so people that don't really know much about music can play melodies that have a full sound and not just a couple of notes.


OUR PROJECT


The way we're thinking about it working is having one ultrasonic sensor for note changing and another for amplitude. We'd like to find a way to sustain a particular note (perhaps while a button is held down) and another way to do scale changes (perhaps with a potentiometer) for the final deliverable.


So far we've tried using MIDI with a piano (first video) and a violin (second video). We're able to play the note by clicking the joystick and elongate it by moving it around but we haven't been able to switch around notes or play several at the same time.




OUR BOM


OUR CIRCUIT


OUR CODE

#include <MIDIUSB.h>

#include <pitchToNote.h>


int baseNote = 45;    


int trigPin1=2;

int echoPin1=1;


int trigPin2=4;

int echoPin2=3;


void setup() {

  // put your setup code here, to run once:

Serial.begin (9600);

  pinMode(trigPin1, OUTPUT);

  pinMode(echoPin1, INPUT);

   pinMode(trigPin2, OUTPUT);

  pinMode(echoPin2, INPUT);

}


void loop() {

  // put your main code here, to run repeatedly:


  long duration1, distance1;

  digitalWrite(trigPin1, LOW);  // Added this line

  delayMicroseconds(2); // Added this line

  digitalWrite(trigPin1, HIGH);

  delayMicroseconds(10); // Added this line

  digitalWrite(trigPin1, LOW);

  duration1 = pulseIn(echoPin1, HIGH);

  distance1 = (duration1/2) / 29.1;


 if (distance != 0) {


    int pitchBendSensor = distance << 5;          // shift so top bit is bit 14


    byte msb = highByte(pitchBendSensor);        // get the high bits


    byte lsb = lowByte(pitchBendSensor) >> 1;    // get the low 8 bits


    midiCommand(0xE0, lsb, msb);                 // send the pitch bend message


  }


  Serial.print ( "Sensor1  ");

  Serial.print ( distance1);

  Serial.println("cm");

}

delay(2000);


OUR QUESTIONS

- What we're doing with the ultrasonic sensors, could we do the same with only one gesture sensor?

- If we use a gesture sensor (the one suggested on the notes documents), how do we get it on the breadboard without a soldering wand?

- Do we need another control to switch the musical scales? What would be the best method for this?

- How do we store a note and sustain it, then delete it? (in order to transition smoothly from one note to another)

- Can we play several channels using one control? (we'd like to play triads using one control).

14 views0 comments

Recent Posts

See All

Comments


bottom of page