Question on generating echo effect
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Saisruthi Bandla
am 29 Feb. 2020
Beantwortet: Thiago Henrique Gomes Lobato
am 1 Mär. 2020
How do I create a function that will add an echo effect to the audio signal? The function should take in the sound vector, sampling frequency, delay in seconds, and echo amplitude. The function should return a vector containing the echoed sound.
The function must:
(a) Take in the audio vector and sampling frequency, delay and echo gain.
(b) Convert the delay in seconds to number of samples: delaySamples = Fs * delay;
(c) Figure out a way to add a delayed version of the signal vector to the original audio vector: delaySamples tells you how many elements the offset needs to be. echoGain sets the amplitude of the echo signal (0.5 = 50% amplitude, 1 = 100% amplitude, 1.5 = 150% amplitude, etc.) to be added.
(d) Return the new version of your audio vector:
Then, play the new version of the audio vector.
What I have so far is:
function [audioVecEcho] = audioEcho(audioVec, Fs, delay, echoGain)
So far, this is what I have for the function:
function [eSound]=audioEcho( audioVec, Fs, delay,echoGain)
delaySamples= round(Fs * delay);
echoGain=echoGain*audioVec;
y=[audioVec,Fs];
eSound=y + [zeros(delaySamples-1, 1); y(delaySamples:end)];
end
It doesn't seem to work though. Please help me!
0 Kommentare
Akzeptierte Antwort
Thiago Henrique Gomes Lobato
am 1 Mär. 2020
Try this
function [eSound]=audioEcho( audioVec, Fs, delay,echoGain)
delaySamples= round(Fs * delay);
delayVec = zeros(size(audioVec));
delayVec(delaySamples:end,:) = audioVec(1:end-delaySamples+1,:);
eSound = audioVec + delayVec*echoGain;
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!