/api/play-wav with siteId results in a timeout

I’m trying to send WAV files to the /api/play-wav endpoint with curl. There is a base and a satellite (both on Docker).

localhost:12101 is the base,
localhost:13101 the satellite

The command I’m using is
curl -H "Content-Type: audio/wav" -X post --data-binary "@C:\Docker\rhasspy\test.wav" http://url/api/play-wav?siteId=wohnzimmer

If I use the satellite URL, everything is working fine. But I want to send the command to the base and use the siteId to specify the satellite the WAV is played on.

The base has no audio playing device configured (will be running as Proxmox VM). Thus I get the following error when sending the command to the base-URL:

RuntimeError: No audio output system configured

If I configure an audio device - which is not what I want - it results in a timeout on the base but the WAV is played on the satellite:

Traceback (most recent call last):
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1821, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1869, in dispatch_request
    return await handler(**request_.view_args)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 1143, in api_play_wav
    await asyncio.gather(*aws)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 731, in play_wav_data
    handle_finished(), messages(), message_types
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 971, in publish_wait
    result_awaitable, timeout=timeout_seconds
  File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for
    raise futures.TimeoutError()
concurrent.futures._base.TimeoutError
[DEBUG:2021-02-10 11:51:36,295] rhasspyserver_hermes: Publishing 47 bytes(s) to hermes/asr/toggleOn
[DEBUG:2021-02-10 11:51:36,295] rhasspyserver_hermes: -> AsrToggleOn(site_id='wohnzimmer', reason=<AsrToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2021-02-10 11:51:36,294] rhasspyserver_hermes: Publishing 47 bytes(s) to hermes/hotword/toggleOn
[DEBUG:2021-02-10 11:51:36,294] rhasspyserver_hermes: -> HotwordToggleOn(site_id='wohnzimmer', reason=<HotwordToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2021-02-10 11:51:06,262] rhasspyserver_hermes: -> AudioPlayBytes(69164 byte(s))
[DEBUG:2021-02-10 11:51:06,261] rhasspyserver_hermes: Publishing 47 bytes(s) to hermes/asr/toggleOff
[DEBUG:2021-02-10 11:51:06,260] rhasspyserver_hermes: -> AsrToggleOff(site_id='wohnzimmer', reason=<AsrToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2021-02-10 11:51:06,257] rhasspyserver_hermes: Publishing 47 bytes(s) to hermes/hotword/toggleOff
[DEBUG:2021-02-10 11:51:06,256] rhasspyserver_hermes: -> HotwordToggleOff(site_id='wohnzimmer', reason=<HotwordToggleReason.PLAY_AUDIO: 'playAudio'>)
[DEBUG:2021-02-10 11:51:06,253] rhasspyserver_hermes: Playing 69164 byte(s)

Am I doing something wrong here?

Thx!
Stefan

P.S.: Anyone an idea, how i could - using Perl - read the WAV and send the contents to Rhasspy using MQTT?

1 Like

Hi, @schnopsi. Thanks for the feedback!

This looks like a bug in the web server, which I’ve now fixed. I added the ability to send messages to other site ids later, so the check for an unconfigured system needed to also check which site id the message was intended for.

Not sure about directly in Perl, but via command-line it’s pretty easy:

$ mosquitto_pub -p 12183 -t hermes/audioServer/$siteId/playBytes/$requestId -s < /path/to/file.wav
1 Like