How to make Rhasspy speak a reply to command

Many thanks to synesthesiam and all those involved for a fantastic system.
I’ve been going through the forum and documentation trying to find out how to get Rhasspy to speak a response when I give a command/intent is recognised. So far I’ve struggled to find out how to do this, but I did see some hints that it is possible. Has anyone got this to work, and if so, could you give me some pointers please?
I’m running Rhasspy 2.4.19 and intent handling is by Home Assistant.

I do not use it myself but the Home Assistant conversation and intent script Integrations may help you.

The current version has some documentation about it

https://rhasspy.readthedocs.io/en/latest/intent-recognition/#home-assistant-conversation

For 2.5 I thought I read that it was still in the works.

I can’t help you with Home Assistant but I can tell you what I do, I don;t know if it helps.

I have a bare bones nodered instance on the Rhasspy satellite which subscribes to the hermes/tts/say topic.
It takes the text and runs an exec node to pass this to a bash script which does tts via MaryTTS running on the Rhasspy server and pipes the result to aplay.

The bash script basically just contains this:
curl $1"/process?INPUT_TYPE=TEXT&AUDIO=WAVE_FILE&OUTPUT_TYPE=AUDIO&LOCALE=en_US&INPUT_TEXT=%22"$2"%22&VOICE_SELECTIONS=cmu-slt%20en_US%20female%20unitselection%20general%22&VOICE=cmu-slt" | aplay

and the nodered instance passes the address of the MaryTTS server ($1) and text ($2)

Thanks geoffrey and jrb5665 for the info. I’ll have a play with those ideas. :smile:

btw. I did a quick search and I think this may be what you are looking for How do i use text to speech

If you use Home Assistant, add this to your configuration.yaml

rest_command:
  rhasspy_speak:
    url: 'http://192.168.43.54:12101/api/text-to-speech'
    method: 'POST'
    payload: '{{ payload }}' 
    content_type: text/plain

The IP address should be of your Rhasspy server

Then add in your automations.yaml

- id: '1581372525473'
  alias: EventLampen
  trigger:
  - event_data: {}
    event_type: rhasspy_Lights
    platform: event
  condition: []
  action:
  - data_template:
      payload: OK, {{ trigger.event.data.location }} gaat {{ trigger.event.data.action }}
    service: rest_command.rhasspy_speak
  - data_template:
      entity_id: light.{{ trigger.event.data.location }}
    service_template: light.turn_{% if trigger.event.data.action == 'aan' %}on{% else %}off{% endif %}

This is just an example, the automation are responding to the events coming from Rhasspy. You do not need the intents from Home Assistant.

The corresponding Rhasspy sentence is:

[Lights]
\[wil] [je] [de] lamp [in] [de] [het] (kantoor | woonkamer){location} (aan | uit){action} [zetten]

Do you use the eSpeak TTS for Dutch?

No, I’m using the en profile. I am dabbling with eSpeak - I just started using it through the API and as a bit of fun I recorded espeak saying “Yes oh mighty one” as a wav file :upside_down_face:. My thought is that I might get Rhasspy to play that in response to a command, but for some reason it isn’t working first time.

I’m going to play with the suggestions in the last few posts above to see how I get on.

No, the TTS is set to Google Wavenet.
The speech files are cached, so the service is only called once.

That’s exactly the route I’m considering as well, just hoping that the Ruben voice from Amazon Polly can be integrated instead of using Google. I added a feature request for it, so who knows one day :blush:

You might be able to simplify your Home Assistant service_template by making use of the Rhasspy substitution feature using the following slightly modified example from what you shared:

[Lights]
\[wil] [je] [de] lamp [in] [de] [het] (kantoor | woonkamer){location} (aan:on | uit:off){action} [zetten]

This should result in an action slot with the value of on or off rather then aan and uit.

Good idea indeed, my service_template has changed many times :smiley:
But then the template for TTS should change (otherwise I will hear “ok, kantoor off”), so it doe snot really make a difference.

I don’t how much you are a coder, but I have implemented the Google Wavenet part into Rhasspy because I wanted it. Maybe you can do the same with Polly?

I have kantoor and woonkamer in the slots area actually, but for the example I have made them inline.