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!