function varargout = untitled(varargin)
% UNTITLED MATLAB code for untitled.fig
% UNTITLED, by itself, creates a new UNTITLED or raises the existing
% singleton*.
%
% H = UNTITLED returns the handle to a new UNTITLED or the handle to
% the existing singleton*.
%
% UNTITLED('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in UNTITLED.M with the given input arguments.
%
% UNTITLED('Property','Value',...) creates a new UNTITLED or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before untitled_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to untitled_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help untitled
% Last Modified by GUIDE v2.5 23-Apr-2018 16:20:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @untitled_OpeningFcn, ...
'gui_OutputFcn', @untitled_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before untitled is made visible.
function untitled_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to untitled (see VARARGIN)
% Choose default command line output for untitled
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes untitled wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = untitled_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
%clc
%clear variables
%close
global file
global Group2
Tw = 25; % analysis frame duration (ms)
Ts = 10; % analysis frame shift (ms)
alpha = 0.97; % preemphasis coefficient
R = [ 300 3700 ]; % frequency range to consider
M = 20; % number of filterbank channels
C = 13; % number of cepstral coefficients
L = 22; % cepstral sine lifter parameter
fs = 16000;
% hamming window (see Eq. (5.2) on p.73 of [1])
hamming = @(N)(0.54-0.46*cos(2*pi*[0:N-1].'/(N-1)));
% Read speech samples, sampling rate and precision from file
N=10;
path = 'Validation_test_set';
file = dir(path);
file(1:2) = [];
speech=zeros(N*16000,16);
speech2=zeros(N*16000,16);
samples = [1,N*16000];
N_P=14;
for i = 1:length(file)
str=strcat('Validation_test_set','\',file(i).name);
speech(:,i) = audioread(str,samples);
speech2(:,i) = audioread(str,(samples+[N_P*16000,N_P*16000]));
end
MFCCS=zeros(10000,16);
MFCCS2=zeros(10000,16);
% Feature extraction (feature vectors as columns)
for i2 = 1:length(file)
[ mfccs, FBEs, frames ] = ...
mfcc( speech(:,i2), fs, Tw, Ts, alpha, hamming, R, M, C, L );
CC=mfccs(:);
MFCCS(1:length(CC),i2)=CC;
[ mfccs2, FBEs2, frames2 ] = ...
mfcc( speech2(:,i2), fs, Tw, Ts, alpha, hamming, R, M, C, L );
CC2=mfccs2(:);
MFCCS2(1:length(CC),i2)=CC2;
end
TrainData =MFCCS;
Group=[0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 ];
Group2=zeros(size(Group));
SVMStruct = svmtrain(TrainData,Group); % train
for i3 = 1:length(file)
TestData = MFCCS2(:,i3)';
Group2(1,i3) = svmclassify(SVMStruct,TestData); % test
end
ACC=(16-sum(xor(Group2,Group)))/16;
set(handles.edit1,'string',ACC);
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global filep
global filename
[filename,filepath]=uigetfile('*.wav','打开文件');%gui中打开文件
filep=strcat(filepath,filename);
%filep
% [filex,fs]=audioread(filep);
% sound(filex,fs);
set(handles.edit2,'string',filename);
function edit2_Callback(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit2 as text
% str2double(get(hObject,'String')) returns contents of edit2 as a double
% --- Executes during object creation, after setting all properties.
function edit2_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function edit1_Callback(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global filename
global file
global Group2
for i=1:16
if filename==file(i).name
if Group2(1,i)==1
set(handles.edit3,'string','male');
else if Group2(1,i)==0
set(handles.edit3,'string','female');
else
set(handles.edit3,'string','false');
end
end
end
end
function edit3_Callback(hObject, eventdata, handles)
% hObject handle to edit3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') re
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论





















收起资源包目录
























共 21 条
- 1
资源评论

- qq_422173342021-05-06主程序函数,不会用
- 好烦啊真的2019-06-11什么啊……不能用qq_411458362019-06-11在当前文件夹下直接运行主程序untitle.m
- twoyoung1232019-02-23这个怎么用啊qq_411458362019-06-11在当前文件夹下直接运行主程序untitle.m,不会用就直接给一星?
- qq_261224372018-12-19你这个算法判别男性女性不是根据名字来的吗,我把M1改成了F1,然后结果也跟着改变,这代码肯定有问题qq_411458362019-06-11就8个训练样本,正确率只能到达这样了,这个只是个简单的小程序而已,可以根据自己需要修改
- luo200708104182018-07-02SVM算法怎么比较多个时间段的二维数据呢?qq_411458362019-06-11语音数据预处理时提取某一时间段

qq_41145836
- 粉丝: 6
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 右岸地下厂房进水口1310m以上开挖支护技术方案-secret.doc
- [成都]高层现代风格办公综合体建筑设计方案(含住宅、商业建筑).pdf
- 2号栋北钢筋混凝土挡土墙施工方案.doc
- 业务外驻管理规定(最新版2009-2-18).doc
- 球罐组装几何尺寸报告.doc
- 北京某小区工程测量施工方案.doc
- 3.29项目成员工作周报.doc
- 财务管理-01.ppt
- 家庭教育指导工作计划.doc
- [北京]高层办公楼防水工程施工工艺.doc
- 简洁实用的目标检测操作界面平台
- 注册公用设备工程师(暖通)考试模拟题及答案(三).doc
- 基于计算机网络技术的医院信息化建设发展.docx
- 《建筑结构抗震设计》课后习题全解(王社良版).doc
- 定期考绩汇总表.doc
- 成都某超高层工程临时用水方案.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
