I am implementing a morse code decoder in Octave. It already works, but not on very noisy signals, like the following:
I had the following idea to reduce the noise:
- Perform fft to find the "beep" frequency of the morse tone
- Use a bandpass filter to attenuate all other frequencies.
Unfortunately, I apparently can't do step 2. After filtering, my signal looks like this:
This shows about the first two milliseconds of the signal.
My code looks like the following. Please tell me:
whether my basic idea is promising
how to improve my code in a way that it actually does what I want
[x, f_sampling] = wavread(filename); t = fft(x); l = length(t); magnitudes = (abs(t/l))(1:l/2+1); f = f_sampling*(0:(l/2))/l; [peaks, locations] = findpeaks(magnitudes); [maximum,index] = max(peaks); f_main = f(locations(index)) f_cutoff = [0.1 0.9]*2*f_main/(f_sampling) [b, a] = cheby1(20, 1, f_cutoff); y = x / max(x); y = filter(b, a, x);