Rhasspy docs say it always tries to return 16 kHz, 16-bit mono audio, so Iād guessing thatās what it generates, though I can see the included wakeword wavs are 44.1 kHz.
Somewhat interestingly, with:
pcm.speaker {
type plug
slave {
pcm "hw:0,0"
}
}
We have this crash result (two successful wakeword sounds, followed by a crash on a TTS being sent):
2019-07-01 07:05:30,203 INFO Connected to audio output bcm2835 ALSA: IEC958/HDMI (hw:0,1).
2019-07-01 07:05:30,221 INFO Connected to MQTT broker mqtt:1883 with result code 0.
2019-07-01 07:05:30,222 INFO Subscribed to hermes/audioServer/default/playBytes/+ topic.
2019-07-01 07:05:35,226 INFO Received an audio message of length 81.98 KiB with request id b0e69643-ddfa-4843-ad62-a3cf37ae57de on site default.
2019-07-01 07:05:35,689 INFO Finished playing audio message with id b0e69643-ddfa-4843-ad62-a3cf37ae57de on device bcm2835 ALSA: IEC958/HDMI (hw:0,1) on site default.
2019-07-01 07:05:37,082 INFO Received an audio message of length 117.1 KiB with request id 78bfd886-4e24-454c-ad0c-c62790e2e50b on site default.
2019-07-01 07:05:37,759 INFO Finished playing audio message with id 78bfd886-4e24-454c-ad0c-c62790e2e50b on device bcm2835 ALSA: IEC958/HDMI (hw:0,1) on site default.
2019-07-01 07:05:47,322 INFO Received an audio message of length 35.09 KiB with request id bd7053c0-df4f-4f49-bd84-ac1718a3bad1 on site default.
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048
Expression 'PaAlsaStreamComponent_InitialConfigure( &self->playback, outParams, self->primeBuffers, hwParamsPlayback, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2722
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843
Traceback (most recent call last):
File "/usr/local/bin/hermes-audio-player", line 20, in <module>
plac.call(main)
File "/usr/local/lib/python3.7/site-packages/plac_core.py", line 330, in call
cmd, result = parser.consume(arglist)
File "/usr/local/lib/python3.7/site-packages/plac_core.py", line 207, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "/usr/local/bin/hermes-audio-player", line 16, in main
cli.main(PLAYER, verbose, version, config, daemon)
File "/usr/local/lib/python3.7/site-packages/hermes_audio_server/cli.py", line 68, in main
server.start()
File "/usr/local/lib/python3.7/site-packages/hermes_audio_server/mqtt.py", line 68, in start
self.mqtt.loop_forever()
File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1578, in loop_forever
rc = self.loop(timeout, max_packets)
File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1072, in loop
rc = self.loop_read(max_packets)
File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 1374, in loop_read
rc = self._packet_read()
File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 2071, in _packet_read
rc = self._packet_handle()
File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 2560, in _packet_handle
return self._handle_publish()
File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 2759, in _handle_publish
self._handle_on_message(message)
File "/usr/local/lib/python3.7/site-packages/paho/mqtt/client.py", line 2902, in _handle_on_message
callback(self, self._userdata, message)
File "/usr/local/lib/python3.7/site-packages/hermes_audio_server/player.py", line 76, in on_play_bytes
output=True)
File "/usr/local/lib/python3.7/site-packages/pyaudio.py", line 750, in open
stream = Stream(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/pyaudio.py", line 441, in __init__
self._stream = pa.open(**arguments)
OSError: [Errno -9997] Invalid sample rate
However, after forcing 48000 rate output via asound.conf in the docker container (44100 still crashed) with this asound entry:
pcm.speaker {
type plug
slave {
pcm "hw:0,0"
rate 48000
}
}
ā¦ it plays successfully!
Curiously though the first log line changes from Connected to audio output bcm2835 ALSA: IEC958/HDMI (hw:0,1).
to Connected to audio output default.
. The only sound configuration that changed is the addition of the rate 48000
. I donāt know if thatās just a bug in display, or related to the problem. The Pi is headless so nothing is connected via HDMI, and I do hear the wakeword sounds over the 3.5mm audio (hw:0,0).
2019-07-01 07:11:03,481 INFO Connected to audio output default.
2019-07-01 07:11:03,497 INFO Connected to MQTT broker mqtt:1883 with result code 0.
2019-07-01 07:11:03,499 INFO Subscribed to hermes/audioServer/default/playBytes/+ topic.
2019-07-01 07:11:13,176 INFO Received an audio message of length 81.98 KiB with request id 75a604f3-2992-4007-9f0d-88235c7f9f59 on site default.
2019-07-01 07:11:13,628 INFO Finished playing audio message with id 75a604f3-2992-4007-9f0d-88235c7f9f59 on device default on site default.
2019-07-01 07:11:15,020 INFO Received an audio message of length 117.1 KiB with request id 770f7bb9-acab-4cfa-b224-b1bb54d403bc on site default.
2019-07-01 07:11:15,668 INFO Finished playing audio message with id 770f7bb9-acab-4cfa-b224-b1bb54d403bc on device default on site default.
2019-07-01 07:11:19,212 INFO Received an audio message of length 35.09 KiB with request id 8ea3ed0b-aef3-4236-b0ef-ee4a75ad5813 on site default.
2019-07-01 07:11:20,248 INFO Finished playing audio message with id 8ea3ed0b-aef3-4236-b0ef-ee4a75ad5813 on device default on site default.