问题描述
我的录音机应用工作,并想补充增益控制,但我不知道该怎么做。我有机会获得音频缓冲区,但我不知道如何使声音变得更大或更慢。
我看到另外一个应用程序,对来自特定范围内选择的分贝搜索栏。
I work for an audio recorder app and would like to add gain control but I don't know how to do it. I have access to audio buffer but I don't know how to make the sound louder or slower.I see another apps that have a seekBar for selecting the decibels from a specific range.
aRecorder.read(buffer, 0, buffer.length);
fWriter.write(buffer); // Write buffer to file
请告诉我,我应该怎样做来实现增益控制在我的应用程序。
Please tell me what should I do to implement gain control in my app.
感谢。
推荐答案
改变音量很简单,只要乘以某一分数所有样品。的+/-3分贝(分贝)的变化相当于2或0.5分别乘(请参见)。在输出prevent的不连续性,确保你从开始到结束平滑地改变倍增因子。
Changing the volume is simple, just multiply all the samples by some fraction. A change of +/- 3dB (decibels) corresponds to multiplication by 2 or 0.5 respectively (see http://en.wikipedia.org/wiki/Decibel). To prevent discontinuities in the output, make sure that you vary the multiplication factor smoothly from beginning to end.
请参阅AudioSampleBuffer :: applyGainRamp()@
See AudioSampleBuffer::applyGainRamp() @ http://www.rawmaterialsoftware.com/api/classAudioSampleBuffer.html
这篇关于Android的 - 如何在录制时添加增益控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!