【语音识别】基于matlab GUI语音基频识别【含Matlab源码 294期】

一、简介

基于matlab GUI语音基频识别,先进行语音采样,变速、重采样。

二、源代码

unction varargout = zuoye(varargin)
% ZUOYE MATLAB code for zuoye.fig
%      ZUOYE, by itself, creates a new ZUOYE or raises the existing
%      singleton*.
%
%      H = ZUOYE returns the handle to a new ZUOYE or the handle to
%      the existing singleton*.
%
%      ZUOYE('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in ZUOYE.M with the given input arguments.
%
%      ZUOYE('Property','Value',...) creates a new ZUOYE or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before zuoye_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to zuoye_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 zuoye

% Last Modified by GUIDE v2.5 03-May-2020 17:00:59

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @zuoye_OpeningFcn, ...
                   'gui_OutputFcn',  @zuoye_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 zuoye is made visible.
function zuoye_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 zuoye (see VARARGIN)

% Choose default command line output for zuoye
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes zuoye wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = zuoye_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 selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: contents = cellstr(get(hObject,'String')) returns popupmenu1 contents as cell array
%        contents{
     get(hObject,'Value')} returns selected item from popupmenu1


% --- Executes during object creation, after setting all properties.
function popupmenu1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: popupmenu 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 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)
global x;
global fs;
global bits;
global file;
clear sound;
if nargin<1;action='initialized';end;
[fname,pname]=uigetfile('*.wav','Open Wave File');
file=[pname,fname];
[x,fs,bits]=wavread(file);       % 读入声音文件(*.wav)      
sound(x,fs);
set(handles.edit1,'string',fs); 


% --- 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 x;
global w;
global fs;
axes(handles.axes1);
N=length(x);
t=[0:1:N-1]/fs;
plot(t,x);
xlabel('时间t')
ylabel('幅值')
n=[0:N-1]';
w=2*n*pi/N;

% --- 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 x;
global w;
X=fft(x);
axes(handles.axes2);
plot(w/pi,abs(X))
axis([0,2,0,500])
xlabel('归一化')
ylabel('幅值')

% --- Executes on button press in pushbutton4.

% --- Executes on button press in pushbutton5.
function pushbutton5_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global pitch
global nFrames
axes(handles.axes2);
xt=1:nFrames;
xt=20*xt;
plot(xt,pitch)
xlim([0,3]);
axis([xt(1) xt(nFrames) 0 max(pitch)+50]);
ylabel('基音频率/HZ');
xlabel('时间');

% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global ybiansu;
global fs;
axes(handles.axes1);
N=length(ybiansu);
t=[0:1:N-1]/fs;
plot(t,ybiansu);
xlabel('时间t')
ylabel('幅值')

% --- Executes on button press in pushbutton7.
function pushbutton7_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton7 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global ybiansu;
NS=length(ybiansu);
nS=[0:NS-1]';
wS=2*nS*pi/NS;
YH=fft(ybiansu);
axes(handles.axes2);
plot(wS/pi,abs(YH))
axis([0,2,0,500])
xlabel('归一化')
ylabel('幅值')

% --- Executes on button press in pushbutton8.
function pushbutton8_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton8 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
%画重采样时域波形
global x2;
global fs;
axes(handles.axes1);
N=length(x2);
t=[0:1:N-1]/fs;
plot(t,x2);
xlabel('时间t')
ylabel('幅值')

% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
global x2;
X2=fft(x2);
NS=length(x2);
nS=[0:NS-1]';
wS=2*nS*pi/NS;
axes(handles.axes2);
plot(wS/pi,abs(X2))
axis([0,2,0,500])
xlabel('归一化')
ylabel('幅值')


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

三、运行结果

【语音识别】基于matlab GUI语音基频识别【含Matlab源码 294期】_第1张图片
【语音识别】基于matlab GUI语音基频识别【含Matlab源码 294期】_第2张图片

四、备注

完整代码或者代写添加QQ 1564658423
往期回顾>>>>>>
【信号处理】基于matlab HMM的睡眠状态检测【含Matlab源码 050期】
【信号处理】基于matlab CDR噪声和混响抑制【含Matlab源码 051期】
【信号处理】基于matlab最小二乘法解决稀疏信号恢复问题【含Matlab源码 052期】
【信号处理】基于matlab小波变换的音频水印嵌入提取【含Matlab源码 053期】
【信号处理】基于matlab ICA算法信号分离【含Matlab源码 054期】
【信号处理】基于matlab GUI界面的脉搏信号之脉率存档【含Matlab源码 237期】
【信号处理】基于matlab GUI界面的虚拟信号发生器(各种波形)【含Matlab源码 271期】
【信号处理】基于matlab GUI界面信号发生器之电子琴【含Matlab源码 272期】
【信号处理】基于matlab的数字电子琴设计与实现【含Matlab源码 273期】
【雷达通信】基于matlab的雷达数字信号处理【含Matlab源码 281期】
【雷达通信】基于matlab线性调频(LFM)脉冲压缩雷达仿真【含Matlab源码 283期】
【雷达通信】基于mtatlab距离多普勒(RD)、CS、RM算法的机载雷达成像【含Matlab源码 284期】
【雷达通信】《现代雷达系统分析与设计》大作业【含Matlab源码 285期】
【信号处理】基于matlab GUI语音信号综合处理平台【含Matlab源码 290期】
【信号处理】基于matlab GUI语音信号采集【含Matlab源码 291期】
【信号处理】基于matlab GUI语音幅度调制【含Matlab源码 292期】
【信号处理】基于matlab GUI语音合成【含Matlab源码 293期】

你可能感兴趣的:(matlab,信号处理)