Rhasspy3 debugging Server / Satellite setup

Hi Guys,

I followed the tutorial for server and satellite setup…

My server is running in a Proxmox VE container using a Debian Buster image, the satellite is hosted on a Pi 3B running Raspberry OS (2023-05-03-raspios-bullseye-arm64-lite.img).

My goal is to get a working german setup for testing purposes, so I changed the porcupine parts accordingly. Not sure if my satellite setup needs the lang_model: "${data_dir}/lib/common/porcupine_params_de.pv" line to work properly?

I tried to test the setup with script/run bin/satellite_run.py --debug --loop

The wakewords (ananas) seems to be recognized just fine, but after that I get the following:

DEBUG:rhasspy3.wake:detect: Detection(name='ananas_raspberry-pi', timestamp=1937814728170)
DEBUG:rhasspy3.program:script/run ['ws://192.168.15.173:13331/pipeline/asr-tts']
Traceback (most recent call last):
  File "/opt/rhasspy3/config/programs/remote/websocket/bin/stream2stream.py", line 105, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/opt/rhasspy3/config/programs/remote/websocket/bin/stream2stream.py", line 26, in main
    async with connect(args.uri) as websocket:
  File "/opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/client.py", line 637, in __aenter__
    return await self
  File "/opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/client.py", line 655, in __await_impl_timeout__
    return await self.__await_impl__()
  File "/opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/client.py", line 659, in __await_impl__
    _transport, _protocol = await self._create_connection()
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1056, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.9/asyncio/base_events.py", line 1041, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.9/asyncio/base_events.py", line 955, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 502, in sock_connect
    return await fut
  File "/usr/lib/python3.9/asyncio/selector_events.py", line 537, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.15.173', 13331)
DEBUG:rhasspy3.program:snd_adapter_raw.py ['--rate', '22050', '--width', '2', '--channels', '1', 'aplay -q -D "default" -r 22050 -f S16_LE -c 1 -t raw']
aplay: main:830: audio open error: Unknown error 524

I think the error occures because the server is running on Proxmox and has something to do with a proper soundcard configuration… but does the server need a sound device config when running a server/satellite setup?

here are my configuration files…
Server:

programs:
  mic:
    arecord:
      command: |
        arecord -q -r 16000 -c 1 -f S16_LE -t raw -
      adapter: |
        mic_adapter_raw.py --rate 16000 --width 2 --channels 1
  vad:
    silero:
      command: |
        script/speech_prob "share/silero_vad.onnx"
      adapter: |
        vad_adapter_raw.py --rate 16000 --width 2 --channels 1 --samples-per-chunk 512
  asr:
    faster-whisper:
      command: |
        script/wav2text "${data_dir}/tiny-int8" "{wav_file}"
      adapter: |
        asr_adapter_wav2text.py
    faster-whisper.client:
      command: |
        client_unix_socket.py /var/run/faster-whisper.socket
  wake:
    porcupine1:
      command: |
        .venv/bin/python3 bin/porcupine_stream.py --model "${model}" --lang_model "${lang_model}"
      template_args:
        model: "${data_dir}/resources/keyword_files_de/linux/ananas_linux.ppn"
        lang_model: "${data_dir}/lib/common/porcupine_params_de.pv"
  handle:
    date_time:
      command: |
        bin/date_time.py
      adapter: |
        handle_adapter_text.py
  tts:
    piper.client:
      command: |
        client_unix_socket.py var/run/piper.socket
  snd:
    aplay:
      command: |
        aplay -q -r 22050 -f S16_LE -c 1 -t raw
      adapter: |
        snd_adapter_raw.py --rate 22050 --width 2 --channels 1

servers:
  asr:
    faster-whisper:
      command: |
        script/server --language "de" "${data_dir}/tiny-int8"
  tts:
    piper:
      command: |
        script/server "${model}"
      template_args:
        model: "${data_dir}/de-thorsten-low.onnx"

pipelines:
  default:
    mic:
      name: arecord
    vad:
      name: silero
    asr:
      name: faster-whisper.client
    wake:
      name: porcupine1
      template_args:
        model: "ananas_linux.ppn"
    handle:
      name: date_time
    tts:
      name: piper.client
    snd:
      name: aplay

Satellite:

programs:
  mic:
    arecord:
      command: |
        arecord -q -r 16000 -c 1 -f S16_LE -t raw -
      adapter: |
        mic_adapter_raw.py --samples-per-chunk 1024 --rate 16000 --width 2 --channels 1

  wake:
    porcupine1:
      command: |
        .venv/bin/python3 bin/porcupine_stream.py --model "${model}" --lang_model "${lang_model}"
      template_args:
        model: "${data_dir}/resources/keyword_files_de/raspberry-pi/ananas_raspberry-pi.ppn"
        lang_model: "${data_dir}/lib/common/porcupine_params_de.pv"

  remote:
    websocket:
      command: |
        script/run "${uri}"
      template_args:
        uri: "ws://192.168.15.173:13331/pipeline/asr-tts"


satellites:
  default:
    mic:
      name: arecord
    wake:
      name: porcupine1
    remote:
      name: websocket
    snd:
      name: aplay

I hope I can get some help to get this running maybe a configuration error? I never used the sound device from the Proxmox hardware, if that is the cause why it’s failing it would be nice to get a short explanation on that, but I’m not sure…

I’m not that experienced in developing so any help appreciated to debug this :wink:

thanks,
Dan

Short update…

I managed to route the hw soundcard into the container, but this seems not to change anything…

I can get the device lists now with arecord -l and aplay -l but the error remains :confused:

and I corrected a typo in the server config, accidentially I haven’t changed the pipeline wakeword to the german one, but after change still no luck…

now I added the http server start to my crontab @reboot

when I now run script/run bin/satellite_run.py --debug --loop, the error changes:

DEBUG:rhasspy3.wake:detect: Detection(name='ananas_raspberry-pi', timestamp=9209600661124)
DEBUG:rhasspy3.program:script/run ['ws://192.168.15.173:13331/pipeline/asr-tts']
DEBUG:rhasspy3.program:snd_adapter_raw.py ['--rate', '22050', '--width', '2', '--channels', '1', 'aplay -q -D "default" -r 22050 -f S16_LE -c 1 -t raw']
Task exception was never retrieved
future: <Task finished name='Task-5' coro=<WebSocketCommonProtocol.recv() done, defined at /opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/protocol.py:501> exception=ConnectionClosedOK(Close(code=1000, reason=''), Close(code=1000, reason=''), True)>
Traceback (most recent call last):
  File "/opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 568, in recv
    await self.ensure_open()
  File "/opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: received 1000 (OK); then sent 1000 (OK)
Task exception was never retrieved
future: <Task finished name='Task-22' coro=<WebSocketCommonProtocol.send() done, defined at /opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/protocol.py:580> exception=ConnectionClosedOK(Close(code=1000, reason=''), Close(code=1000, reason=''), True)>
Traceback (most recent call last):
  File "/opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 635, in send
    await self.ensure_open()
  File "/opt/rhasspy3/config/programs/remote/websocket/.venv/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 935, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedOK: received 1000 (OK); then sent 1000 (OK)
aplay: main:830: audio open error: Unknown error 524