开发者

VU meter implementation in iphone

I am developing an aplication for iPhone which records audio and saves that audio file. I need to create a开发者_如何学编程 UI similar to that in Voice Memo app with a VU meter. I implemented code to record audio, but I have no idea about VU meter implementation. Looking forward to a reply. Thanks in advance.


A VU meter just displays the short term amplitude of the signal on a logarithmic scale (dB). You need to continuously measure the amplitude (RMS) of the signal over a short time interval (e.g. 10 ms) and then convert the RMS magnitude to dB and update the meter display.

RMS_signal (V) = sqrt(sum(x^2) / N)

where N is the number of samples (e.g. N = 441 for a 10 ms sample at 44.1 kHz sample rate)

Magnitude (dB) = 20.0 * log10(RMS_signal) + K

where K is a calibration constant (dB offset).

You may also want to add a low pass filter to smooth out the displayed amplitude. See stackoverflow.com/questions/2167513.


You may use OpenGL based simple and easily extensible framework gl-data-visualization-view to display UV meter. You should just add GLDataVisualizationView, set visualization type as analog meter and set value to visualize.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜