Updated Final Project Code (Processing)
We tested the project and received very positive feedback from users.
To run serial with Sonia at the same time, make sure that win32Comm.dll is in the same folder.
We are using colors to indicate progress
.
.
. . We need a stepped motion and a timer. We discussed using the Piezo for serial input for a meter.
Priorities:
Set up color program
Set up time delay
Set up audio and serial from strip
// CODE
// SONIA V2.5 -- Audio Live Stream.
//http://www.pitaru.com/sonia/
//Goal is to capture audio data and parse into if/then statements
//Note the Sonia code folder goes into the sketch folder
BImage b;
BImage c;
//int numOfPics = 150; //number of images in image array for video sequence
//BImage[] carlos = new BImage[numOfPics]; //new array of up to 224 photos
/*int numOfImages = 100; //number of images in image array for background images
BImage[] boxing = new BImage[numOfImages]; //new array of photos*/
int a = 0; // variable for counting through the display of photos
int picDislayTime = 1000; //time image is displayed in milliseconds
int movDisplayTime = 70; //time image is displayed in milliseconds
int whichImage = 0;
int startTime;
int startTimeMov;
boolean showing = false;
boolean slowDown = false;
void setup(){
Sonia.start(this); // Start Sonia engine.
LiveInput.start(256); // Start LiveInput and return 256 FFT frequency bands.
beginSerial();
size(640,480);
colorMode(RGB, 255, 255 ,255, 100);//need this comment later for tinting, etc
/*for(int j=0; j int m = j + 1;
carlos[j] = loadImage("boxing" + m + ".jpg");
}*/
b = loadImage("boxing1NL.jpg");
c = loadImage("bsuit.gif");
/*for(int i=0; i int n = i + 1;
carlos[i] = loadImage("carlos" + n + ".gif");
}*/
startTime = millis();
}
void loop(){
background(0,0,0);
//showImage(); //Show appropriate image based on input from microphone
if (showing) {
if (whichImage == 1) {
image(b, 0, 0);
} else if (whichImage == 2) {
image(c,0,0);
}
if (millis() - startTime > picDislayTime) {
showing = false;
}
}
/*showMeterLevel(); //Show simulated movie clip - acts like a meter based on volume from mic
if (slowDown) {
image (carlos[a], 0, 0, carlos[0].width, carlos[0].height - mouseY); //display each image in sequence
if (millis() - startTimeMov > movDisplayTime){
slowDown = false;
}
}*/
}
/*void showMeterLevel(){//Show simulated movie clip - acts like a meter based on volume from mic
float meterDataLeft = 1000 * LiveInput.getLevel(Sonia.LEFT);
float meterDataRight = 1000 * LiveInput.getLevel(Sonia.RIGHT);
if (!slowDown) {
image (carlos[a], 0, 0, carlos[0].width, carlos[0].height - mouseY); //display each image in sequence
a = a + 1;
if ( a >= numOfPics ) {
a = 0;
}
slowDown = true;
startTimeMov = millis();
}
}*/
// Safely close the sound engine upon Browser shutdown.
public void stop(){
Sonia.stop();
super.stop();
}
To run serial with Sonia at the same time, make sure that win32Comm.dll is in the same folder.
We are using colors to indicate progress
.
.
. . We need a stepped motion and a timer. We discussed using the Piezo for serial input for a meter.
Priorities:
Set up color program
Set up time delay
Set up audio and serial from strip
// CODE
// SONIA V2.5 -- Audio Live Stream.
//http://www.pitaru.com/sonia/
//Goal is to capture audio data and parse into if/then statements
//Note the Sonia code folder goes into the sketch folder
BImage b;
BImage c;
//int numOfPics = 150; //number of images in image array for video sequence
//BImage[] carlos = new BImage[numOfPics]; //new array of up to 224 photos
/*int numOfImages = 100; //number of images in image array for background images
BImage[] boxing = new BImage[numOfImages]; //new array of photos*/
int a = 0; // variable for counting through the display of photos
int picDislayTime = 1000; //time image is displayed in milliseconds
int movDisplayTime = 70; //time image is displayed in milliseconds
int whichImage = 0;
int startTime;
int startTimeMov;
boolean showing = false;
boolean slowDown = false;
void setup(){
Sonia.start(this); // Start Sonia engine.
LiveInput.start(256); // Start LiveInput and return 256 FFT frequency bands.
beginSerial();
size(640,480);
colorMode(RGB, 255, 255 ,255, 100);//need this comment later for tinting, etc
/*for(int j=0; j
carlos[j] = loadImage("boxing" + m + ".jpg");
}*/
b = loadImage("boxing1NL.jpg");
c = loadImage("bsuit.gif");
/*for(int i=0; i
carlos[i] = loadImage("carlos" + n + ".gif");
}*/
startTime = millis();
}
void loop(){
background(0,0,0);
//showImage(); //Show appropriate image based on input from microphone
if (showing) {
if (whichImage == 1) {
image(b, 0, 0);
} else if (whichImage == 2) {
image(c,0,0);
}
if (millis() - startTime > picDislayTime) {
showing = false;
}
}
/*showMeterLevel(); //Show simulated movie clip - acts like a meter based on volume from mic
if (slowDown) {
image (carlos[a], 0, 0, carlos[0].width, carlos[0].height - mouseY); //display each image in sequence
if (millis() - startTimeMov > movDisplayTime){
slowDown = false;
}
}*/
}
/*void showMeterLevel(){//Show simulated movie clip - acts like a meter based on volume from mic
float meterDataLeft = 1000 * LiveInput.getLevel(Sonia.LEFT);
float meterDataRight = 1000 * LiveInput.getLevel(Sonia.RIGHT);
if (!slowDown) {
image (carlos[a], 0, 0, carlos[0].width, carlos[0].height - mouseY); //display each image in sequence
a = a + 1;
if ( a >= numOfPics ) {
a = 0;
}
slowDown = true;
startTimeMov = millis();
}
}*/
// Safely close the sound engine upon Browser shutdown.
public void stop(){
Sonia.stop();
super.stop();
}


<< Home