User Tools

Site Tools


courses:2010.01.26.attitude.sound

Prototyping attitude and skills. Keeping it real: objectives and focus. Interactive sound.

Attitude and skills

text coming soon.

Objectives and focus

Think about the users. Whatever you build has to be useful for you and you project. Sort your priorities. Do you want to develop technical skills and know-how, or you want to create/test/prototype an experience for your users. Why do you prototype and build sketches?

Case Study: Interactive sound installation

I will walk you through 5 (or more) ways to build an interactive sound installation. The installation should play an audio clip when a person shows up in front of the device/installation. We will measure how much time it takes to reach the goal for each solution. We will also discuss the implications of each setup/solution.

  • Human sensor: human operator triggers the sound clip (computer or mp3 player)
  • Controlling the audio player (Quicktime, VLC, Others) with keystrokes from USB keyboard module.
  • Building an audio player in Processing, controls via keystrokes
  • Building an audio player in Processing, controls via Arduino
  • Embedded music player controlled via Arduino

Arduino code of the last example shown during the course (audio playing when approaching the installation)

const int analogPin = 5;    // Sharp distance sensor 
const int mp3Pin = 8;       // pin connected to daisy mp3 player, pause pin D04
 
// Variables will change:
int buttonPushCounter = 1;   // counter for the number of button presses
int sensorValue = 0;         // current state of the button
boolean buttonState = false;     // previous state of the button
boolean lastButtonState = false;     // previous state of the button
void setup() {
 
 
  // initialize the LED pin as an output:
  pinMode(mp3Pin, OUTPUT);
  // initialize serial communication:
  Serial.begin(9600);
 
  // stop sound
  digitalWrite(mp3Pin, LOW);
  delay (20);
  digitalWrite(mp3Pin, HIGH);
}
void loop() {
 
  // read the distance sensor
  sensorValue = analogRead(analogPin);
  //Serial.println(sensorValue);
 
  if(sensorValue > 300){ 
    buttonState = true; 
  }
  else{
    buttonState = false;
  }
 
  // compare the buttonState to its previous state
  if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == true) {
      // if the current state is HIGH then the button
      // went from off to on:
      buttonPushCounter++;
      Serial.println("turn ON");
    } 
    else {
      // if the current state is LOW then the button
      // wend from on to off:
      buttonPushCounter++;
      Serial.println("turn OFF"); 
    }
    // save the current state as the last state, 
    //for next time through the loop
 
  }
 
  lastButtonState = buttonState;
 
  // play audio every even button pushes by 
  // checking the modulo of the button push counter.
  // the modulo function gives you the remainder of 
  // the division of two numbers:
  // 
 
  if (buttonPushCounter % 2 == 0) {
    // toggle mp3Pin
    digitalWrite(mp3Pin, HIGH);
    delay(20);
    digitalWrite(mp3Pin, LOW);
  } 
  else {
    digitalWrite(mp3Pin, LOW);
  }
 
  delay(50);
}
courses/2010.01.26.attitude.sound.txt · Last modified: 2010/01/26 15:42 by camille