I've made a sketch to launch some mp3 files with minim and a button on my arduino. There is a .txt containing sond names, and the program loads those names to play mp3 in a random way. It's simple and it works, but if I put more than 2, 3 mp3, I get this error :
An OutOfMemoryError means that your code is either using up too much memory
because of a bug (e.g. creating an array that's too large, or unintentionally
loading thousands of images), or that your sketch may need more memory to run.
If your sketch uses a lot of memory (for instance if it loads a lot of data files)
you can increase the memory available to your sketch using the Preferences window.
Exception in thread "Animation Thread" java.lang.OutOfMemoryError: Java heap space
at ddf.minim.javasound.FloatSampleBuffer.insertChannel(Unknown Source)
at ddf.minim.javasound.FloatSampleBuffer.createChannels(Unknown Source)
at ddf.minim.javasound.FloatSampleBuffer.init(Unknown Source)
at ddf.minim.javasound.FloatSampleBuffer.initFromByteArray(Unknown Source)
at ddf.minim.javasound.FloatSampleBuffer.initFromByteArray(Unknown Source)
at ddf.minim.javasound.JSMinim.loadFloatAudio(Unknown Source)
at ddf.minim.javasound.JSMinim.getAudioSample(Unknown Source)
at ddf.minim.Minim.loadSample(Unknown Source)
at ddf.minim.Minim.loadSample(Unknown Source)
at voix_led_memoire_bouton.setup(voix_led_memoire_bouton.java:101)
at processing.core.PApplet.handleDraw(PApplet.java:2117)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:193)
at processing.core.PApplet.run(PApplet.java:2020)
at java.lang.Thread.run(Thread.java:662)
I increased the maximum available memory but still can't load more than 4,5 with 512 Mo. Here is my code :
import processing.serial.*;
import cc.arduino.*;
import ddf.minim.*;
Minim minim;
AudioSample son[];
Arduino arduino;
int ledPin = 2;
int btn = 3;
int r =0;
void setup()
{
minim = new Minim(this);
String titres[] = loadStrings("titres.txt");
son = new AudioSample[titres.length];
for (int i=0;i<titres.length;i++){
son[i] = minim.loadSample("musique/"+titres[i]);
}
arduino = new Arduino(this, Arduino.list()[0], 57600);
I'm new on processing and I've downloaded the voce library. I used the library with the english recognition, but now, because I'm french, I want to use "lium_french_f0". I've downloaded it but I don't know what to do with the files in this folder...