Daisy_s
Daisy_s

Reputation: 109

Conversation + text-speech API in a single application

I am using Node-Red to develop a application with both conversation and text to speech services. Goal is give text input and get both text and voice as output. I am able to create the application at node-red but facing trouble with how the template should be? Some one please help. P.S: the text to speech service is using input text from conversation output.

Upvotes: 0

Views: 503

Answers (1)

Chris Parsons
Chris Parsons

Reputation: 26

If I'm understanding your question correctly the following should help point you in the right direction.

The string output from the conversation is stored on the msg.payload.output.text object. Using a function node between the Conversation node and the Text to Speech node will let you set:

msg.payload = msg.payload.output.text

as required by Text to Speech

Additionally, the function node may have multiple outputs so you can pass the string to TTS and wherever else you fancy, just edit the following parameter of the function node:

outputs

An example function node that flows from the Conversation node to Speech to Text would have the following code:

if (msg.payload.output && msg.payload.output.text) {
    msg.payload = msg.payload.output.text.join(' ');
} else {
    msg.payload = 'No response';
}
return msg;

The following flows from the Node-RED labs should help you:

Text to Speech

Conversation

Upvotes: 1

Related Questions