I have a program I'm working on that uses the Beads library to sample songs and change the rate at which they're played (this is done using a potentiometer—I'm sending data in from an Arduino to control the rate).
In this program, the sound clip is established in the void setup() function.
However, I would like to be able to change the song sample dynamically, in void draw(), depending on what data the program is receiving. I have five different songs, and I want the Processing program to play a different song, depending on whether the values it's receiving are between 1-100, 101-200, 201-300, 301-400, or 401-500.
Here is my code so far:
float derp = 0;
// this is a more complex sampler
// clicking somewhere on the window initiates sample playback
// moving the mouse controls the playback rate
// we can run both SamplePlayers through the same Gain
port = new Serial(this, "/dev/tty.usbmodem411", 9600);
ac = new AudioContext(); // create our AudioContext
// whenever we load a file, we need to enclose the code in a Try/Catch block
// Try/Catch blocks will inform us if the file can't be found
// initialize the SamplePlayer
sp1 = new SamplePlayer(ac, new Sample(sketchPath("") + "prelude_no_8.mp3"));
// if there is an error, show an error message (at the bottom of the processing window)
println("Exception while attempting to load sample!");
e.printStackTrace(); // then print a technical description of the error
exit(); // and exit the program
// note that we want to play the sample multiple times
Hello, I'm trying to run this example sketch from http://www.tree-axis.com/Ess/ and for some reason, whenever I try to compile the code, I always get an error that reads: "The constructor Amplify(float) is undefined." How can I fix this? Thanks. :)
Hi, I have my arduino connected to two sensors that are controlling the graphics in a Processing program. However, the graphics are SUPER slow. I have no idea what could be causing this problem. Please help! My project is due in a couple of hours.
I'm trying to export my Processing sketch to an HTML page. However, when I try to open it in Chrome, I receive the following message: "This browser does not have a Java Plug-in. Get the latest Java Plug-in here." I run Mac OS X 10.6, so I went to Software Update and installed all the updates I needed. It STILL doesn't work. Please help??