【发布时间】:2021-01-12 09:03:08
【问题描述】:
我关注this question在android上做离线演讲。
我下载了谷歌语音中的语言,它可以离线工作。
问题是我想知道 它当前在离线或在线语音上运行,(就像 Apple 语音转文本一样,有一个 api 可以检查)以在我的应用中正确显示语音流
我想知道有没有办法做到这一点?
这是我的代码:
val intentSpeech = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
intentSpeech.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US")
intentSpeech = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
intentSpeech.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
intentSpeech.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
RecognizerIntent.LANGUAGE_MODEL_FREE_FORM)
intentSpeech.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
packageName)
val recognizer = SpeechRecognizer.createSpeechRecognizer(this)
recognizer.setRecognitionListener(this)
P/s:我可以看到 google 的 Read Along 应用程序在离线或在线模式下都能完美运行。
我正在尝试对 android 语音 api 做同样的事情。有可能吗?
【问题讨论】:
标签: android kotlin speech-to-text