Separating Morse code from a music signal

7 visualizaciones (últimos 30 días)
Hakeem Mogambo
Hakeem Mogambo el 13 de Nov. de 2016
Comentada: Star Strider el 13 de Nov. de 2016
I have a .wav file with some Morse code mixed up with a music signal (Ride of the Valkyries). I have employed a bandpass filter to filter out the Morse code terms from 600-1000 Hz, however it still has some of the music component attached to it. I would like some advice on how to completely isolate the Morse code signal and on how to decode the message within the Morse code (manually by looking at the time-domain waveform or by code).
Here is the code: [
y,fs] = audioread('morse.wav');
% sound(y,fs);
bfil = fft(y);
n = 1000;
wn = [600 1000]/(fs/2);
[b,a] = fir1(n,wn,'bandpass')
fvtool(b,a);
f = filter(b,a,y);
afil = fft(f);
subplot(4,1,1); plot(real(bfil)); title('Frequency Response of Input Signal');
subplot(4,1,2); plot(real(afil)); title('Frequency Response of Filtered Signal');
subplot(4,1,3); plot(y); title('Original Sound Signal');
subplot(4,1,4); plot(f); title('Filtered Sound Signal');
figure
stem(f);
% sound(f,fs);
Thank you!

Respuesta aceptada

Star Strider
Star Strider el 13 de Nov. de 2016
To calculate and display the Fourier transform of your signal, see the R2015a documentation for the fft (link) function. Specifically note the code between the first (top) two plot figures.
If you already know the frequency of the Morse signal (it is classically 1000 Hz), this should be relatively straightforward. I would use a bandpass filter of 950 to 1050 Hz if the Morse signal is actually 1 kHz. Depending on your sampling frequency, you may be able to define a much more narrow passband for your filter. I don’t know what your design constraints are, specifically those imposed by your instructor. (I do not recall hearing Morse in any of my recordings of Ride of the Valkuries, since I would quite definitely have heard it, and I doubt Wagner would have included it in his score.)
Also, use the filtfilt function, not filter. See the documentation for filtfilt for details.
N0KF
  2 comentarios
Hakeem Mogambo
Hakeem Mogambo el 13 de Nov. de 2016
Thank you so much for the prompt response.I will try doing as you have mentioned..
Star Strider
Star Strider el 13 de Nov. de 2016
My pleasure.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by