【毕业设计系列】004:语音信号的采集与分析研究系统matlab GUI设计
Date: 2022-4-10
本人提供付费咨询服务并长期承接各类毕设项目以及外包项目。联系QQ: 2963033731 加Q备注:CSDN 外包
前言
通过Matlab语言 GUI界面实现语音信号的采集、预处理、时域分析、频域分析以及倒谱分析等处理。
1、Matlab GUI实现代码
这里仅提供了语音采集的部分代码,需要完整代码可以QQ(2963033731)联系我。
function varargout = Audio_Analysis_System(varargin)
% AUDIO_ANALYSIS_SYSTEM MATLAB code for Audio_Analysis_System.fig
% AUDIO_ANALYSIS_SYSTEM, by itself, creates a new AUDIO_ANALYSIS_SYSTEM or raises the existing
% singleton*.
%
% H = AUDIO_ANALYSIS_SYSTEM returns the handle to a new AUDIO_ANALYSIS_SYSTEM or the handle to
% the existing singleton*.
%
% AUDIO_ANALYSIS_SYSTEM('C`ALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in AUDIO_ANALYSIS_SYSTEM.M with the given input arguments.
%
% AUDIO_ANALYSIS_SYSTEM('Property','Value',...) creates a new AUDIO_ANALYSIS_SYSTEM or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Audio_Analysis_System_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Audio_Analysis_System_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 Audio_Analysis_System
% Last Modified by GUIDE v2.5 16-Apr-2019 19:49:16
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Audio_Analysis_System_OpeningFcn, ...
'gui_OutputFcn', @Audio_Analysis_System_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 Audio_Analysis_System is made visible.
function Audio_Analysis_System_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 Audio_Analysis_System (see VARARGIN)
% Choose default command line output for Audio_Analysis_System
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Audio_Analysis_System wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Audio_Analysis_System_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;
% --------------------------------------------------------------------
function Untitled_3_Callback(hObject, eventdata, handles) %%语音采集
% hObject handle to Untitled_3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
fs=44100;
uiwait(msgbox('开始录音!'));%开始录音对话框
recorder=audiorecorder(44100,16,1);%设置采样频率、采样位数、通道数
recordblocking(recorder,4.0);%设置声音记录时间为 4s
samples = getaudiodata(recorder);%存储声音数据“我爱你中国”
audiowrite('yuyin3.wav', samples,fs ); % 以yuyin2.wav 为文件名
uiwait(msgbox('录音结束!'));%录音结束对话框
handles.samples = samples; %保存语音数据
handles.fs = fs;
axes(handles.axes1);
%ee=samples(1500:2000); %选取原始文件x的第1500至2000点的语音
plot(samples,'k');title('原始语音信号');
xlabel('样点数');ylabel('幅度');
guidata(hObject, handles);
2、实验效果图
1)、初始化界面:
2)预加重处理:
3)加窗处理:
4)时域分析(短时过零率):
5)频域分析(短时频带方差值):
6)倒谱分析:
THE END!
本文为博主原创文章,未经博主允许不得转载。若允许转载,请注明来源https://www.cnblogs.com/SoaringLee/,否则保留追究法律责任的权利!
另外,本人提供付费咨询服务并长期承接各类毕设以及外包项目。联系QQ:2963033731。加Q备注:CNBLOG外包