为什么Bluemix上的Watson文本到语音服务不适用于移动设备?对于来自服务器的输出流数据来说,这是一个常见问题吗?谢谢!
编辑: Sry,有人完全改变了我的问题。我说的是文字对语言。
发布于 2015-05-02 04:29:32
文本到语音在Android中工作,有一个可以使用的SDK。
http://watson-developer-cloud.github.io/java-wrapper/
例如,要获得所有您可以做的声音:
import com.ibm.watson.developer_cloud.text_to_speech.v1.TextToSpeech;
import com.ibm.watson.developer_cloud.text_to_speech.v1.model.VoiceSet;
TextToSpeech service = new TextToSpeech();
service.setUsernameAndPassword("<username>", "<password>");
VoiceSet voices = service.getVoices();
System.out.println(voices);其中,username和password是绑定服务时在Bluemix中获得的凭据。通过查看javadocs 这里,您可以了解更多关于文本到语音方法的信息。
它是今天发布的,我做到了,所以如果你发现任何问题,请告诉我。
发布于 2015-05-01 12:19:23
沃森语音到文本服务是一个REST。您需要从您的移动应用程序调用REST。有关REST的更多信息,请检查输出API文档。
发布于 2016-04-06 17:39:39
如果您想在iOS设备上使用沃森文本到语音,使用沃森-开发者-用于iOS的Cloud可能很方便--您可以在我的blumarek.blogspot上查看这个示例,只需在XCode 7.3+中构建一个应用程序:
步骤1.使用carthage获取所有依赖项:
(在项目根目录中创建一个文件cartfile并运行命令carthage -platform iOS)
$ cat > cartfile
# cartfile contents
github "watson-developer-cloud/ios-sdk"然后需要将框架添加到XCode项目中-检查步骤3:将SDK添加到blumareks.blogpost上的Xcode项目中。
步骤2.添加代码以调用Watson并利用AVFoundation
(不推荐AVFoundation):-不要忘记在Bluemix.net中添加沃森TTS服务,并从它获得凭据:
{
"credentials": {
"url": "https://stream.watsonplatform.net/text-to-speech/api",
"username": "<service User name>",
"password": "<password>"
}
}代码很简单:
import UIKit
//adding Watson Text to Speech
import WatsonDeveloperCloud
//adding AVFoundation
import AVFoundation
class ViewController: UIViewController {
@IBOutlet weak var speakText: UITextField!
override func viewDidLoad() {...}
override func didReceiveMemoryWarning() {...}
@IBAction func speakButtonPressed(sender: AnyObject) {
NSLog("speak button pressed, text to say: " + speakText.text!)
//adding Watson service
let service = TextToSpeech(username: "<service User name>", password: "<password>")
service.synthesize(speakText.text!)
{(data, error) in
do {
let audioPlayer = try AVAudioPlayer(data: data!)
audioPlayer.prepareToPlay()
audioPlayer.play()
sleep(10) //the thread needs to live long enough to say your text
} catch {
NSLog("something went terribly wrong")
}
}}}https://stackoverflow.com/questions/29974718
复制相似问题