Skull_Dragon
YaBB Newbies
Offline
Posts: 3
Merging Images with Sound
Dec 1st , 2008, 5:24pm
Hi, I'm doing a project for school and I need some help with it. For my project I'm using a sensor and what I'm trying to do is make a sound file play along with a certain image. Ex. Classic.jpg with Grease.wav. So far I'm unable to have the image with the sound file to work together. Here's what I have so far. Please help me out. Thanks p.s. I'm working with Processing 0135 import processing.serial.*; // The serial port: Serial myPort; import krister.Ess.*; AudioChannel myChannel; void setup() { println(Serial.list()); myPort = new Serial(this, Serial.list()[0], 57600); size(500,395); PImage a; // Declare variable "a" of type PImage a = loadImage("Classic.jpg"); // Load the images into the program image(a, 0, 0); // Displays the image from point (0,0) PImage b; // Declare variable "a" of type PImage b = loadImage("Classic1.jpg"); // Load the images into the program image(b, 0, 0); // Displays the image from point (0,0) PImage c; // Declare variable "a" of type PImage c = loadImage("Classic2.jpg"); // Load the images into the program image(c, 0, 0); // Displays the image from point (0,0) PImage d; // Declare variable "a" of type PImage d = loadImage("Classic3.jpg"); // Load the images into the program image(d, 0, 0); // Displays the image from point (0,0) PImage e; // Declare variable "a" of type PImage e = loadImage("Classic4.png"); // Load the images into the program image(e, 0, 0); // Displays the image from point (0,0) PImage f; // Declare variable "a" of type PImage f = loadImage("Classic5.jpg"); // Load the images into the program image(f, 0, 0); // Displays the image from point (0,0) } { // start up Ess Ess.start(this); myChannel=new AudioChannel("Grease.wav"); myChannel=new AudioChannel("Grease1.wav"); myChannel=new AudioChannel("Grease2.wav"); myChannel=new AudioChannel("Grease3.wav"); myChannel=new AudioChannel("Grease4.wav"); myChannel=new AudioChannel("Grease5.wav"); } void draw() { while (myPort.available() > 0) { int inByte = myPort.read(); println(inByte); } // we are done, clean up Ess //void mousePressed() { if (myChannel.state==Ess.PLAYING) { myChannel.stop(); } else { myChannel.play(Ess.FOREVER); } } public void stop() { Ess.stop(); super.stop(); } //int getsongnumber(void){ //int answer =0; //values range from about 70 to about 500 //return answer; //} /* use it like this songnumbertoplay = getsongnumber(); */