I’m a happy newbee user of Rhasspy and have a Jabra 410 connected and working as both microphone and speaker. I’m now trying to add text to speech capabilities to it and understand that this can be done through the websocket. I’m trying to follow this guide:
https://dev.to/jeikabu/home-assistant-voice-recognition-with-rhasspy-1jb2
So the first test is using the command line from another computer in the network:
curl -X POST -d "hello world" http://pi3.local:12101/api/text-to-speech
Where I changed pi3.local to the local ip address of the Raspberry Pi running the Rhasspy server.
The Rhasspy log then shows this:
[ERROR:53207605] APlayAudioPlayer: on_receive
Traceback (most recent call last):
File "/usr/share/rhasspy/rhasspy/actor.py", line 175, in on_receive
self._state_method(message, sender)
File "/usr/share/rhasspy/rhasspy/audio_player.py", line 70, in in_started
self.play_data(message.wav_data)
File "/usr/share/rhasspy/rhasspy/audio_player.py", line 102, in play_data
subprocess.run(aplay_cmd, input=wav_data, check=True)
File "/usr/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['aplay', '-q', '-D', 'dmix:CARD=USB,DEV=0']' returned non-zero exit status 1.
[DEBUG:53207533] APlayAudioPlayer: ['aplay', '-q', '-D', 'dmix:CARD=USB,DEV=0']
[DEBUG:53207531] EspeakSentenceSpeaker: ready -> speaking
[DEBUG:53207429] EspeakSentenceSpeaker: ['espeak', '-v', 'en', '--stdout', 'hello world']
I’m assuming, from the log, that at first espeak is used to create a sound file which is then played using aplay. I’ve tested both espeak and aplay using a ssh terminal to the raspberry pi and both work as expected.
Another hint may be that the ‘Speak’ button in the ‘Speech’ tab of the Rhasspy web interface also doesn’t work.
Maybe someone can point me in the right direction on how to solve this.