Thursday 15 November 2012

Final Project


For our final assignment, Philip and I decided to create an audio interface device for creating and altering minimalist experimental music via real time physical interaction. The device consists of a 4×4 button pad, which is used for creating the base rhythm and then using two IR range finders, the users hands become the control input for the speed and frequency manipulation of the melody.
The audio is generated using a Max/MSP patch that receives SERIAL data from two Arduino boards, one used for handling the button pad, and the second for the dual IR analog values.

Video:

http://vimeo.com/55330421#at=0
Progress Photos & Circuit Diagrams:
Arduino Code:
//Sensor 1
int sensorValue;     // variable to store the value of the sensor
byte serialDataValue;  // variable to convert the value of the sensor in byte format
//Sensor 2
int sensor2Value;     // variable to store the value of the sensor
byte serialData2Value;  // variable to convert the value of the sensor in byte format

void setup() 
{ 
  Serial.begin(9600); 
} 

void loop() 
{ 

  //IR sensor 1
  sensorValue = analogRead(A0);
  Serial.print("A ");
  Serial.println(sensorValue);
  delay(30);    //  let max breathe a little

  //IR sensor 2
  sensor2Value = analogRead(A1);
  Serial.print("B ");
  Serial.println(sensor2Value);
  delay(30);    //  let max breathe a little

}
Arduino Code:
//pin connections
#define ledLatchPin A1
#define ledClockPin A0
#define ledDataPin A2
#define buttonLatchPin 9
#define buttonClockPin 10
#define buttonDataPin A3

//looping variables
byte i;
byte j;
byte k;
byte ledByte;

//storage for led states, 4 bytes
byte ledData[] = {
  0, 0, 0, 0};
//storage for buttons, 4 bytes
byte buttonCurrent[] = {
  0,0,0,0};
byte buttonLast[] = {
  0,0,0,0};
byte buttonEvent[] = {
  0,0,0,0};
byte buttonState[] = {
  0,0,0,0};
//button debounce counter- 16 bytes
byte buttonDebounceCounter[4][4];

void setup() {
  DDRC = 0xF7;//set A0-2 and A4-5 output, A3 input
  DDRB = 0xFF;//digital pins 8-13 output

  Serial.begin(57600);

  cli();//stop interrupts

  //set timer2 interrupt every 128us
  TCCR2A = 0;// set entire TCCR2A register to 0
  TCCR2B = 0;// same for TCCR2B
  TCNT2  = 0;//initialize counter value to 0
  // set compare match register for 7.8khz increments
  OCR2A = 255;// = (16*10^6) / (7812.5*8) - 1 (must be  0 && --buttonDebounceCounter[row][index] == 0) {  // if the the debounce counter has
      // been decremented to 0 (meaning the
      // the button has been up for 
      // kButtonUpDefaultDebounceCount 
      // iterations///

      buttonEvent[row] = 1 << index;    // queue up a button state change event

      if (buttonCurrent[row] & (1 << index)){          // and toggle the buttons debounce state.
        buttonState[row] |= (1 << index);
      }
      else{
        buttonState[row] &= ~(1 << index);
      }
    }
  }
}

void shift(){

  for (i=0;i> 3;
    //latchpin low
    digitalWrite(buttonLatchPin, LOW);

    //Serial.println(buttonCurrent[i]);

    for (k=0;k> 1) & 3;
      byte ledx = (ledByte >> 3) & 3;
      if (ledstate){
        ledData[ledy] |= 8 >> ledx;
      }
      else{
        ledData[ledy] &= ~ (8 >> ledx);
      }
    }//end if serial available
  }//end do
  while (Serial.available() > 8);
}    

void loop() {
  shift();//updates leds and receives data from buttons
}

Week 2:

Storyboard:

We decided to keep the same idea of the sequencing interface which will loop sounds that we created, but there will be another component that you will also interface with. There will be two distance sensors pointing upwards that will let you control certain aspects of the sound playing. All the while giving the user a simple DJ type interface that anyone can use and still make decent music. 

Materials:

As for materials will use a simple design of plexiglass top which will be lifted up by 4 wood rods at each corner with a wood bottom with all the electronics will be mounted down.

New Concept:


Week 1:

Concept Drawing:

What it's about

For the final project Philip and I will build a musical sequencing interface that allows
a user to create a looping melody using a visual layout of 4x4 physical pads that can
be individually enabled/disabled and correspond to individual instruments or key
pitch.

To achieve the necessary functionality we will use Arduino to not only interface
with the physical controller, but to also communicate with Max/MSP which will
be responsible for processing, generating and outputting all audio signals via the
computers built-in sound card.

By creating a physical interface for a “software” audio sequencer with dedicated
buttons corresponding to specific instruments and sounds, we allow the user to
simply enjoy the process of audio composition without the distraction of a screen/
mouse/keyboard and allow them to directly manipulate the media itself.

In the future the functional possibilities of this physical interface can be greatly
expanded by using a 3rd party Arduino library to allow the device to interface as
a fully programmable MIDI controller with many commercial audio production

software.