creating the chorus effect without using a loop

8 visualizzazioni (ultimi 30 giorni)
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 Commenti
Paul
Paul il 15 Nov 2022
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 il 15 Nov 2022
Thank you, I fixed this but still no luck in obtaining the desired result.

Accedi per commentare.

Risposta accettata

Mathieu NOE
Mathieu NOE il 15 Nov 2022
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 Commenti

Accedi per commentare.

Più risposte (1)

jibrahim
jibrahim il 15 Nov 2022
Damien, Audio Toolbox has a Chorus object that might be helpful. See audiopluginexample.Chorus here.
It is used in this example.
  1 Commento
Damien
Damien il 15 Nov 2022
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

Accedi per commentare.

Categorie

Scopri di più su Audio I/O and Waveform Generation in Help Center e File Exchange

Prodotti


Release

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by