Robot Engage Blog Buy Now

Misty Community Forum

Text to Speech -- Using Google APIs

Hi All,

I am writing a skill to convert a text to speech using Google. Was curious to know if anyone has experience with this? I send the request and receive a file back. (I used the sugestion from Google – Quickstart: Using the command line  |  Cloud Text-to-Speech API  |  Google Cloud).

However, I am not sure how to decode the .txt file received and convert it into a format that Misty can work with. Any suggestions?


Hi Sanjay,

As your question isn’t specific to Misty, I’ve moved it over into the general “Misty Development” category. It’s typically just Misty Staff that checks Developer Support, and this will ensure other developers who may have more knowledge about Google APIs can see it :slight_smile:

If you have the option to return the audio data as a base64 string without writing it to a .txt file, then you may be able to use the built-in functionality of the SendExternalRequest method to save the file to Misty. Misty is able to save audio and image assets that she receives as base64 data. I’m not familiar with Google’s service, but in the callback for misty.SendExternalRequest(), you may be able to parse out the base64 string from your response data and pass it into the misty.SaveAudio() method.

Here’s how I wrote some similar functionality using Azure’s TTS service:

// Send the request
misty.SendExternalRequest("GET", _params.azureURL, null, null, "{\"message\":\"hello, world!\"}");

// Handle response data.
// Azure's TTS service simply returns a base64 string, which we
// can pass directly into the misty.SaveAudio() method
function _SendExternalRequest(data) {
	misty.Debug("Response Received");
	if (data !== undefined && data !== null) {
		// Prints response data (a base64-encoded audio file) 
        // Saves and plays base64-encoded audio data 
        misty.SaveAudio("AzureResponse.wav", data.Result.ResponseObject.Data, true, true);
	else {
		misty.Debug("ERROR: Empty callback data");

Hi @guptahome100!

Another thing that might be useful to look at is our dear friend @cameron 's ‘Misty Conversation’ skill that uses DialogFlow. Depending on what you’re trying to accomplish, this might make it easier: GitHub - cameron-gq/misty-conversation: JavaScript Skill that allows you to have a conversation with Misty

Thanks Chris and Jonathan for your help. I also located a skill for using google cloud on githib. Here is the link misty-conversation/index.js at master · cameron-gq/misty-conversation · GitHub.

I have been successful in using this construct…

1 Like

Excellent! Let us know what more we can do to help you move ahead!

good for now… Trying to next see if I can use Google’s image classifier to find the charger :slight_smile:

1 Like