自动录音及​​停止时用户停止用说话声音再codeR [英] Automatically sound recording and stop when user stop speaking using audio recoder

查看:241
本文介绍了自动录音及​​停止时用户停止用说话声音再codeR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要重新code中的声音时声音一定水平的接收和停止录音机不接收声音。

I want to recode the voice when certain level of sound receive and stop audio recorder does not receive sound.

我最初使用Media记录检查,当我得到它,然后我开始通过录音机录音,但我无法阻止它,因为录音机没有任何方法来获取最大振幅最大振幅。

I am initially using Media recorder to check maximum amplitude when I get it then I start recording via audio recorder but I am unable to stop it because audio recorder have not any method to get max amplitude.

推荐答案

您应该尝试一些像这样的事情:

You should try some thing like this:

readAudio = audioRecorder.read(data16bit, 0, buffer);
double fN = (double)readAudio;

double accum = 0;
for (int i = 0; i < readAudio; i ++)
{
   accum += Math.abs((double)data16bit[i]);
}

double soundLevel = accum/fN;

然后检查soundLevel的价值,看的时候应用程序应停止录制。

Then check the value of soundLevel to see when the app should stop recording.

这篇关于自动录音及​​停止时用户停止用说话声音再codeR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆