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(-2*i*pi*n/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. $\endgroup$epsilonis 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. $\endgroup$sample_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. $\endgroup$