I am building an android app by integrating IBM Speech-To-Text service in it and there first I am recording audio and saving it to device and then passing for conversion but while passing my audio , I am getting error as "unable to transcode data stream audio/wav -> audio/x-float-array" and I tried to give different format of audio too but getting same error for every format. Although audio getting save properly and can be listen using music player.So, please help me to get rid of this error.
Here First I recording audio using MediaRecorder and then saving it to device and then sending it for conversation but getting error and I tried using every possible audio format
fileName = getExternalCacheDir().getAbsolutePath() + "/" + "examples.wav";
try {
RecognizeOptions recognizeOptions = new RecognizeOptions.Builder()
.audio(new FileInputStream(fileName))
.contentType("audio/wav")
.model("en-US_BroadbandModel")
.build();
BaseRecognizeCallback baseRecognizeCallback =
new BaseRecognizeCallback() {
@Override
public void onTranscription
(SpeechRecognitionResults speechRecognitionResults) {
System.out.println(speechRecognitionResults);
}
@Override
public void onConnected() {
}
@Override
public void onError(Exception e) {
Log.i("Error", e.getMessage());
enableMicButton();
}
@Override
public void onDisconnected() {
enableMicButton();
}
@Override
public void onInactivityTimeout(RuntimeException runtimeException) {
}
@Override
public void onListening() {
}
@Override
public void onTranscriptionComplete() {
}
};
speechToText.recognizeUsingWebSocket(recognizeOptions,
baseRecognizeCallback);
} catch (FileNotFoundException e) {
e.printStackTrace();
}