gpt4 book ai didi

android - 检查android中的噪音/声音

转载 作者:行者123 更新时间:2023-11-30 02:01:32 27 4
gpt4 key购买 nike

我想检测来自用户语音的声音/噪音,如果语音输入为空,它会自动停止。

为应用程序点赞 talking tom cat当有声音/语音输入时它会自动开始收听,当没有声音/语音输入时会自动停止。

任何帮助都将不胜感激,谢谢!这是我的类(class)项目

最佳答案

tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if (status != TextToSpeech.ERROR) {
tts.setLanguage(Locale.US);
}
}
});

在 onCreate 方法中检查上面的方法,然后点击按钮输入下面的代码,希望它对你有用。

String text = txtWordEnglish.getText().toString();
tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);

tts 是您的 TextToSpeech 对象,全局定义它。

任何帮助,请告诉我。

关于android - 检查android中的噪音/声音,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31376094/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com