Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : Minim and Real Memory / Memory

$
0
0
I see you are on a PC, I'm on a Mac (10.8.4). Could that be the problem. Since I did the same sketch and it stops playing after No. 32, even though it list the other mp3s and says "true" to them playing? Now on processing 2.0.1 and with Memory set to 2048 / 64bit.

  1. import processing.serial.*;
  2. import ddf.minim.*;

  3. Minim minim;
  4. AudioPlayer voiceSampleSingle;
  5. AudioPlayer[] voiceSample;

  6. String[] filenames;
  7. int noOfSamples = 0;
  8. int count;

  9. void setup(){
  10.   
  11.   size(200,200);
  12.   
  13.   minim = new Minim(this);
  14.   java.io.File folder = new java.io.File(dataPath("singles"));
  15.   println(folder);
  16.   filenames = folder.list();
  17.   
  18.   // get number of songs for array
  19.   voiceSample = new AudioPlayer[filenames.length];
  20.   noOfSamples = filenames.length - 1;

  21.   // load each file into the array
  22.   println(filenames.length);
  23.   for (int i = 1; i < filenames.length; i++) {

  24.     voiceSampleSingle = minim.loadFile( folder + "/" + filenames[i], 512);
  25.     voiceSample[i-1] = voiceSampleSingle;
  26.     println(filenames[i]);
  27.     
  28.   }
  29.   
  30.   voiceSample[33].rewind();
  31.   voiceSample[33].play();
  32.   
  33.   
  34. }

  35. void draw(){
  36.   background(0);
  37. }

  38. void keyPressed() {
  39.   println("prrssed");
  40.   if (key == 'a') {
  41.     for (int i=0; i<voiceSample.length-1; i++) {
  42.       println(voiceSample[i].isPlaying());
  43.       if (voiceSample[i].isPlaying()) {
  44.         voiceSample[i].pause();
  45.       }
  46.     }
  47.     count = ++count%voiceSample.length;
  48.     voiceSample[count].play();
  49.     println("Number " + count + " (" + filenames[count] + ") is currently playing.");
  50.   }
  51. }

Viewing all articles
Browse latest Browse all 1768

Trending Articles