Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Sound Minim Error when loading multiple files into audioPlayer #104

Open
mbmosher opened this issue Jan 26, 2020 · 7 comments
Open

Comments

@mbmosher
Copy link

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
Copy link
Author

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

@ddf
Copy link
Owner

ddf commented Jan 26, 2020

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.

@mbmosher
Copy link
Author

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.

@ddf
Copy link
Owner

ddf commented Jan 28, 2020

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

@elias-mfe
Copy link

elias-mfe commented Jan 3, 2022

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
Copy link

==== 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
Copy link

elias-mfe commented Jan 5, 2022

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) :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants