Varying delay on audio signal is too rapid
1 view (last 30 days)
Show older comments
Hello!
I'm trying to add a chorus effect to an audio signal. The difference equation for creating a chorus effect is: y(n) = a*x(n) + b*x(n-t(n)) So, the delay of the added signal is varying. The variance is described by this equation: t(n) = t0 + A*sin(2*pi*f*k), where f is a normalized frequency. k is an integer and likewise the function's variable.
I've created an algorithm that doesn't generate errors, but doesn't generate a chorus effect either. The problem is that t(n) is varying too quickly. A period takes just five samples. The usual value for f is 0.25. I have also used f=0.1 so the effect should have been notable. There are relations between fs, f and t0 but I cant see how to use them in a way that makes any difference - c*fs=f, 0<c<1, d*fs=t0, d element of R
function Y = chorus(X,fs)
f = 0.25;
t0 = 0.05; % 50 ms delay
tau = [zeros(size(X))];
a = 0.2; b = 0.8; % abs(a) and abs(b) should sum up to 1
A = t0*fs*0.99; % amplitude of delay variation should be below the initial delay
N = length(X)
for k = 1:N
tau(k) = round(t0*fs + A*sin(2*pi*f*k)); % values in tau have to be integers.
end
tau = [zeros(1,tau(1)) X']; % to keep index above zero
Y = [];
for k = 1:length(X)
Y = [Y a*X(k)+b*X(round(k-tau(k)))];
end
1 Comment
Answers (0)
See Also
Categories
Find more on Audio Processing Algorithm Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!