matlab resolves the frequency of sound files

Source: Internet
Author: User
Tags ipoint

Because the MATLAB tool integrates many algorithms. The recording learns to use Matlab to parse the sound frequency.

Ff.wav is a known sound file with a frequency of 17640HZ

Paste the code:

1%1,%[x,fs,bit]=wavread ('D:\\ff.wav');2%2, and then perform feature extraction3%3, and then the classifier identifies4%4, output recognition results5%close all;6%clear All;7[X,fs]=audioread ('D:\\ff.wav');8n=2048;9n=0: N-1;TenXk=fft (X,n); %Fast Fourier transformation of signals OneNuniquepts = Ceil ((n+1)/2); AXk = Xk (1: nuniquepts); %Select the first half, because the second half is a mirror image of the first half part -Magx=abs (XK);the amplitude after Fourier transformation is obtained -% Complete Fourier transform to add absolute abs (XK); DB value: -*log (ABS (XK)/Max (ABS (XK)).  theDdd= -*log (magx/Max (MAGX)) -IPoint =-1 ; -  forI=1: N -     ifMAGX (i) = =Max (MAGX) +IPoint =i; - I +          Break ; A End at End -%Create frequency array begin -Txbb_threshold = - ; % error Range  -Txbb_characters_num = - ; % assumes altogether 64 frequencies  -Txbb_basefrequency_h =17000; % starting frequency  -G_ffrequencies = txbb_characters_num* (0: txbb_characters_num-1) +Txbb_basefrequency_h; in%Create frequency array End -                to%Find Code table begin +K =1 ; -  forI=1: Txbb_characters_num the     ifG_ffrequencies (i)- -< Fs/n*ipoint && G_ffrequencies (i) + -> fs/n*IPoint *K =i; $          Break ;Panax Notoginseng End - End the%Find Code table end +  A%Print Results the g_ffrequencies (k) +fprintf ('k:%d.\n', k); -Disp'k:.\n');

matlab resolves the frequency of sound files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.