Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
您需要避免输出波形的不连续性(这些是您听到的喀哒声)。最简单的方法是使用基于 LUT 的波形发生器 - 这适用于任何周期波形(即不仅仅是纯正弦波)。通常,您使用定点相位累加器,该累加器对于每个新样本都会增加一个与当前输出频率相对应的增量值。您可以根据自己的喜好安全地修改增量,并且波形仍然是连续的。
伪代码(针对一个输出样本):
Note: to calculate
delta
for a given output frequencyf
and a sample rateFs
:You need to avoid discontinuities in the output waveform (these are the clicks you are hearing). The easiest way to do this is with a LUT-based waveform generator - this works for any periodic waveform (i.e. not just pure sine waves). Typically you use a fixed point phase accumulator, which is incremented for each new sample by a delta value which corresponds to the current output frequency. You can safely modify delta however you like and the waveform will still be continuous.
Pseudo code (for one output sample):
Note: to calculate
delta
for a given output frequencyf
and a sample rateFs
: