We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi everyone!
I was wondering if you guys know if minim could play more than one song at a time? I am trying to use an fsr sensor to detect when someone is pressing on a certain area of a mouse pad (which is already working in arduino) which then communicates with processing and plays the song according to the fsr sensor.
The problem is that i'm not sure if minim can support playing 2 .mp3's at once.
Thanks in advance!!
Answers
have you tried it?
im getting signals from buttons from the arduino. to play different playlists. and the different playlists are ymPlayer ChrisymPlayer musicymPlayer
import processing.serial.*; //import processing.sound.*; import ddf.minim.*; import ddf.minim.analysis.*;
AudioPlayer[] ymPlayer = new AudioPlayer[4]; AudioPlayer[] chrisymPlayer = new AudioPlayer[4]; AudioPlayer[] musicymPlayer = new AudioPlayer[2];
//SoundFile file; Serial myPort; // The serial port String value; // Data received from the serial port //String track; //String oldKeyword = "";
Minim minim; FFT fft; float val; int val2; int bufferSize = 8; int fftSize = floor(bufferSize*.9)+1; int count=0; String keyword;
void setup () { // set the window size: size(400, 300);
// List all the available serial ports // if using Processing 2.1 or later, use Serial.printArray() println(Serial.list());
// I know that the first port in the serial list on my mac // is always my Arduino, so I open Serial.list()[0]. // Open whatever port is the one you're using. myPort = new Serial(this, "/dev/tty.usbmodem1411", 9600);
// don't generate a serialEvent() unless you get a newline character: myPort.bufferUntil('\n');
// set inital background: background(0); }
void draw() { if ( myPort.available() > 0) { // If data is available, value = myPort.readStringUntil('\n'); // read it and store it in val //println(val); //print it out in the console if (value != null) { String[] values = split(trim(value), ','); if (values.length == 4) { println(values[1]+"#"+values[2]+"#"+values[3]+"#"); keyword = value; //
minim = new Minim(this); if (keyword.equals("ym")){ ymPlayer[0] = minim.loadFile("beep_short_off.mp3"); ymPlayer[1] = minim.loadFile("Y7.mp3"); ymPlayer[2] = minim.loadFile("beep_short_off.mp3"); ymPlayer[3] = minim.loadFile("Y30.mp3"); ymPlayer[count].play(); fft=new FFT(ymPlayer[count].bufferSize(), ymPlayer[count].sampleRate());
if(!ymPlayer[count].isPlaying()) { count++; if(count>3)count=0; ymPlayer[count].play();
} fft.forward(ymPlayer[count].mix); }
else { if (keyword.equals("chrisym")){ chrisymPlayer[0] = minim.loadFile ("beep_short_off.mp3"); chrisymPlayer[1] = minim.loadFile ("CY1.mp3"); chrisymPlayer[2] = minim.loadFile ("beep_short_off.mp3"); chrisymPlayer[3] = minim.loadFile ("CY15a.mp3"); chrisymPlayer[count].play(); fft=new FFT(chrisymPlayer[count].bufferSize(), chrisymPlayer[count].sampleRate());
if(!chrisymPlayer[count].isPlaying()) { count++; if(count>3)count=0; chrisymPlayer[count].play();
} fft.forward(chrisymPlayer[count].mix); }
else { if (keyword.equals("musicym")){ musicymPlayer[0] = minim.loadFile ("beep_short_off.mp3"); musicymPlayer[1] = minim.loadFile ("MY15a.mp3"); musicymPlayer[count].play(); fft=new FFT(musicymPlayer[count].bufferSize(), musicymPlayer[count].sampleRate());
if(!musicymPlayer[count].isPlaying()) { count++; if(count>1)count=0; musicymPlayer[count].play();
} fft.forward(musicymPlayer[count].mix); } } } //
}}} }
//create a function for track
edit post, highlight code, press ctrl-o.
better still, create your own question rather than resurrecting something from 4 months ago.
ok
posted here https://forum.processing.org/two/discussion/21452/using-minim-to-create-3-playlists-to-play-based-on-input-from-arduino#latest