Can Minim play more than one song at the same time?

edited November 2016 in Library Questions

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!!

Tagged:

Answers

  • The problem is that i'm not sure if minim can support playing 2 .mp3's at once.

    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); } } } //

        if (values[1].equals("Yee Mun")) {
          if ((values[2].equals("Nothing"))&&(values[3].equals("Nothing"))) {
            println("YM");
            keyword.equals("ym");
          } else {
            if ((values[2].equals("Chris"))&&(values[3].equals("Nothing"))) {
              println("YM C");
              keyword.equals("chrisym");
            } else {
              if ((values[2].equals("Music"))&&(values[3].equals("Nothing"))) {
                println("YM Music");
                keyword.equals("musicym");
              } else {
                if ((values[2].equals("Food"))&&(values[3].equals("Nothing"))) {
                  println("YM Food");
                  keyword.equals("foodym");
                }
              }
            }
          }} else {
            if (values[1].equals("Chris")) {
              if ((values[2].equals("Nothing"))&&(values[3].equals("Nothing"))) {
            println("C");
            keyword.equals("chris");
          } else {
            if ((values[2].equals("YM"))&&(values[3].equals("Nothing"))) {
              println("C YM");
              keyword.equals("chrisym");
            } else {
              if ((values[2].equals("Music"))&&(values[3].equals("Nothing"))) {
                println("C Music");
                keyword.equals("chrismusic");
              } else {
                if ((values[2].equals("Food"))&&(values[3].equals("Nothing"))) {
                  println("C Food");
                  keyword.equals("chrisfood");
                }
              }
            }
          }} else {
            if (values[1].equals("Music")) {
            if ((values[2].equals("Nothing"))&&(values[3].equals("Nothing"))) {
            println("Music");
            keyword.equals("music");
          } else {
            if ((values[2].equals("Yee Mun"))&&(values[3].equals("Nothing"))) {
              println("Music YM");
              keyword.equals("musicym");
            } else {
              if ((values[2].equals("Chris"))&&(values[3].equals("Nothing"))) {
                println("Music C");
                keyword.equals("chrismusic");
              } else {
                if ((values[2].equals("Food"))&&(values[3].equals("Nothing"))) {
                  println("Music Food");
                  keyword.equals("foodmusic");
                }
              }
            }
          }} else {
            if (values[1].equals("Food")) {
            if ((values[2].equals("Nothing"))&&(values[3].equals("Nothing"))) {
            println("Food");
            keyword.equals("food");
          } else {
            if ((values[2].equals("Yee Mun"))&&(values[3].equals("Nothing"))) {
              println("Food YM");
              keyword.equals("foodym");
            } else {
              if ((values[2].equals("Chris"))&&(values[3].equals("Nothing"))) {
                println("Food C");
                keyword.equals("chrisfood");
              } else {
                if ((values[2].equals("Music"))&&(values[3].equals("Nothing"))) {
                  println("Food Music");
                  keyword.equals("foodmusic");
                }
              }
            }
          }}}
    
              //delay(100);
            }
          }
    

    }}} }

        //void playSoundFile(String keyword) {
        //  //here you put in the sound files
        //  if (keyword.equals(oldKeyword) == false) {
        //    track = keyword + ".aiff";
        //    file = new SoundFile(this, track);
        //    delay(100);
        //    file.play();
        //    file.rate(0.5);
        //    oldKeyword = keyword;
        //  }
        //}
    

    //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.

Sign In or Register to comment.