Web Audio not working (OH 4.2.3)

Hello!
I sat down again and tried to make my openHAB instance a bit “smarter”.
So far I have never had any success in realizing anything with sound with openHAB.
Now I wanted to ask here what I’m always doing wrong that nothing works.

I’m going to try implementing TTS and STT.
So I installed Piper for TTS and Whisper for STT.
In Settings → System Settings → Audio I have set the output to “Web Audio”.
Under Settings → System Settings → Language I have set Piper for TTS and Whisper for STT and selected “Piper - German - Thorsten” as the voice.

If I now create a script that should output something to me, unfortunately nothing happens.
If I just want to play a sound like doorbell.mp3, nothing happens either.
“Web Audio” is selected as the audio sink.
And here we come to my actual problem.
With openHAB I have never been able to output sound via the web browser.

I see the following entry in the event.log when I play doorbell.mp3:
2024-12-20 21:49:08.149 [INFO ] [openhab.event.PlayURLEvent ] - Play URL '/audio/849944c6-256d-4daf-accf-38f6b0ec449b'.

Unfortunately, nothing happens in the browser.
Using the dev options, I also don’t see that the browser ever wants to access anything from /audio/XXXXX.

Sound effects such as the “snap sound” when the blocks are linked in the Blockly editor are played in the browser without any problems.
The devices can play sound as such. So that’s not the problem.

I have already tried the following applications:

  • Firefox
  • Libre Wolf (Firefox Fork)
  • Ungoogled Chromium
  • OH Android App (Android 15 - F-Droid)

What am I doing wrong?
I have found the problem several times while searching the net, but as usual in forums, no answer that works.
Some answers are also from OH2 times, which is partly no longer valid for OH4.

Yes, I use nginx as a proxy, but it doesn’t work either if I access OH directly via port 8080.

The actual goal used to be that the sound data would end up in a file that could be distributed in the home network with Snapcast, for example.
But this is apparently not so easy to implement.
I don’t have a “smart speaker” like Alexa, Google & Co. So I can’t test it with that and have to rely on the browser.

Did you enable audio for the browser in the “About&Help” menu?

1 Like

LoL since when has the counter been there?
I haven’t noticed it yet.
After activating it and pressing F5 once, playback works in the browser :slight_smile:
Thanks for the quick reply!

You wouldn’t happen to have any idea how I can transfer the sound to Snapcast?

Is snapcast already added as an Audio Sink (as can be seen under Settings → Audio) or did you install a binding yet?

The binding cannot act as an audio sink.
I have installed it, but it is not available for selection in the audio settings.
The binding itself only provides the available streams as a string.

UID: snapcast:server:SnapcastServer
label: Snapcast Server
thingTypeUID: snapcast:server
configuration:
  host: 127.0.0.1
  port: 1705
location: RPI4
channels:
  - id: streams
    channelTypeUID: snapcast:serverStreams
    label: Streams
    description: List of all available streams
    configuration: {}
  - id: streamsPlaying
    channelTypeUID: snapcast:serverStreamsPlaying
    label: Streams Playing
    description: List of all playing streams
    configuration: {}
  - id: streamsIdle
    channelTypeUID: snapcast:serverStreamsIdle
    label: Streams Idle
    description: List of all idle streams
    configuration: {}

I am not familiar with snapcast. Sorry.
Is there any setting in the snapcast server so that you can configure an incoming http audio stream?

Yes there is, but it only works poorly.
I have tested it with web radios.
However, I can use ffmpeg to write an audio stream to a sink file and distribute it with Snapcast.
This way I can distribute DAB+ radio in the house, for example.