如何使用 IBM Watson websocket 接口转录存储在 android 内存中的音频文件?

How can I transcribe an audio file stored on the memory on android using the IBM Watson websocket interface?

我浏览了教程和其他问题,但没有找到关于如何 select 预先录制的音频文件的路径并将其发送到服务进行转录的文档。我在教程中遇到了这段代码

curl -X POST -u <username>:<password> --header "Content-Type: audio/flac" --header "Transfer-Encoding: chunked" --data-binary @<path>0001.flac "https://stream.watsonplatform.net/speech-to-text/api/v1/recognize?continuous=true"

我可以在目前实现了 websocket 接口的 android sdk 上做类似的事情吗?

您可以使用 Android-SDK. It's based on the Java-SDK,但它具有特定于 Android 的功能。您可以轻松地从麦克风捕获音频或从相机捕获图像。

查看示例文件夹:https://github.com/watson-developer-cloud/android-sdk/tree/master/example

我看到这个 project by mihui on Github which has a few slight modifications from the watson-developer-cloud:master. The project by mihui, in addition to the AudioCaptureThread, has a FileCaptureThread which reads bytes from the audio file and writes them to the websocket. This served my purpose of transcribing audio files. Please check this thread 了解详情。