infile='DirectGuitar.wav';
outfile='out_chorus.wav';
[x,Fs] = audioread(infile);
x = x ./ (max(abs(x)));
samples = length(x);
min_time_delay=0.010;
max_time_delay=0.025;
rate=[1 0.9 0.8 0.7] ;
nb_effects = length(rate);
amp=[0.7 0.6 0.5 0.4 0.3];;
index=(1:samples)';
sin_ref = (sin(2*pi*index*(rate/Fs)))';
min_samp_delay=round(min_time_delay*Fs);
max_samp_delay=round(max_time_delay*Fs);
y = zeros(samples,1);
y(1:max_samp_delay)=x(1:max_samp_delay);
for i = (max_samp_delay+1):length(x)
cur_sin=abs(sin_ref(:,i));
cur_delay=ceil(cur_sin*max_samp_delay);
y(i) = amp(1)*x(i) + sum(amp(2:nb_effects+1)'.*x(i-cur_delay));
end
y = y ./ (max(abs(y)));
audiowrite(outfile, y, Fs);
figure(1)
hold on
plot(x,'r');
plot(y,'b');
title('Chorus and original Signal');
6 Comments
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145468
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145468
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145473
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145473
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145493
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145493
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145498
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145498
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145583
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145583
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145613
Direct link to this comment
https://in.mathworks.com/matlabcentral/answers/652453-implementing-the-chorus-effect#comment_1145613
Sign in to comment.