Minim
Minim copied to clipboard
loop method is not working correctly when loading sound from URL
import ddf.minim.*;
Minim minim = new Minim(this);
AudioPlayer s1;
void setup() {
size(640, 360);
background(255);
s1 = minim.loadFile("http://www.noiseaddicts.com/samples_1w72b820/2553.mp3");
s1.loop(); // the play() method works
}
void draw() {
background(400, 400);
}
Also tested the same mp3 sound, but this time loading it from the 'data' folder and the loop() method works perfectly.
Edit: There are other mp3 files which can be played, for example: https://opengameart.org/sites/default/files/song18.mp3
It is possible that the cause of this problem are some ID3 tags. This is the error shown in the console when playing http://www.noiseaddicts.com/samples_1w72b820/2553.mp3: " ==== JavaSound Minim Error ==== ==== Don't know the ID3 code PRIV "
As mentioned in the commit, the issue with that particular mp3 file was that the library calculated an incorrect length in milliseconds and so the loop end point was much too soon. When loading the same file from disk, the length detection method happened to work correctly.
I'm not sure why a different mp3 from the internet worked, but I have verified that the second file plays correctly even with the new code.