As alternative I am testing right now, to not use an array but only one sample which is always closed again after using. This seems to take up significantly less memory and works fine.
- Minim minim;
- AudioPlayer voiceSampleSingleA;
- void setup(){
- }
- void serialEvent(){
- ...
- voiceSampleSingleA = minim.loadFile( folder + "/" + filenames[chosenItem], 512);
- voiceSampleSingleA.rewind();
- voiceSampleSingleA.play();
- sampleClosing = false;
- }
- void draw(){
- if(sampleClosing == false && voiceSampleSingleA.isPlaying() == false){
- voiceSampleSingleA.pause();
- voiceSampleSingleA.close();
- sampleClosing = true;
- }
- }
Is this a bad idea?
Thanks!