Android的音频分析实时 [英] Android Audio Analysis in Real-time

查看:197
本文介绍了Android的音频分析实时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经寻找这个在线,但我仍然有点困惑(因为我,如果他们想这样的事情肯定别人会)。我想,说,这是的没有家庭作业和/或利润的以preface。

I have searched for this online, but am still a bit confused (as I'm sure others will be if they think of something like this). I'd like to preface by saying that this is not for homework and/or profit.

我想创建一个能听你的微波炉你prepare爆米花的应用程序。它将通过发出警报时,有流行音乐(说5-6秒)之间有一定的时间间隔工作。再次,这是一个简单的项目让我占用的 - 而不是一类。

I wanted to create an app that could listen to your microwave as you prepare popcorn. It would work by sounding an alarm when there's a certain time interval between pops (say 5-6 seconds). Again, this is simply a project to keep me occupied - not for a class.

无论哪种方式,我有麻烦试图找出如何分析音频摄入实时。也就是说,我需要一种方法时,啪的发生登录的时间。所以,你们不要以为我没有做任何研究这件事,我已经签出的这个,以便问题,进行了广泛搜索的<一个href=\"http://developer.android.com/reference/android/media/AudioRecord.html#read%28short%5B%5D,%20int,%20int%29\">AudioRecord功能列表。

Either way, I'm having trouble trying to figure out how to analyze the audio intake in real-time. That is, I need a way to log the time when a "pop" occurs. So that you guys don't think I didn't do any research into the matter, I've checked out this SO question and have extensively searched the AudioRecord function list.

我在想,我可能必须做一些与<一版本中的一种href=\"http://developer.android.com/reference/android/media/AudioRecord.html#read%28short%5B%5D,%20int,%20int%29\">read()然后记录的音频,每2秒左右比较一个流行的记录的音频(即,如果字节[] audioData阵列的70%以上为相同爆裂声的,然后再登录时)。任何与And​​roid的音频输入体验可以让我知道,如果我至少在正确的轨道?这不是我想要的你code东西给我一个问题,但至于我是否正确的轨道上的问题,而且,如果没有,我应该前往哪个方向来代替。

I'm thinking that I will probably have to do something with one of the versions of read() and then compare the recorded audio every 2 seconds or so to the recorded audio of a "pop" (i.e. if 70% or more of the byte[] audioData array is the same as that of a popping sound, then log the time). Can anyone with Android audio input experience let me know if I'm at least on the right track? This is not a question of me wanting you to code anything for me, but a question as to whether I'm on the correct track, and, if not, which direction I should head instead.

推荐答案

看看这个code(忽略播放部分):<一href=\"http://stackoverflow.com/questions/5728454/playing-back-sound-coming-from-microphone-in-real-time\">Playing回声音从实时麦克风的

Check out this code (ignore the playback part): Playing back sound coming from microphone in real-time

基本上想法是,你将不得不采取每个16位采样的值(其对应于波的值在那个时间)。使用采样率,可以计算峰值之间的时间在卷。我认为这可能完成你想要的。

Basically the idea is that you will have to take the value of each 16-bit sample (which corresponds to the value of the wave at that time). Using the sampling rate, you can calculate the time between peaks in volume. I think that might accomplish what you want.

这篇关于Android的音频分析实时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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