Using MATLAB to judge male and female voices

Source: Internet
Author: User

(Turn from) http://wenku.baidu.com/view/1d55480fbe1e650e52ea99a3.html

%filename:manwoman.m
%different mans from Woman.
%===========================================================
Clear
% [X,fs,bits]=wavread (' D.wav ', [1 5000]); % read-in sound file (*.wav)
[X,fs,bits]=wavread (' d.wav ', [5000 10944]); % read-in sound file (*.wav)
Sound (x,fs,bits); % data converted to sound by sound card
%===========================================================
% Pause;
Data1=x (:, 1);
N=0:length (x)-1;
time=n/fs;
Subplot (3,1,1)% draw 1th Sub-graph of 2 rows 1 columns
Plot (time,data1)% with time on the horizontal axis, the data for the longitudinal axes of the drawing
Xlabel (' Time (sec) ')% label horizontal
Ylabel (' Signal level (Volts) ')% callout ordinate
Grid on% Add mesh
% Pause;
% of data collected for filtering processing
BlockSize =length (DATA1); % Calculation window function length
window = Hanning (blocksize); % Calculate Henning window function (this function is Matlab comes with)
Data2=window.*data1; % data is first added to window processing
% wp=[70,400]; %100hz--400hz
% Wp=wp*2/fs;
wp=3000*2/fs;
[B,a]=ellip (4,0.1,20,WP); % Constructed ellipse filter
Data=filter (B,A,DATA2); % to find the response of the filter after the window processing data
Subplot (3,1,2)% draw 1th Sub-graph of 2 rows 1 columns
Plot (Time,data)% with time on the horizontal axis, the data for the longitudinal axes of the drawing
Xlabel (' Time (sec) ')% label horizontal
%ylabel (' Signal level (Volts) ')% callout ordinate
Grid on% Add mesh
% Pause;
[Xmax,index]=max (DATA1);
Timewin=floor (0.015*FS);
Xwin=data1 (Index-timewin:index+timewin);
[Y,lags]=xcov (Xwin);
Subplot (3,1,3)
Plot (Lags,y)
Grid on
Ylen=length (y);
halflen= (ylen+1)/2 +30;
Yy=y (Halflen:ylen);
[Ymax,maxindex] = max (yy);
fmax=fs/(MAXINDEX+30);
Disp ([' Maximum occurred at ', Num2str (Fmax), ' Hz ')

F=fmax;
Justify=f; %hz
If justify<180%limithz The following judgment is male
Display ' Man '
Else
Display ' Women '
End

Using MATLAB to judge male and female voices

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.