在录音机的理解阅读()缓冲区 [英] Understanding of the Audio Recorder read() buffer

查看:165
本文介绍了在录音机的理解阅读()缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的希望有人能帮助我。我目前正在与Android的录音机的工作,一切工作正常。下一步将与我从缓冲区回来的时候我打电话给字节工作阅读()

I really hope someone could help me. I am currently working with the Android "Audio Recorder" and everything works fine. The next step would be to work with the bytes I got back from the buffer when I called read().

作为一个Web开发的戒烟一段时间,我缺少一些基本的 - 主要是关于存储在那里的​​字节数。我真的想明白了,什么的字节是我从后面的方法。这真的好像我需要一些基础知识,主要是如何分析存在的东西(我想看看是否有任何声多么响亮它不仅code,我真的想了解个究竟那里)。

Being a Web Developer for quit some time, I lack some basics - mostly about the bytes stored in there. I would really like to understand, "what" the bytes are I got back from the method. It really seems I need some fundamentals, mostly how to analyse the stuff in there (I want to find out if there was any sound and how loud it was and not only code, I really want to understand what happens there).

会有人这么好心给我链接文章/博客/书籍我能读以获得有关此音频分析一些更多的知识?

Would someone be so kind to give me links to articles/blogs/books I could read to gain some more knowledge about this audio analysing?

推荐答案

在我的经验,在Android AudioRecorder不能很好地在许多平台上的字节工作。因此,设置您的刻录机为记录16位,并使用与读取短阵。

In my experience the Android AudioRecorder doesn't work well with bytes on many platforms. So set your recorder up to record 16-bit and use the read with a short array.

但是,从有其相当复杂,解释什么实际的价值重新present。你得到的音频脉冲code调制(PCM,你可能已经听说过)。这意味着你有一个固定的采样率(比如8000Hz的),您会收到幅度每1 /第八千。随着时间的推移,这些幅度高达形成的波形,你可能熟悉。短数组中的值是这种幅度。

But from there its quite complicated to explain what the actual values represent. The audio you get is Pulse Code Modulated (PCM which you have probably heard of). This means that you have a fixed sample rate (say 8000Hz) and every 1/8000th you receive an amplitude. Over time these amplitudes form up the wave form that you are probably familiar with. The values in the short array are this amplitude.

如果您熟悉喇叭是如何工作的,你会知道,一个磁铁向前和向后推隔膜。你再presents值多远向前或向后隔膜移动(瞬时幅度)。所以在短阵重新32767 presents完全向前,再-32768 presents完全向后。 0直接在两者之间,这是当它关闭时,喇叭会坐在状态。

If you are familiar with how a speaker works you will be aware that a magnet pushes a diaphragm forwards and backwards. The value you get represents how far forward or backwards the diaphragm is moved (The instantaneous amplitude). So in the short array 32767 represents fully forward and -32768 represents fully backwards. 0 is directly in between and this is the state the speaker will sit in when it is turned off.

要在您需要向前或向后移动振膜扬声器例如产生声音。要创建一个50Hz的信号隔膜需要向前向后50次。要创建它需要向前向后1000次第二,因此在1000Hz的信号。这些信号可以加入,共同创造更复杂的信号。

To produce sound in the speaker example you need to move the diaphragm forwards and backwards. To create a 50Hz signal the diaphragm needs to move forward to backward 50 times a second. To create a 1000Hz signal it needs to move forward to backward 1000 times a second and so on. These signals can be added together to create more complex signals.

要添加更多的复杂性给它。与短的值,在具有65536离散位置的扬声器振动膜片可以移动到。这是模拟和数字音频之间的根本区别。有隔膜的位置在一个真正的模拟录音无限多,其中数字是量化。

To add more complexity to it. With the short values you have 65536 discrete positions the speaker diaphragm can be moved to. This is a fundamental difference between analogue and digital audio. There is an infinite number of positions of the diaphragm in a truly analogue recording where as digital is "quantised".

那是一个非常基本的解释,因为任何事情更复杂真的是出了一个计算器响应范围。还有更多的负载可以在维基百科和其他来源读取。这里有几个维基百科的链接,以帮助您入门:

Thats a very basic explanation, as anything more complex really is out of scope of a stackoverflow response. There is loads more you can read on wikipedia and other sources. Here are a couple of wikipedia links to help you get started:

http://en.wikipedia.org/wiki/PCM
<一href=\"http://en.wikipedia.org/wiki/Quantisation_(signal_processing)\">http://en.wikipedia.org/wiki/Quantisation_(signal_processing)

这篇关于在录音机的理解阅读()缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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