Minim icon indicating copy to clipboard operation
Minim copied to clipboard

Java Sound Minim Error when loading multiple files into audioPlayer

Open mbmosher opened this issue 6 years ago • 7 comments

I’ve got some Processing code that cycles through a folder of audio files and plays them with minim. I’m using the following that gets called in draw to check when one file is done and start the next. This is on Raspberry Pi. if(!player.isPlaying() && !inputing && index < lovequestions.length) { player.close(); player = minim.loadFile(language + "/love/questions/" + lovequestions[index]); delay(100); player.play(); index++; println("Index: " + index); }

But after about 9 tracks I get the following error. Sometimes its a few tracks less, sometimes a few more. I know that it is not related to the audio files themselves because they all will play individually, its in trying to play multiple files in sequence that I get the error. ` ==== JavaSound Minim Error ==== ==== Couldn't open the line: line with format PCM_SIGNED 48000.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.

=== Minim Error === === Couldn't load the file elevator2.wav `

mbmosher avatar Jan 26 '20 17:01 mbmosher

Also receiving the same error after trying to save() 5 audio files sequentially with AudioRecorder.

mbmosher avatar Jan 26 '20 20:01 mbmosher

This sounds like the same thing as Issue #78 . Try grabbing the jar files from here and replacing the installed version you are using in Processing:

https://github.com/ddf/Minim/tree/master/library

For AudioRecorder, you must call close() on the object returned by save(). The method saves the audio to disk and then immediately opens and returns a stream you can play, but this was a poor design decision in hindsight.

ddf avatar Jan 26 '20 22:01 ddf

Hmm, well I was actauly able to bypass the issue by switching all of my AudioPlayers to FilePlayers. Or rather, I only ever had one of either and was continuously loading new files into it. Switching to FilePlayer and un/patching(out) before and after every new fileLoad seemed to get past the JavaSound Minim Error. But now I'll be on the look out for the #78 memory leak error. So I'm not sure that this issue is actually related to #78.

mbmosher avatar Jan 28 '20 00:01 mbmosher

Ok, good to know, we'll keep this open.

ddf avatar Jan 28 '20 01:01 ddf

I am getting this too - a sound toy with 32 'tracks' like a drum machine - each has a dedicated audioplayer on a single minim instance (all populated in setup). Loads 31 files and fails on the 32nd one (even if I swap the order around) and get a null pointer exception when I try to play any of them... Same null pointer behaviour when running your examples so not code or file specific (and it all works using Processing.sound until the audio goes to hell after 10 min or so). OP behaviour suggests a memory issue? Null pointer suggests a version issue on a dependent library?

elias-mfe avatar Jan 03 '22 21:01 elias-mfe

==== JavaSound Minim Error ==== ==== Unable to return a SourceDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian

==== JavaSound Minim Error ==== ==== Unable to return a SourceDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian

==== JavaSound Minim Error ==== ==== Unable to return a SourceDataLine: unsupported format - PCM_SIGNED 44100.0 Hz, 24 bit, stereo, 6 bytes/frame, little-endian

pressed java.lang.ArrayIndexOutOfBoundsException: -1 at ddf.minim.MultiChannelBuffer.getSample(MultiChannelBuffer.java:125) at ddf.minim.ugens.Sampler$Trigger.generate(Sampler.java:284) at ddf.minim.ugens.Sampler.uGenerate(Sampler.java:214) at ddf.minim.UGen.tick(UGen.java:500) at ddf.minim.ugens.Summer.uGenerate(Summer.java:142) at ddf.minim.UGen.tick(UGen.java:500) at ddf.minim.AudioOutput$SampleGenerator.generate(AudioOutput.java:111) at ddf.minim.javasound.JSAudioOutput.readSignal(JSAudioOutput.java:119) at ddf.minim.javasound.JSAudioOutput.run(JSAudioOutput.java:70) ArrayIndexOutOfBoundsException: -1 Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help ? Troubleshooting.

elias-mfe avatar Jan 05 '22 10:01 elias-mfe

The 3 files are commercial samples in WAV format and are working in Processing using processing.sound. JRE at C:\Program Files (x86)\Java\jre1.8.0_311\ . I looked for libpulse-java.so and pulse-java.jar and sound.properties as per https://importgeek.wordpress.com/tag/little-endian-not-supported/ . Was wondering if they are part of the JDK (which I do not have) rather than JRE? Just tried to install JDK now and that did not fix the issue. Unfortunately Java is not a language I ever plan to use (outside of Processing and Minim, both of which I plan to use a lot) :-)

elias-mfe avatar Jan 05 '22 10:01 elias-mfe