Separating Morse code from a music signal
7 次查看(过去 30 天)
显示 更早的评论
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!
0 个评论
采纳的回答
Star Strider
2016-11-13
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!