Date: 2022-4-10
前言
? ? 通過Matlab語言 GUI界面實現(xiàn)語音信號的采集、預處理阶淘、時域分析栽渴、頻域分析以及倒譜分析等處理所森。
1、Matlab GUI實現(xiàn)代碼
這里僅提供了語音采集的部分代碼夯接,需要完整代碼可以QQ(2963033731)聯(lián)系我焕济。
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);%設置采樣頻率盔几、采樣位數(shù)晴弃、通道數(shù)
recordblocking(recorder,4.0);%設置聲音記錄時間為 4s
samples = getaudiodata(recorder);%存儲聲音數(shù)據(jù)“我愛你中國”
audiowrite('yuyin3.wav', samples,fs ); % 以yuyin2.wav 為文件名
uiwait(msgbox('錄音結束!'));%錄音結束對話框
handles.samples = samples; %保存語音數(shù)據(jù)
handles.fs = fs;
axes(handles.axes1);
%ee=samples(1500:2000); %選取原始文件x的第1500至2000點的語音
plot(samples,'k');title('原始語音信號');
xlabel('樣點數(shù)');ylabel('幅度');
guidata(hObject, handles);
2逊拍、實驗效果圖
1)上鞠、初始化界面:
2)預加重處理:
3)加窗處理:
4)時域分析(短時過零率):
5)頻域分析(短時頻帶方差值):
6)倒譜分析:
THE END!