I am developing a cocos creator game and it is build both android and IOS versions. I need to add "text to speech" feature into that APP. But I tried a lot to find a text to speech API but none of them work with Android/IOS app.
following solutions also work only with web browser.
Using Google Text-To-Speech in Javascript
So I decided to use Google Cloud - text to speech API but after lot of try, I decided to ask from you all...
As my understanding in Google Cloud, we have given following details.
Request URL : https://texttospeech.googleapis.com/v1beta1/text:synthesize
Request body :
{
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "Hello world"
},
"voice": {
"languageCode": "en-US",
"name": "en-US-Wavenet-D"
}
}
I think I have to write HTTP Post request using above information in order to get translation. I wrote sample server request but it does not give good result. please see below..
sendServerReq : function(){
var restChannel = cc.loader.getXMLHttpRequest();
restChannel.open("POST", 'https://texttospeech.googleapis.com/v1beta1/text:synthesize', true);
restChannel.setRequestHeader("Content-Type", "application/json");
var jsonObj = {
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "おはようございます"
},
"voice": {
"languageCode": "ja-JP",
"name": "ja-JP-Standard-B"
}
};
var response = restChannel.send(jsonObj);
},
could you please let me know how to use Google cloud for "text to speech" feature or is there are any free api to get text to Speech feature in COCCOS Creator Android/IOS app.
Thank you very much
what I need is to add text to speech feature into my game app
sendServerReq : function(){
var restChannel = cc.loader.getXMLHttpRequest();
restChannel.open("POST", 'https://texttospeech.googleapis.com/v1beta1/text:synthesize', true);
restChannel.setRequestHeader("Content-Type", "application/json");
var jsonObj = {
"audioConfig": {
"audioEncoding": "LINEAR16",
"pitch": 0,
"speakingRate": 1
},
"input": {
"text": "おはようございます"
},
"voice": {
"languageCode": "ja-JP",
"name": "ja-JP-Standard-B"
}
};
var response = restChannel.send(jsonObj);
},
- That’s an error.
The requested URL
/v1beta1/text:synthesize
was not found on this server