[SOLVED] No sound with enhancedjavasound (System speaker)

Hello,

This is my first topic, so excuse me if it’s not perfect :frowning: but be sure I’ll do everything to improve myself :slight_smile:

  • Platform information:
    • Hardware: Ryzen 3700X/64Go RAM/SSD 500Go
    • OS: Linux Manjaro
    • Java Runtime Environment: OpenJDK 64-Bit 1.8.0_242
    • openHAB version: 2.5.3
  • Issue of the topic:

Initially I created a simple rule, as soon as a contact is open, a sound should be played. But I can’t hear any sound. So I added some log, and logs are written in log file. So, after chaging log level, I tried in console : smarthome:audio play alert.wav
Same problem : no sound, but a warning in log (see below).

If I select “Web audio” everything works perfectly

  • Please post configurations (if applicable):
    • Items configuration related to the issue NA
    • Sitemap configuration related to the issue NA
    • Rules code related to the issue NA (I think)
    • Services configuration related to the issue NA
  • If logs where generated please post these here using code fences:
2020-03-31 19:09:46.896 [DEBUG] [core.audio.internal.AudioManagerImpl] - An exception occurred while getting the volume of sink 'enhancedjavasound' : Cannot determine master volume level
java.io.IOException: Cannot determine master volume level
	at org.openhab.io.javasound.internal.JavaSoundAudioSink.getVolume(JavaSoundAudioSink.java:179) ~[?:?]
	at org.eclipse.smarthome.core.audio.internal.AudioManagerImpl.getVolume(AudioManagerImpl.java:203) ~[bundleFile:?]
	at org.eclipse.smarthome.core.audio.internal.AudioManagerImpl.play(AudioManagerImpl.java:128) [bundleFile:?]
	at org.eclipse.smarthome.core.audio.internal.AudioManagerImpl.playFile(AudioManagerImpl.java:184) [bundleFile:?]
	at org.eclipse.smarthome.core.audio.internal.AudioConsoleCommandExtension.playOnSink(AudioConsoleCommandExtension.java:172) [bundleFile:?]
	at org.eclipse.smarthome.core.audio.internal.AudioConsoleCommandExtension.play(AudioConsoleCommandExtension.java:144) [bundleFile:?]
	at org.eclipse.smarthome.core.audio.internal.AudioConsoleCommandExtension.execute(AudioConsoleCommandExtension.java:86) [bundleFile:?]
	at org.eclipse.smarthome.io.console.ConsoleInterpreter.execute(ConsoleInterpreter.java:55) [bundleFile:?]
	at org.eclipse.smarthome.io.console.karaf.internal.CommandWrapper.execute(CommandWrapper.java:78) [bundleFile:?]
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [bundleFile:4.2.7]
	at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [bundleFile:4.2.7]
	at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) [bundleFile:4.2.7]
	at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) [bundleFile:4.2.7]
	at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) [bundleFile:4.2.7]
	at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) [bundleFile:4.2.7]
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [bundleFile:4.2.7]
	at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [bundleFile:4.2.7]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_242]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_242]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_242]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]

Thanks for your help.

Hi

Have you solved this now?

Would you be kind enough to post how?

I’m thinking of trying the JavaSound as a sink on an ODroid C2, but I’ve no idea how to setup the headless Linux audio (I really struggled with the Pulse audio settings in the Ubuntu Mate UX of my big machine, which is a little embarrassing for a sound engineer, but in my defense, I was aiming for a 7.1 output)

Hi,

Yes of course, I hope it will help (of course all commands are specific to archlinux and may have to be adapt a little bit to ubuntu).
My main problem was that by default pulseaudio is user-specific. So I had to switch to system-mode configuration (even if it’s not recommended).
First I created a pulse user, and set specific groups required :

useradd --no-create-home --user-group -system pulse
usermod -aG audio pulse

groupadd pulse-access
usermod -aG pulse-access pulse
usermod -aG pulse-access root
usermod -aG pulse-access openhab

Then I disabled and stopped user specific service and socket

systemctl --global disable pulseaudio.service pulseaudio.socket
systemctl --user stop pulseaudio.service pulseaudio.socket

Finally, after having created the system service I enabled and start it :

[Unit]
Description=Pulseaudio sound server
After=avahi-daemon.service network.target

[Service]
ExecStart=/usr/bin/pulseaudio --system --daemonize=no --disallow-exit --disallow-module-loading
ExecReload=/bin/pkill pulseaudio
Restart=always
RestartSec=30

[Install]
WantedBy=multi-user.target

systemctl enable pulseaudio.service
systemctl start pulseaudio.service

I still have the exception stacktrace, it’s more a warning but because of that it’s not possible to set volume from openhab. To me it’s a bug in addon, the volume configuration is based on SPEAKER PORT, it’s hardcoded, but I only have Line-out and Headphone.

That’s it (I had to restart)

1 Like

Thanks.

That’s excellent.

It certainly gives me something to work from, but I suspect it’s perfect as it is.

Best wishes