问题描述
因此,我正在使用NAudio在C#中从头开始编写合成器.我得到了它演奏的不同频率,这很酷,但是我注意到较高的音调比较低的音调要响亮得多.是因为这种效果吗?
So I'm coding a synthesizer from scratch in C# using NAudio. I've gotten it play different frequencies, which is cool, but I notice that the higher pitches are significantly louder than the lower pitches. Is that due to this effect:
http://en.wikipedia.org/wiki/Equal-loudness_contour
或者在生成正弦波时我做错什么了吗?如果确实有必要,我将如何实现等响度等高线?
Or am I doing something wrong when I'm generating the sine wave? How would I implement an Equal-loudness contour curve if it is indeed necessary?
谢谢
我的代码:
NAudio希望缓冲区中填充有介于-1到+1范围内的浮点值以表示波形.
NAudio expects a buffer filled with floating point values in the range of -1 to +1 to represent the waveform.
生成正弦波:
buffer[n + offset] = (float)(Amplitude * Math.Sin(angle));
angle = (angle + angleIncrement) % (2 * Math.PI);
设置频率:
public double Frequency
{
set
{
angleIncrement = 2 * Math.PI * value / sampleRate;
}
get
{
return angleIncrement * sampleRate / 2 / Math.PI;
}
}
推荐答案
基于等响度轮廓控制合成器的音频幅度可能不是您想要的.
Controlling the amplitude of the audio from your synthesizer based on equal-loudness contours is probably not what you want.
理论上,您需要知道扬声器产生的绝对电平(SPL),才能选择合适的轮廓.实际上,更大的问题是当您扩展合成器以使用复杂的波形而不是仅由滤波器等处理的纯音时.等响度轮廓基于纯音,并且当您生成复杂信号时(即包含许多频率),您将需要一个响度模型来估计合成声音的响度.
In theory, you would need to know the absolute level (SPL) produced by the speakers in order to choose the appropriate contour. In practice, a bigger issue would be when you extend your synthesizer to use complex waveforms instead of merely pure tones, possibly processed by filters etc. The equal-loudness contours are based on pure tones, and when you generate complex signals (i.e. containing many frequencies) you would instead need a loudness model to estimate the loudness of your synthesized sound.
这篇关于每个频率的响度相等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!