Sound Library examples all return errors, make no sound

Hi everyone -
I’m trying to use the official Sound library, but can’t get it to make any sound - and this is only through running the official examples included with the library, so far.

Here’s a typical error message, generated by the “SimplePlayback” example, which is meant to play back a sound file. I checked, and the file is located in the sketch’s Data folder.

Nov 10, 2019 2:38:06 PM com.jsyn.devices.javasound.JavaSoundAudioDevice <init>
INFO: JSyn: default output latency set to 80 msec for Windows 10
SFSampleRate= 44100 Hz
SFSamples= 2469587 samples
SFDuration= 55.999706 seconds
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)

I’m on Windows 10 64-bit, using the latest build of Processing.
Any suggestions on what to do would be great. I’m assuming this library is still supposed to work?

Thanks!

1 Like

Did you install the library?

There is a menu point for this

Yes, the library was already installed through the menu. The specific error above is from one of the library’s examples. I get a similar kind of error no matter what I try to do with the library’s classes / functions, including copying and pasting code from the official documentation.

1 Like

right, processing comes with installed sound lib

on win 10 64bit,
install processing 3.5.3 64 bit
download: http://download.processing.org/processing-3.5.3-windows64.zip
unzip to …/Documents/ and start:
c:\Users\ < USER > \Documents\processing-3.5.3\processing.exe

go:
file / examples / libraries / sound / soundfile / simpleplayback

and get a white window and hear some music

and the whole thing looks like:

so your

  • processing or
  • windows

is kaput.

-a- does every thing else work ( like for the graphic “ribbon” example… )
ONLY sound NOT?
so you might need to reinstall motherboard sound driver

-b- for reinstall processing see first:
Processing isn't running (java.lang.NullPointerExcpetion) ,

1 Like

https://docs.oracle.com/javase/7/docs/api/javax/sound/sampled/LineUnavailableException.html

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.

Their first best guess: an application like iTunes / Windows Media Player / etc. is hogging the sound.

1 Like

Hi,
I have the same problem as M11 a year ago.
And this only with code written with the Sound library !
Code written with the Minim or Bead libs works fine.
I also tried the examples provided with the Sound library like “AudioWaveform” and others, without success.
Here is the error message.

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 I don’t see any solution in this topic.
I’am on Windows7, Processing 3.5.4 and Java8.

Has someone perhaps found a solution in the meantime?
Thanks in advance for your replies.

I have resolved this error - at least on Windows 10. I did a pretty good search of the InterJenette to find an answer before doing the heavy lifting of actually tracking it down myself : (
Still surprised I didn’t find the answer given the fix.

I’d bet this applies to W8 and probably W7 though I have not tested these (give it time). And other OSs. Since the Java error indicates something else has control of the port I ASSumed first there might be another Processing/Java program running (maybe not visible, crashed, stranded in memory, all alone, etc.) which was accessing the mic and thus stopping 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 the quoted 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. Oddly this is done by hitting the Change button above it and not the button itself, which really only shows the settings value (hum). Personally I toggled off all of the Apps that were granted access at this point.

Once you do this, a second option further down on the same screen 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. You should see Java here (mine shows two so I’d guess 1 for my PC and 1 for Android which I’ve deployed to).

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.

1 Like

Thank you so much for sharing this solution, reProcessing!