User Tools

Site Tools


courses:2010.01.26.attitude.sound

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
courses:2010.01.26.attitude.sound [2010/01/26 15:42]
camille
courses:2010.01.26.attitude.sound [2010/01/26 15:42] (current)
camille
Line 1: Line 1:
 +====== 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
 +
 +
 +==== Links and resources ====
 +  * [[http://​cycling74.com/​|MaxMSP]],​ [[http://​puredata.info/​|PD]] (Pure Data), [[http://​vvvv.org/​tiki-index.php|VVVV]],​ [[http://​en.wikipedia.org/​wiki/​Quartz_Composer|Quartz Composer]]
 +  * Audio connectors, color codes and sockets [[http://​en.wikipedia.org/​wiki/​Audio_and_video_interfaces_and_connectors|wikipedia]]
 +  * Wireless audio transmitter
 +  * [[http://​www.ultimarc.com/​ipacve.html|I-Pac Keyboard Emulator]]
 +  * [[http://​teuthis.com/​daisy/​index.html|Daisy MP3 player]], [[http://​www.vinculum.com/​prd_vmusic1.html|VMUSIC2 modules]], cheaper, coming soon.
 +  * Using a Sharp IR Sensor for Distance Calculation [[http://​www.tigoe.net/​pcomp/​code/​category/​arduinowiring/​44|GP2D120 model]] [[http://​luckylarry.co.uk/​2009/​11/​arduino-using-a-sharp-ir-sensor-for-distance-calculation/​|GP2Y0A02 model]]
 +
 +Arduino code of the last example shown during the course (audio playing when approaching the installation)
 +
 +<code c>
 +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);
 +}
 +</​code>​
courses/2010.01.26.attitude.sound.txt · Last modified: 2010/01/26 15:42 by camille