Sound object: working prototype

Scattered Colletions


For this project, I am making a series of interactive objects. Each object has a single track from the same composition soundfile connected to it. By default, when no sensors are activated, all tracks will be playing simultanously, inviting the viewer in through the auditive composition. Using photoresistors to detect the presence of a visitor, the soundtrack connected to the object approached will be the only one playing. If several visitors are in the room at the same time, approaching object 1, and object 2, both track 1 and track 2 from the composition will be playing. If the room is full of people, the whole composition will most likely be playing, since all sensor probably will be detecting peoples shadows. 

I got a little help and got the sound working with the analog read of a photoresistor in Processing. You can find the sketch used in the video at the bottom of the page.


Designing the interactive experience in exhibition space 
Sketchbook notes and of course sketch

Circuit. Just gotta make some more.


 


Processing Sketch for Arduino

/*
arduino_input

Demonstrates the reading of digital and analog pins of an Arduino board
running the StandardFirmata firmware.

To use:
* Using the Arduino software, upload the StandardFirmata example (located
  in Examples > Firmata > StandardFirmata) to your Arduino board.
* Run this sketch and look at the list of serial ports printed in the
  message area below. Note the index of the port corresponding to your
  Arduino board (the numbering starts at 0).  (Unless your Arduino board
  happens to be at index 0 in the list, the sketch probably won't work.
  Stop it and proceed with the instructions.)
* Modify the "arduino = new Arduino(...)" line below, changing the number
  in Arduino.list()[0] to the number corresponding to the serial port of
  your Arduino board.  Alternatively, you can replace Arduino.list()[0]
  with the name of the serial port, in double quotes, e.g. "COM5" on Windows
  or "/dev/tty.usbmodem621" on Mac.
* Run this sketch. The squares show the values of the digital inputs (HIGH
  pins are filled, LOW pins are not). The circles show the values of the
  analog inputs (the bigger the circle, the higher the reading on the
  corresponding analog input pin). The pins are laid out as if the Arduino
  were held with the logo upright (i.e. pin 13 is at the upper left). Note
  that the readings from unconnected pins will fluctuate randomly.
 
For more information, see: http://playground.arduino.cc/Interfacing/Processing
*/

import processing.serial.*;

import cc.arduino.*;

Arduino arduino;


//like in an arduino sketch it's good to
//use variables for pin numbers
int sensorPin = 0;

//this is the minimum value from the sensor that will trigger the sound
int threshold = 360;

color off = color(4, 79, 111);
color on = color(84, 145, 158);

int debounce;

float vol;

import processing.sound.*;
SoundFile file;

void setup() {
 
 
  size(470, 280);
  background(255);
 // Modify this line, by changing the "0" to the index of the serial
  // port corresponding to your Arduino board (as it appears in the list
  // printed by the line above).
  arduino = new Arduino(this, Arduino.list()[1], 57600);

//save all tracks from composition in data folder
//and upload to each circuit for each sound object
// Load a soundfile from the /data folder of the sketch and play it back
file = new SoundFile(this, "TranscendentalVerandashort.mp3");

  // Alternatively, use the name of the serial port corresponding to your
  // Arduino (in double-quotes), as in the following line.
  //arduino = new Arduino(this, "/dev/tty.usbmodem621", 57600);
 
  // Set the Arduino digital pins as inputs.

  //  arduino.pinMode(i, Arduino.INPUT);

   file.play();
  }

void draw() {


 
  // Draw a filled box for each digital pin that's HIGH (5 volts).


   
    int reading = arduino.analogRead(0);
   
    //780 and 1018
   
    float bg = map(reading,20,170,0,255);
     background(bg);
   
   
     //edit speed of fade in/out by changing the x (vol += (0 - vol) * x;)
     if(reading < 100){
     vol += (1 - vol) * .05;
     }else{
     debounce = 0;
      vol += (0 - vol) * .05;
     }
   
     if(debounce == 1){
   
     
     }else{
     
     }
   
     file.amp(vol);
   
   
       println(reading );

}



Populære innlegg