我正在为我的吉他创建一个失真踏板,并使用高通滤波器创建了一个失真。一切都很好,除了当音符开始消失时我会听到这种噼啪声。
function audio = reaper(frame, drive, tone)
% Distortion pedal with high-pass filter and gain.
%
% audio = reaper(frame, drive, tone)
%
% frame: audio frame to be processed (int32)
% drive: amount of gain to apply to the filtered signal (between 0 and 10)
% tone: cuttoff frequency for high-pass filter (between 0 and 10)
%
% The reaper distortion pedal first sends the signal through a
% butterworth filter (high-pass) that sets the cutoff frequency based
% on the tone. Then the filtered frequency is multiplied by the drive
% (gain). The resulting audio frequency is returned.
% Use butterworth filter for high-pass filter
[zeros,poles,gain] = butter(1,265*((tone+(10/9))*(9/10))/(44100/2),'high'); % Tone is normalized between 1 and 10
[num,den] = zp2tf(zeros,poles,gain);
% Apply high-pass filter with gain
audio = int32(((drive+(10/99))*(99/10))*filter(num,den,double(frame))); % Drive is normalized between 1 and 100
end