Closed minemidnight closed 7 years ago
Thanks for your report. This is the limitation of Google TTS API (for free), and I will add the statement to README.
Is there a way to get streams from multiple URLs and combine them to overcome this? Of course it would remove the "just returns a url" functionality, but would fix this.
Yes, that's exactly how "Google Translate" is doing on their website:
First, cut off the long paragraph into many small sentences, in order to make all the amount of characters (of sentences) less than 200.
Then, send requests to Google Translate API
and play the audios in sequence.
In my opinion, combining multiple URLs would be an up-level functionality, which is not suitable to be implemented here. However, I think there still are two things I can do:
Check the input: If the amount of characters is over 200, then throw an exception. This would be updated in next release 0.0.2
.
Add an example to deal with long characters, as same as "Google Translate" do in their website. Thus, the user can reference the sample codes.
Thanks for your great suggestion, and hope you would like it. 👍 Leon
Library has been upgraded to 0.0.2
An example for long characters: https://github.com/zlargon/google-tts/blob/master/example/long-english-characters.js
Any text that is over 200 characters returns a URL that just 404's.