Signal Processing
Back to Portal
Maple's SignalProcessing package offers tools for FFTs, DFTs, wavelet analysis, IIR and FIR filters, signal generation, spectrograms and more.
Example - Identifying Signal Frequencies from a Spectrogram and Periodogram
withSignalProcessing:
Here, we will identify the frequencies of an artificially generated signal. The signal will be a sum of two sinusoids with frequencies of 12 Hz and 24 Hz.
N≔210:samplingRate≔100:signal≔VectorN,i↦sin12.⋅2⋅π⋅isamplingRate+1.5⁢sin24.⋅2⋅π⋅isamplingRate,datatype=float8:
Plot the spectrogram and periodogram
Spectrogramsignal,samplerate=samplingRate,size=1000,200
Periodogramsignal,samplerate=samplingRate,size=1000,200
The spectrogram and power spectrum correctly identifies the two frequencies used to generate the original data.
Example - Filtering Audio
First import the audio
file≔cat⁡kernelopts⁡datadir,//audio//MapleSimMono11025.wav
originalSpeech≔AudioTools:-Read⁡file
originalSpeech≔?
samplingRate≔attributesoriginalSpeech1
samplingRate≔11025
Spectrogram⁡originalSpeech,size=1000,200,reduceplot=1
Periodogram⁡originalSpeech,size=1000,200,reduceplot=4
Now let's apply a Butterworth filter to the audio. Define the critical frequency, generate the filter taps, and apply the filter.
fc≔800
taps≔GenerateButterworthTaps9,fcsamplingRate,filtertype=lowpass;filteredSpeech≔InfiniteImpulseResponseFilter⁡originalSpeech,taps
Then generate the spectrogram and periodogram
Spectrogram⁡filteredSpeech,samplerate=samplingRate,size=1000,200,reduceplot=1
Periodogram⁡filteredSpeech,samplerate=samplingRate,size=1000,200
You can also export the filtered audio
#A≔AudioTools:-CreatefilteredSpeech,rate=11025;#AudioTools:-WriteIIRtest.wav,A
Applications
Identifying Periodicity of Sunspots
Signal Denoising
FIR and IIR Filters
Apply Filters to Audio
Spectrogram Examples
Download Help Document