你知道机器人自由还提供了免费举办 论坛 为自己的网站或移动应用程序?
Bot Libre Forum

Have any support for text to speech on Java/Android library?

通过 shahin0690 发布 Apr 27 2016, 0:45

After investigation of javascript api I found SDK.tts() API which supports for text to speech. Have any API like this for Java/Android/iOS SDK? Additionally, can I know the purpose and usage of getVoice() API of SdkConnection class of Andoid SDK? Thanks in advance.


by admin posted Apr 27 2016, 6:57

All of the SDKs use the same web API, so if the SDK is missing something you can just call the web API directly.

We will be updating the Android and Java SDKs soon to support more of the web API.

For now you can call the web API directly through your SDKConnection class. POST is protected correctly, so you can subclass SDKConnection with your own subclass to add a method.

public String tts(Speech config) { config.addCredentials(this); return POST(this.url + "/speak", config.toXML()); }

Where Speech is,

public class Speech extends Config { public String text; public String voice; public String toXML() { StringWriter writer = new StringWriter(); writer.write("<speech"); writeCredentials(writer); if (this.text != null) { writer.write(" text=\"" + this.text + "\""); } if (this.voice != null) { writer.write(" voice=\"" + this.voice + "\""); } writer.write("/>"); return writer.toString(); } }

Updated: Apr 27 2016, 6:59
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1175, today: 0, week: 0, month: 5

Id: 12631770
标签: android, avatars, test
发布: Apr 27 2016, 0:45
答复: 1
的风景: 1280, 今天: 1, 周: 2, 一个月: 7
我敢肯定
标志后的进攻,或者在违反规则网站