Loading...
Logo
Processing Forum
Hi. I am working on a sketch that assigns different keys to different wav files. The wav files are all short (less than 30 seconds). So far, I can get one key to play a wav file but when I tried two different keys, only one file plays and the other does not. (only the same file- order does not matter). 
I have been working on this for an embarrassing amount of time and cannot figure it out...
The console reads: JavaSound Minim Error
                             Error loading file into memory: 15

Other than that, the console says nothing else. If it is simply a question of memory and two very short wav files are an issue, should I increase the memory in processing settings, and how much is reasonable? 
Here is the code:
Copy code
  1. import ddf.minim.*;
  2. Minim minim;
  3. AudioPlayer player;
  4. AudioSample chicken;
  5. AudioSample tyler;

  6. void setup()
  7. {
  8. size(512, 200, P3D);
  9. minim = new Minim(this);
  10. chicken = minim.loadSample("chicken.wav");
  11. if ( chicken == null ) println("Didn't get chicken!");
  12. tyler = minim.loadSample("tyler.wav");
  13. if ( tyler == null ) println("Didn't get tyler!");
  14. }
  15. void draw()
  16. {
  17. }
  18.  void keyPressed()
  19. if ( key == 'c' ) chicken.trigger();
  20. else if ( key == 't' ) tyler.trigger();
  21. }
  22. void stop()
  23. {
  24. chicken.close();
  25. tyler.close();
  26.   player.close();
  27. minim.stop();
  28. super.stop();
  29. }

Thank you... as I can use some help...



Replies(1)

Your code worked for me just as it is. I just replaced the file names. I used to musics, and both played fine, even at the same time... The console printed an error that i think is related to being mp3 files. I think for a 32 bit machine 2000 is the limit for memory settings, and in a 64 bit that would be more. I'm using 1.5 yet. As a note there is no need for the else inside keyPressed().

errors that not avoided the musics to play nicely:

==== JavaSound Minim Error ====
==== Don't know the ID3 code PIC

==== JavaSound Minim Error ====
==== Error parsing ID3v2: -14789

==== JavaSound Minim Error ====
==== Don't know the ID3 code PCNT

=== Minim Error ===
=== Likely buffer underrun in AudioOutput.