I use usually Minim library in Java mode but Minim don’t work in Android mode.
So I would like to use the Sound library because It looks like Sound works with Java and Android.
To begin with Sound I first tried examples provided with the Sound library like “AudioWaveform” and others in the Java mode but without success.
Here is the error message when I try to run the sketch.
oct. 29, 2020 1:19:59 PM com.jsyn.devices.javasound.JavaSoundAudioDevice <init>
INFOS: JSyn: default output latency set to 80 msec for Windows 7
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
at com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:513)
at com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:121)
at com.jsyn.devices.javasound.JavaSoundAudioDevice$JavaSoundInputStream.start(Unknown Source)
at com.jsyn.engine.SynthesisEngine$EngineThread.run(Unknown Source)
java.lang.NullPointerException
at com.jsyn.devices.javasound.JavaSoundAudioDevice$JavaSoundInputStream.read(Unknown Source)
at com.jsyn.devices.javasound.JavaSoundAudioDevice$JavaSoundInputStream.read(Unknown Source)
at com.jsyn.engine.SynthesisEngine$EngineThread.run(Unknown Source)
java.lang.RuntimeException: AudioInput stop attempted when no line created.
at com.jsyn.devices.javasound.JavaSoundAudioDevice$JavaSoundInputStream.stop(Unknown Source)
at com.jsyn.engine.SynthesisEngine$EngineThread.run(Unknown Source)
And this only with sketches written with the Sound library!
Sketches written with the Minim or Bead libs works fine.
I have tried with Java7 : it’s the same.
I don’t understand what append.
I’am on Windows7pro, Processing 3.5.4 and Java8.
I saw that you posted on an another topic about this error.
After searching similar errors on the net I’m almost convinced that jeremydouglass gave the correct answer:
A LineUnavailableException is an exception indicating that a line cannot be opened because it is unavailable. This situation arises most commonly when a requested line is already in use by another application.
I’m on Windows7pro as well and don’t get errors.
I would check Windows’s task manager and see what underlying programs & processes could be using the sound card (eventual just kill/stop the process to check if it continues)
This can be a lot of things up to Chrome extensions.
Aaah he’s a little joker! So I still opened my topic in the right section!
Good news, Sound works! Access was blocked by the webcam microphone.
I had seen this comment but I hadn’t watched this because the sketches writen with Minim and Bead libraries weren’t bothered by it.
Why Minim and Bead don’t care of it and Sound does, mystery.
Thanks @noel
I’ve solved this issue - at least on Windows 10. I’d bet it applies to W8 and even likely to W7 though I have not tested these. The error message indicates something else has control of the port trying to be used. I first assumed I had another Processing program running (maybe not visible/crashed/etc.) which was accessing the mic and thus the new program I was writing. I shut down all apps, restarted, and still got the message. So not that!
Next I looked at my Windows 10 “Microphone Privacy Settings” easily accessed by just searching for that specific text. At the top of this Control Panel screen there is a button for allowing your microphone to be accessible to apps. This option must be turned on.
Once you do this, a second option further down on the same can be accessed. This button says “Allow desktop apps access to your microphone”. This option must also be turned on for Processing to access the microphone. Actually you are granting access to the Java software - not the Processing software - which is running on top Java.
I’m not sure what the W10 defaults are since I do not use MS’s defaults when configuring a new PC and afterwards go in to turn off access to everything…only turning things back on when forced to…like in this case.
Hope this helps others : )
Note: Some answers suggested this issue was specific to the included Processing Sound library and thus recommended other audio libs to work around the issue. My guess is any other “sound” library for Java would fail just like the Sound library does (so switching libs wouldn’t help if they are based on Java).
Finally, Windows 10 also has security settings for other things like the camera which I suspect must also be set to allow access to them in Processing (again … really Java).
BTW: Full error message one sees in Processing is (one line):
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.