# Solution - Beads Audio Library error : java.lang.IllegalArgumentException: Line unsupported

**URL:** <https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454>\
**Category:** Libraries\
**Created:** [March 19, 2019, 9:06pm UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454 "2019-03-19T21:06:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [March 19, 2019, 9:06pm UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/1 "2019-03-19T21:06:00Z")

</div>

In Linux I was getting this error when using the Beads audio library:

```auto
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.

1. Call `JavaSoundAudioIO.printMixerInfo();` to list the available mixers on the console.
2. Look at the console and choose a mixer that it’s not the default one (0). Then I replace this line:

```auto
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);

```

Then it works fine.

---

<div class="post-metadata">

**Author:** ![dan850](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@dan850](https://discourse.processing.org/u/dan850)\
**Post date:** [March 19, 2019, 9:23pm UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/2 "2019-03-19T21:23:38Z")

</div>

@hamoid thanks for sharing 🙂 feel free to offer more Solutions in the future.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [March 19, 2019, 9:30pm UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/3 "2019-03-19T21:30:55Z")

</div>

It’d be gr8 if the forum had a separate category for sharing tips & snippets. 👼

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [March 22, 2019, 4:54am UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/4 "2019-03-22T04:54:27Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![neilcsmith](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/neilcsmith/32/144_2.png) [@neilcsmith](https://discourse.processing.org/u/neilcsmith)\
**Post date:** [March 22, 2019, 10:12am UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/5 "2019-03-22T10:12:26Z")

</div>

@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! 😕

---

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [March 22, 2019, 11:05am UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/6 "2019-03-22T11:05:40Z")

</div>

Thank you @neilcsmith 🙂 I’m in the process of making [old projects](https://hamoid.com/code/2014-thoughts-of-rome/) 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

```
/etc/java10-openjdk/sound.properties
/etc/java-8-openjdk/sound.properties

```

I should find online what to put in those files and see if it fixes the issue for all Java programs, not only for this specific project.

---

<div class="post-metadata">

**Author:** ![Yousif](https://avatars.discourse-cdn.com/v4/letter/y/5fc32e/32.png) [@Yousif](https://discourse.processing.org/u/Yousif)\
**Post date:** [May 31, 2019, 7:46pm UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/7 "2019-05-31T19:46:57Z")

</div>

Thanks for this. This problem popped up when I switched from Java 8 to 11. Maybe something changed after Java 9.

Just a reminder for anyone:  
The `JavaSoundAudioIO.printMixerInfo()` method prints a 1-based list;  
While `jsaIO.selectMixer(i)` accepts a 0-based index.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [May 31, 2019, 7:53pm UTC](https://discourse.processing.org/t/solution-beads-audio-library-error-java-lang-illegalargumentexception-line-unsupported/9454/8 "2019-05-31T19:53:05Z")

</div>

> [@Yousif](#):
>
> Maybe something changed after Java 9.

Indeed, a breaking change happened in Java 9 → Java Modules: ☕  
[Docs.Oracle.com/javase/9/docs/api/overview-summary.html](http://Docs.Oracle.com/javase/9/docs/api/overview-summary.html)
