Wav file won't play

Processing suddenly won’t play a wav file that was working fine, here is some data on the matter:

INFO: JSyn: default output latency set to 80 msec for Windows 11
javax.sound.sampled.LineUnavailableException: line with format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian not supported.
at java.desktop/com.sun.media.sound.DirectAudioDevice$DirectDL.implOpen(DirectAudioDevice.java:484)
at java.desktop/com.sun.media.sound.AbstractDataLine.open(AbstractDataLine.java:115)
at com.jsyn.devices.javasound.JavaSoundAudioDevice$JavaSoundInputStream.start(Unknown Source)
at com.jsyn.engine.SynthesisEngine$EngineThread.run(Unknown Source)
java.lang.NullPointerException: Cannot invoke “javax.sound.sampled.TargetDataLine.read(byte, int, int)” because “this.line” is null
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)

Hi @Vanish87. That’s odd. Can you provide your audio hardware (especially if its not the built-in hardware), the audio driver for Windows (ASIO, WASAPI, DirectSound, MME, etc.) and the versions of both Processing and the Processing Sound Library? And any code you’re using to play the audio file would be helpful too.
Usually that error indicates the file is not in a format playable by Java Sound but your format is the most common type so it’s probably not that. It could be an issue with your audio driver allocating resources to another application which Processing (aka Java) is also trying to use.
Or it could just a be a bug.
Does this audio file play in other software?
Thanks.

1 Like

Hello,

hmm this doesn’t look like it’s a problem with the Wav file, but a problem with audio output more generally. Did you make any changes to the sound card setup since you last ran the sketch, or are you running it on a different computer altogether? If you could post the output of Sound.list(); at the very start of your sketch that would be helpful.

If you are comfortable manually installing a library, you could also try updating to the latest version of the Sound library, which might just fix your issue: Release v2.4.0-preview · processing/processing-sound · GitHub

1 Like

Hello, I’m back some some data that might prove useful or maybe not:
*Update: The soundfile does play on another laptop, albeit not mine.

Realtek(R) Audio Properties
Driver Date: 5/17/2022
Driver Version: 6.0.9354.1

Speaker/HP (Realtek(R) Audio) Properties
Driver Date: 5/6/2022
Driver Version 10.0.22621.1

Processing 4.3
Sound 2.3.1

Code:

// Import the sound library
import processing.sound.*;

// Declare a SoundFile object
SoundFile file;

// Load a sound file from the data folder
file = new SoundFile(this, “Ambient1.wav”);

// Loop the file
file.loop();

That looks like a general issue with the soundcard (probably a 24 bit one?) rather than something about wav playback in particular. The next Sound library release adds reliable 24 bit support on Windows but it will be a while before the update gets rolled out over the Contribution manager – in the meantime I suggest you manually install the upcoming release from the following link, that should fix your problems: Release v2.4.0-preview · processing/processing-sound · GitHub

1 Like