GoogleCloudPlatform / node-red-contrib-google-cloud

Node-RED nodes for Google Cloud Platform
Apache License 2.0
90 stars 57 forks source link

Add Cloud Text-to-Speech API #85

Closed LordBilbon closed 3 years ago

LordBilbon commented 3 years ago

Hello,

I would like to add Cloud Text-to-Speech API with French language. I use it with HomeAssistant, but if Homeassistant is down, TTS does'nt work ;)

Thx a lot

kolban-google commented 3 years ago

@LordBilbon ... let's work together to determine the specification of what you are asking for. I'll be delighted to do the coding.

GCP provides the following product:

https://cloud.google.com/text-to-speech/docs

I am presuming that this is what we will use for the engine. The NodeJS API is found here and will be used as the Node-RED internal API calls:

https://googleapis.dev/nodejs/text-to-speech/latest/index.html

From a quick scan, it seems that the inputs will be:

There seems to be a world of other options including speaking rate, pitch, volume gain, sample rate and maybe others. I'd like to take an incremental approach. Is there a minimum set we could start with?

One of the biggest questions is "what do we do with the generated audio?". It appears that what we will get as output is a binary blob (i.e. encoded audio). Every Node in Node-RED outputs something for down-stream processing. My initial thought is to output:

msg.payload.encoded_audio = NodeJS Buffer object msg.payload.mime_type = Mime type of the encoded audio

Does this feel about right?

LordBilbon commented 3 years ago

Thanks to your quick reply, sorry my english is too bad

in fact, i use GCP TTS with Home Assistant -> https://www.home-assistant.io/integrations/google_cloud/

i find another node with GCP TTS but not French language -> https://flows.nodered.org/node/node-red-contrib-google-cloud-text-to-speech // https://github.com/kosukekurimoto/node-red-contrib-google-cloud-text-to-speech

I'm not a developper, i don't know is feel about right.

kolban-google commented 3 years ago

No problems ... let me have a go at a guess of what will suffice and we'll take it from there and see what needs to be tweakes.

LordBilbon commented 3 years ago

It's ok for me ;) thx

kolban-google commented 3 years ago

@LordBilbon - The 0.0.19 version is now out and has a new node "Text to Speech". This is the first pass at what we think you are looking for. Can you look at what we have released and see if it comes close to what you may be looking for. Please post back once youve had a chance to see and we'll iterate from there.

klingon888 commented 3 years ago

Installed this new TTS node and have been using past few days. So far, its been working great. I use the output audio file generated from google cloud to cast to a google home device. Hope you will continue to maintain this with any changes made by google in the future. Thanks again for adding this.

kolban-google commented 3 years ago

Thank you for the kind words ... I sure plan on maintaining it as long as I can ... and I see no reason that might not be years and years to come.

kolban-google commented 3 years ago

Am assuming that all is now well .. .and closing this issue as satisfied. If there are issues or further questions. Open up this issue again or post a new one.

klingon888 commented 3 years ago

I just updated to latest v0.0.21 and noticed that the Text-to-Speech node is now gone. Have you stopped supporting this feature? Thanks.

kolban-google commented 3 years ago

Hello my friend ... Oh no ... I'm very much still here and VERY much on the spot for enhancements and fixes. If its gone then its because me or one of the other committters who issued a pull request broke something. I'm making a note to get to it tomorrow (my dance card is full today). Apologies my friend ... use an older version in the meantime and I'll be right on it (tomorrow).

klingon888 commented 3 years ago

Thank you for the awesome support, as usual. I've rolled back to 0.0.19 in the meantime. No rush for the fix as it still works well.

kolban-google commented 3 years ago

TY for your patience ... I got to it. The error was mine. Apparently I failed to publish it properly somewhere along the line. There is now a public 0.0.22 which (hopefully) is the very latest of everything and includes the missing Text To Speech.

klingon888 commented 3 years ago

Happy to report that text to speech is now back in 0.0.22 and working well. Thanks again.

kolban-google commented 3 years ago

Awesome sauce ... closing the issue again ... don't hesitate to flag it open as needed.