如何解决如何与 Porcupine 一起使用语音识别
任何人都可以帮助我了解如何使用语音识别在豪猪醒来后立即收听。我们需要弄清楚如何阻止豪猪经理听麦克风,直到完成语音识别。
try {
Log.i("YOU SAID IT!","yesss");
porcupineManager = new PorcupineManager.Builder()
.setKeyword(Porcupine.BuiltInKeyword.JARVIS)
.setSensitivity(0.7f).build(
getApplicationContext(),(keywordIndex) -> {
// This is where I need to somehow stop so that I can trigger speech recognition to listen
numUtterances++;
PendingIntent contentIntent = PendingIntent.getActivity(
this,new Intent(this,MainActivity.class),0);
final String contentText = numUtterances == 1 ? " time!" : " times!";
Notification n = new NotificationCompat.Builder(this,CHANNEL_ID)
.setContentTitle("Wake word")
.setContentText("Detected " + numUtterances + contentText)
.setSmallIcon(R.drawable.ic_launcher_background)
.setContentIntent(contentIntent)
.build();
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
assert notificationManager != null;
notificationManager.notify(1234,n);
});
porcupineManager.start();
} catch (PorcupineException e) {
Log.e("PORCUPINE",e.toString());
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。