In Linux I was getting this error when using the Beads audio library:
Exception in thread "Thread-1" java.lang.IllegalArgumentException: Line unsupported: interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, big-endian
at java.desktop/com.sun.media.sound.PortMixer.getLine(PortMixer.java:131)
at beads.JavaSoundAudioIO.create(Unknown Source)
at beads.JavaSoundAudioIO$1.run(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:844)
Since I didn’t find any help online about this but I made it work I thought I would share here how I did it.
The problem is that by default it chooses the wrong audio mixer. I fixed it with two steps.
Call JavaSoundAudioIO.printMixerInfo(); to list the available mixers on the console.
Look at the console and choose a mixer that it’s not the default one (0). Then I replace this line:
ac = new AudioContext();
with these three, in which I choose mixer 3 (my internal sound card):
JavaSoundAudioIO jsaIO = new JavaSoundAudioIO();
jsaIO.selectMixer(3);
ac = new AudioContext(jsaIO);
I feel this can simply go in Library questions, because it answers a Library question.
Gallery is “share and discuss your work” – this is a great contribution, but isn’t really “hamoid’s work”, even though it is a trick that hamoid got working.
@hamoid what exactly do you mean by “wrong mixer” though? Is this with the Oracle JDK in Processing or with OpenJDK? Because OpenJDK ships with a PulseAudio mixer provider that should come first in the mixer list by default. If with the bundled JDK, you could also look at the sound.properties file inside java/lib which should allow you to customize this for your system so default usage works. But no PulseAudio mixer because of Oracle’s license!
Of course you could always use JACK with Beads and get better audio performance. Beads also has a very old version of the JAudioLibs JavaSound backend from PraxisLIVE in there, but not the default, and for some reason Ollie broke it so it only works properly on macOS!
Thank you @neilcsmith I’m in the process of making old projects work for a talk. The server side (which takes care of sound) was crashing by default. I’m not sure what I mean with “wrong mixer”, but I assumed it’s a mixer since the problem is solved by calling selectMixer()
I’m using OpenJDK. I don’t know why the default audio setup doesn’t work. Probably related to the audio config in my ArchLinux. But I haven’t had issues with any other software… I can run Jack, SuperCollider and any common sound-generating program.
Thanks for the sound.properties tip. In my system it’s located in