Processamento de Sinais
Introdução
O Maple 17 oferece novas ferramentas de processamento de sinais para a análise e manipulação de dados da freqüência e no domínio do tempo. Ela pode ser utilizada para diversas aplicações, tais como a criação de um espectrograma de fala, a remoção de ruído de sinais com chiados, e identificar a periodicidade dos dados.
Este pacote inclui ferramentas para:
- Cosseno, Fast Fourier e wavelet transforms
- Janelas Bartlett, Blackman, Kaiser, Hann e Hanning
- Correlação cruzada, autocorrelação, estatísticas de dados e upsampling/downsampling
- Filtros FIR, IIR e Butterworth
TELA TÍPICA DOS CÁLCULOS DA FOLHA DE DOCUMENTO DO MAPLE:
| > |
![with(SignalProcessing[Engine])](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_2.gif) |
Application: Imaging a Speech Spectrogram
Import Wave File and Manipulate Data into Overlapping Slices
| > |
 |
| > |

 |
| > |
 |
| > |
  |
| > |
 |
Slice the data into segments with 256 samples. Each slice has a 50% overlap with the previous slice (that is, each slice starts at the half-way point of the previous slice).
| > |
 |
| > |
 |
| > |
![sample := Matrix(samps, nTimes, proc (i, j) options operator, arrow; data[`+`(i, `*`(`/`(1, 2), `*`(`+`(j, `-`(1)), `*`(samps))))] end proc, datatype = float[8]); 1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_25.gif) |
Calculate the Spectrogram Data
Filter the data, slice by slice.
| > |
![a := `<|>`(`<,>`(seq(HannWindow(sample[() .. (), i]), i = 1 .. nTimes))); -1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_27.gif) |
Calculate FFT of time segment consecutively.
| > |
![FFTa := `<|>`(`<,>`(seq(FFT(a[i, () .. ()]), i = 1 .. nTimes))); -1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_28.gif) |
Calculate Power Spectrum of each slice consecutively.
| > |
 .. ()])), i = 1 .. nTimes))); -1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_29.gif) |
Convert spectrum into decibels.
| > |
 |
| > |
 |
Strip out the repeated data.
| > |
 |
| > |
 |
The frequencies go from 0 to half the sampling rate. Hence the frequencies are in steps of (in Hz):
| > |
 |
Scale the spectra so that the values are between 0 and 255.
| > |
 |
| > |
 |
| > |
 |
Consecutive rows represent slices in time, while columns contain the spectra at each time.
| > |
; 1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_42.gif) |
Plot the Spectrogram and Waveform
| > |
![commonPlotOpts1 := labelfont = [Helvetica], labeldirections = [horizontal, vertical]; -1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_44.gif) |
| > |
![p2 := listplot([seq([`/`(`*`(i), `*`(samplingRate)), data[i]], i = 1 .. numelems(data))], thickness = 0, gridlines, axes = boxed, labels = [](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_48.gif)
![p2 := listplot([seq([`/`(`*`(i), `*`(samplingRate)), data[i]], i = 1 .. numelems(data))], thickness = 0, gridlines, axes = boxed, labels = [](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_49.gif) |
| > |
![display(Array(`<|>`(`<,>`(p1, p2))), aligncolumns = [1])](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_50.gif) |
Application: Filtering Audio
Import Speech Sample
| > |

 |
| > |
 |
Plot Waveform and Power Spectrum
| > |
![commonPlotOpts2 := titlefont = [Helvetica, 12], labelfont = [Helvetica], labeldirections = [horizontal, vertical], axis = [gridlines = [color =](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_58.gif)
![commonPlotOpts2 := titlefont = [Helvetica, 12], labelfont = [Helvetica], labeldirections = [horizontal, vertical], axis = [gridlines = [color =](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_59.gif) |
| > |
![samplingRate := attributes(originalSpeech)[1]](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_60.gif) |
| > |
 |
| > |
 |
| > |
![fq := FFT(originalSpeech[1 .. `^`(2, 15)]); -1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_71.gif) |
| > |
 |
| > |
 |
Apply IIR Butterworth or Chebyshev Filter
Apply Filter
| > |
 |
| > |

 |
| > |
 |
View Before and After Power Spectrum and Waveform
| > |
![FFTfilteredSpeech := FFT(filteredSpeech[1 .. `^`(2, 15)]); -1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_84.gif) |
| > |
 |
| > |
 |
| > |
![plots:-display(Array(`<,>`(`<|>`(p1, p2))), view = [0 .. duration, -1 .. 1])](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_96.gif) |
Apply FIR Filter
Apply Filter
| > |
 |
| > |
 |
| > |

 |
| > |
 |
View Before and After Power Spectrum and Waveform
| > |
![FFTfilteredSpeech := FFT(filteredSpeech[1 .. `^`(2, 15)]); -1](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_104.gif) |
| > |
 |
| > |
 |
| > |
![plots:-display(Array(`<,>`(`<|>`(p1, p2))), view = [0 .. duration, -1 .. 1])](http://www.maplesoft.com/products/maple/new_features/images17/SignalProcessing/SignalProcessing_116.gif) |