From f1b31899729271ca318af165f075edbf0ed9a5d8 Mon Sep 17 00:00:00 2001 From: MeghajV Date: Wed, 8 Dec 2021 21:01:29 -0800 Subject: [PATCH] added function --- src/Meghaj_Echo.m | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/Meghaj_Echo.m diff --git a/src/Meghaj_Echo.m b/src/Meghaj_Echo.m new file mode 100644 index 0000000..e6792ea --- /dev/null +++ b/src/Meghaj_Echo.m @@ -0,0 +1,37 @@ +% Meghaj_Echo: input a wave (in time domain) and a frequency to induce an +% echo/lag effect to. The outputted wave amplifies frequencies above the +% cutoff and creates an echo in the frequencies below the cutoff creating +% a beat lag effect. Inspired by "muffled_effect_schluep" and lecture notes +% Works best on songs that have a clear snare line with a frequency of +% HIGH = 1000. Use on song files like "Strong-Bassline.mp3" + +% CONTRIBUTORS: +% Meghaj Vadlaputi: Function Author + + + +function y = Meghaj_Echo(x, HIGH) + len = length(x); + X = fft(x); + X = fftshift(X); %Fourier transform the input wave + Y = zeros(1, len); + + for ind = 1:len + %Multiplying the Fourier transform in frequency domain by e^jw(0.05) + %to induce a time shift of 0.05 seconds creating the "lag" effect on + %frequencies below HIGH (HIGH = 1000 works best) + %Multiplying the remaining signal by 1.25 amplifies other + %frequencies to balance + if abs(X(ind)) < HIGH + Y(ind) = X(ind) + 0.5*(X(ind)*exp(1i*ind*0.05)); + else + Y(ind) = 1.25*X(ind); + end + end + + + Y = fftshift(Y); + y = ifft(Y); + y = real(y); + +end \ No newline at end of file