Flanging is performed by taking the original copy of the signal and adding it to a time delayed version of itself. However, this effect differs from reverb, which is just adding a signal to a time-delayed version of itself with a set delay, because the delay gradually changes and is usually determined with a low frequency oscillator. Flanging is a type of phasing, which is where a signal is filtered with an all-pass filter with a non-linear phase responce. The phasing effect can be easily observed in the spectrogram of the signal.
Spectrogram of a Guitar Chord |
---|
Spectrogram of a Guitar Chord after Flanging |
---|
As for the actual Matlab implementation of flanging, Stephen G. McGovern had already created an implementation, and because the main point of this project is not to create guitar effects, but to implement adaptive guitar effects.
This is Stephen G. McGovern's (slightly modified) code:
function [y]=flanger(fs, y, wet) v = 0.002; r = 0.5; orig = y; %[y] = flange(fs, v, x, r) % % This is a basic flanging effect. % % fs = Sample rate % v = Variation. % x = Input audio signal. This should be a column % vector. % r = Rate. % % Example: % % >>y = flange(fs,0.002,x,0.5); % % % See also WAVREAD and SOUND % %Version 1.0 %Coded by: Stephen G. McGovern, date: 08.03.03 md= ceil(v*fs); n=1:length(y)+md; v=round(v*fs); z=zeros(md,1); m=max(abs(y)); y=[z;y;z]; rr=2*pi/round(fs*r); b=round((v/2)*(1-cos(rr.*n))); y=y(n+md)+y(n+md-b); m=m/max(abs(y)); y=m*y; y = y(1:length(orig)); y = wet * y + (1 - wet) * orig;
This is the only thing that cannot be immediately converted into real time. In order to do that, another implementation using circular buffer would be needed.
0 comments:
Post a Comment