我为我的吉他创建了一个失真踏板,我用高通滤镜创建了一个失真。一切都很有效,除非我注意到随着音符逐渐消失而产生这种噼啪声。
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