creating the chorus effect without using a loop

조회 수: 17 (최근 30일)
Damien
Damien 2022년 11월 14일
댓글: Mathieu NOE 2022년 11월 17일
okay so I made some progress but I am still lost and im not sure what sound I am suppose to hear back. There are not any helpful youtube videos about this topic.. but now I am hearing a static noise for about 3 seconds. Please if anyone can look at my updated code and help me out so I can see what I am doing wrong. Do it for a veteran :)
[x,Fs]=audioread('slowguitar.wav');
sound(x, Fs);
n=44100;
D=round(Fs*40e-3);
x=rand(1,n);
y=zeros(1,n);
y(1)=x(1);
y(2:n) =x(2:n)+x(n-D);
sound(y(2:n), Fs);
  댓글 수: 2
Paul
Paul 2022년 11월 15일
Hi Damien,
I don't know what the chorus effect is, so don't know how it should be implemented. If it can be explained, preferably in mathematical terms, it's likely someone could help implement it in Matlab.
In the above code, the variable x is an output from audioread, but four lines later it's overwritten with random numbers. Is that correct?
Damien
Damien 2022년 11월 15일
Thank you, I fixed this but still no luck in obtaining the desired result.

댓글을 달려면 로그인하십시오.

채택된 답변

Mathieu NOE
Mathieu NOE 2022년 11월 15일
hello
the chorus effect is basically a multiple echo effect ; the echo by itself is a delayed version of the original signal , added to it with a given amplitude (therefore you can tweak the delay and amount of the echo)
when you have understood the echo principle , apply it multiple times and here you have a chorus effect (like many people singing at different distance from the listening point, causing different delays and amplitudes)
the code below is for a wav file (attached if you want to try it) but you can easily modify it at your convenience
infile='DirectGuitar.wav';
outfile='out_chorus.wav';
% current sample is 11kHz so 0-3 ms is 0 - 33 samples
% read the sample waveform
[x,Fs] = audioread(infile);
% normalize x to +/- 1 amplitude
x = x ./ (max(abs(x)));
samples = length(x);
nb_effects = 4; % assume we do 4 delayed versions of the signal that will be summed
% amplitude is now a vector
amp = [0.7 0.7 0.7 0.7]; % suggested coefficient from page 71 DAFX; the values apply to the 4 delayed versions of x
cur_delay = [134;248;422;13]; % fixed delay case
max_samp_delay=max(cur_delay);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
y = x; % init y
for i = (max_samp_delay+1):samples
% add the amp weigthed multiple delayed x values
y(i) = x(i) + sum(amp(1:nb_effects)'.*x(i-cur_delay)); % add all 4 delayed sample (in one line !)
end
% write output
% normalize y to +/- 1 amplitude
y = y ./ (max(abs(y)));
audiowrite(outfile, y, Fs);
figure(1)
hold on
plot(x,'r');
plot(y,'b');
title('Chorus and Original Signal');
legend('Original','Chorus');
sound(y,Fs);
  댓글 수: 10
Damien
Damien 2022년 11월 17일
Thanks Bryann!
Mathieu NOE
Mathieu NOE 2022년 11월 17일
as always, my pleasure !

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

jibrahim
jibrahim 2022년 11월 15일
Damien, Audio Toolbox has a Chorus object that might be helpful. See audiopluginexample.Chorus here.
It is used in this example.
  댓글 수: 1
Damien
Damien 2022년 11월 15일
Thank you I understand the concept now and what I am suppose to hear, still working how to process the audio vector x and generate a new vector

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by