I have an audio signal $g(t)$ composed by the sum of my original signal $f(t)$ and a delayed copy of itself:
$$g(t)=f(t)+f(t+\varepsilon)$$
My goal is to recover the original signal $f(t)$ knowing:
- $g(t)$ from a
.wavfile - $\varepsilon$ from a spectral view in Audacity
So now we know it is roughly equal to $55\ ms$.
I am using this method to get $f(t)$. Here is my implementation of that algoritgm with Octave:
[g_t, sample_rate] = audioread('raw_audio.wav');
epsilon = 55 / 1000; % Delay in seconds
n = (0:length(g_t)-1);
denominator = 1 + exp(-2ipin/length(g_t)epsilon)
G_fft = fft(g_t);
% Perform element-wise division
F_fft = G_fft ./ denominator.';
f_t = ifft(F_fft);
audiowrite('fixed_audio.wav', real(f_t), sample_rate);
But the resulting audio is very similar and keeps the same delay. What am I doing wrong?
Edit: fixed the code according to @Cris Luengo's suggestions in the comment section.

sample_rateequal to 1000??? And what isepsilon? Note also that'is the complex conjugate transpose, you want to use.'instead. – Cris Luengo Jul 23 '23 at 14:05epsilonis the time duration of the delay, as seen in $g(t)=f(t)+f(t+\varepsilon)$. I divide it by 1000 to transform the 55 milliseconds into 0.055 seconds. Thank you for suggesting the Wiener deconvolution, I will check it out. – nickh Jul 23 '23 at 14:10sample_rateat all.nis in units of samples, soepsilonmust be in units of samples as well, not in seconds. The FFT has no motion of seconds. – Cris Luengo Jul 23 '23 at 14:28epsilon = sample_rate * 55 / 1000but there was no audible difference in the result, but I will fix that now. About the Wiener deconvolution: since the SNR=1 and I have no sizable reference signal, I believe that this won't be a viable solution here. – nickh Jul 23 '23 at 14:31exp(-2i*pi*n/length(g_t)*epsilon), withepsilonis samples. See https://dsp.stackexchange.com/questions/509/what-effect-does-a-delay-in-the-time-domain-have-in-the-frequency-domain (you were missing the imaginary number in there!) – Cris Luengo Jul 23 '23 at 14:34exp(-2i*pi*n/length(g_t)*epsilon)I get a very loud noise: https://imgur.com/a/tMKZu2Y – nickh Jul 23 '23 at 15:09