Fast fourier transform in signal processing
古いコメントを表示
i know how to read a wave file using
[y,Fs] = waveread(x.wave);
and i have a good knowledge about the fast fourier in getting the frequency domain amplitudes and the magnitudes ,but in image processing, i guess it is easy to get them in sound. what i want to build is an FFT based filters that catches the frequency of 440hz of a piano note 'A' or by recording a piano piece of music then catching all the frequencies found...
i Also know that the FFT converts the time domain signal into frequency domain ... how do i catch this into Mat lab using sort of sinusoidal equations ?
Please attach any concerning links or videos that explains what helps me in details
回答 (1 件)
Star Strider
2017 年 2 月 8 日
1 投票
7 件のコメント
raymon hani
2017 年 2 月 8 日
Star Strider
2017 年 2 月 8 日
The only guide you actually need is the documentation for the functions you want to use.
The documentation for the fast Fourier transform fft (link) function will give you all the information you need to use it. Specifically pay attention to the code between the first (top) two plot figures.
This code designs a simple FIR filter that will work with fftfilt (assuming a sampling frequency of 44100 Hz)). You will use the sampling frequency returned by your wavread call:
Fs = 44100; % Sampling Frequency (Hz)
fcuts = [430 438 442 450]; % Frequency Vector (Hz)
mags = [0 1 0]; % Magnitude (Defines Passbands & Stopbands)
devs = [0.05 0.01 0.05]; % Allowable Deviations
[n,Wn,beta,ftype] = kaiserord(fcuts,mags,devs,Fs);
n = n + rem(n,2);
hh = fir1(n,Wn,ftype,kaiser(n+1,beta),'scale');
figure(1)
freqz(hh, 1, 2^14, Fs)
set(subplot(2,1,1), 'XLim', [0 500]) % Set Frequency Axis To Show 0-500 Hz
set(subplot(2,1,2), 'XLim', [0 500]) % Set Frequency Axis To Show 0-500 Hz
The plot in figure(1) demonstrates the frequency domain characteristics of the filter. It is good to always do that sort of plot so you know the filter does what you want it to do.
To do the actual filtering, use the fftfilt function as:
y_filtered = fftfilt(hh, y);
using the variables you defined and assigned in your code.
raymon hani
2017 年 2 月 17 日
Star Strider
2017 年 2 月 17 日
My pleasure.
With respect to the variables, they are copied (with necessary changes) from the documentation on kaiserord (link). Please do not replace any of them, if you want to get the 440 Hz range of your signal. That code should work with your signal just as I wrote it.
The only change you need to make to my code is to delete the ‘Fs’ assignment (unless it is the same as your ‘Fs’), since you will import ‘Fs’ from your audioread call.
To do the actual filtering, use the filtfilt function:
y_filtered = fftfilt(hh, y);
raymon hani
2017 年 2 月 17 日
Star Strider
2017 年 2 月 18 日
My code will filter the Fourier-transformed signal. The amplitude of the returned signal for any filter must be above some threshold you choose. I would run each filter (for each frequency) for every signal, and if the amplitude (or relative amplitude) is above a certain threshold, assign a position in a vector a 1, or if absent, a 0. So the vector for each song would have one entry for each note in the same location in the vector. Then I would use the Statistics and Machine Learning Toolbox knnsearch function on your vector with respect to the other vectors in you database to ‘classify’ it as being closest to the others.
This assumes that I understand your question.
raymon hani
2017 年 2 月 18 日
編集済み: raymon hani
2017 年 2 月 18 日
カテゴリ
ヘルプ センター および File Exchange で Frequency Transformations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!