I\'m trying to build an app that takes a streamed audio input (eg: a line in microphone) and does Speech-to-Text using IBM Bluemix (Watson).
I briefly modified the e
The issue was fixed in the 3.0.0-RC1
version.
You can get the new jar from:
Maven
<dependency>
<groupId>com.ibm.watson.developer_cloud</groupId>
<artifactId>java-sdk</artifactId>
<version>3.0.0-RC1</version>
</dependency>
Gradle
'com.ibm.watson.developer_cloud:java-sdk:3.0.0-RC1'
JAR
Download the jar-with-dependencies(~1.4MB)
Here is an example of how to recognize a flac audio file using WebSockets
SpeechToText service = new SpeechToText();
service.setUsernameAndPassword("<username>", "<password>");
FileInputStream audio = new FileInputStream("path-to-audio-file.flac");
RecognizeOptions options = new RecognizeOptions.Builder()
.continuous(true)
.interimResults(true)
.contentType(HttpMediaType.AUDIO_FLAC)
.build();
service.recognizeUsingWebSocket(audio, options, new BaseRecognizeCallback() {
@Override
public void onTranscription(SpeechResults speechResults) {
System.out.println(speechResults);
}
});
}
FLAC file to test: https://s3.amazonaws.com/mozart-company/tmp/4.flac
NOTE: 3.0.0-RC1
is a release candidate. We will do a production release next week (3.0.1
).