How to find the frequency of a morse code (sinusoidal signal) mixed with an audio music signal from a .wav file?

16 views (last 30 days)
I have a .wav file which is a mono (1-channel) 11,025 samples per sec, 16-bits per sample which contains an audio file mixed with a morse code signal (sinusoidal wave) with unknown frequency.
I need help with writing a matlab code to determine the frequency of the sinusoidal signal and separate the morse code signal and the music signal using window filtering (fir1) and save them in two separate .wav files.
% Read project wave file
% take L-point FFT, compute magnitude, compute 20log10 of mag
% plot the 20log10 magnitude result
title('frequency domain');
xlabel('Normalized frequency(hz)');
% FIR Filter using window method

Answers (1)

Star Strider
Star Strider on 27 Nov 2022
Start with the pspectrum function to analyse the signal, using the 'spectrogram' option, or just use fft, although if the Morse signal and the music have common frequencies, fft may not be the most robust approach.
After that, a simple FIR filter is straightforward with fir1, although I usually start with kaiserord.
Star Strider
Star Strider on 28 Nov 2022
First, even for FIR filters, the filtfilt function is the best option to do the actual filtering, not filter.
The filter appears to be a lowpass filter. Consider using a bandpass filter instead if the Morse signal has a single frequency, or a restricted band of frequencies.. This will produce a cleaner result.
I always sugest analysing the filter using the freqz function to be certain it is doing what you want it to do, and has been designed correctly.
The filter itself is a separate object and is not part of the sound file. If you want to store the sound files (before and after filtering) and the filter itself, save all of them to a .mat file. Be sure to include the sampling frequency ‘Fs’ as one of the variables.
It is also possible to use audiowrite separately to store the filtered signal. You can still save the filter as a .mat file separately.
It all depensds on how you choose to approach this and what you want to do.

Sign in to comment.


Find more on Applications in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!