​1 简介

随着智能化设备的广泛普及,语音信号作为智能化设备的一个重要的交互语言显得尤为重要,语音信号处理被广泛地应用在语音识别,智能控制,身份识别,智能家居等领域,MATLAB仿真软件具有强大的信号处理功能,能对语音信号进行平移,尺度变换,系统分析,时频转换和滤波等操作,文章借助MATLAB软件对语音信号进行处理,实现对语音信号的音效处理,时频分析,滤波处理等功能.

2 部分代码

function 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 EDITgui_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});endif 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 zuoyehandles.output = hObject;% Update handles structureguidata(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 structurevarargout{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 pitchglobal nFramesaxes(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% --- Executes on button press in pushbutton10.function pushbutton10_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton10 (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 pitch;global nFrames;xn=x;meen=mean(xn);xn= xn - meen;%去均值fRate=floor(40*fs/1000);%帧长40ms 一共640个点   floor不大于x的最大整数updRate=floor(20*fs/1000);%帧移20msn_samples=length(xn);%语音长度nFrames=floor(n_samples/updRate)-1; %帧数k=1;pitch=zeros(1,nFrames);%处理后基频矩阵f0=zeros(1,nFrames);%基频矩阵LF=floor(fs/500);%设置基音搜索的范围  点数HF=floor(fs/70);%设置基音搜索的范围  点数m=1;avgF0=0;for t=1:nFrames        yin=xn(k:k+fRate-1);%当前帧数据        frameSize=length(yin);        yin2=yin.*hamming(frameSize);  % 加hamming窗        cn1=rceps(yin2);        cn=cn1(LF:HF);%求倒谱        [mx_cep ind]=max(cn);%求倒谱最大值        if mx_cep > 0.08 & ind >LF%设置门限,找到峰值位置           a= fs/(LF+ind);        else            a=0;        end         f0(t)=a;        if t>2 & nFrames>3              z=f0(t-2:t);           md=median(z);%中值滤波对基音轨迹图进行平滑           pitch(t-2)=md;           if md > 0             avgF0=avgF0+md;             m=m+1;           end        else            if nFrames<=3            pitch(t)=a;            avgF0=avgF0+a;            m=m+1;           end         end     k=k+updRate;endMypitch = max(pitch);set(handles.edit2,'string',Mypitch); Myt=1/Mypitch;set(handles.edit5,'string',Myt); 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% --- Executes on button press in pushbutton11.function pushbutton11_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton11 (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 ybiansuclear sound;vv=str2double(get(handles.edit3,'String'))%读取变速的倍数N=length(x)n1=0:N-1;n2=0:vv:N-1;ybiansu=interp1(n1,x,n2,'nearest');sound(ybiansu,fs)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') returns contents of edit3 as text%        str2double(get(hObject,'String')) returns contents of edit3 as a double% --- Executes during object creation, after setting all properties.function edit3_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit3 (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 pushbutton12.function pushbutton12_Callback(hObject, eventdata, handles)% hObject    handle to pushbutton12 (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 x2;clear sound;fs2=str2double(get(handles.edit4,'String'));function edit5_Callback(hObject, eventdata, handles)% hObject    handle to edit5 (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 edit5 as text%        str2double(get(hObject,'String')) returns contents of edit5 as a double% --- Executes during object creation, after setting all properties.function edit5_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit5 (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

3 仿真结果

4 参考文献

[1]周代勇, 曾妍萍, 蔡燕. 基于Matlab的语音识别端点检测算法研究与实现[J]. 内江科技, 2013, 34(9):2.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

代码

【语音处理】基于matlab实现语音基频检测相关推荐

  1. 语音端点检测 matlab 论文,基于MATLAB的语音端点检测

    求助,哪位高手帮忙看看以下程序全不? 基于Matlab编写的语音端点检测程序 function [x1,x2] = vad(x) %幅度归一化到[-1,1] x = double(x); x = x ...

  2. matlab 共振峰检测,基于matlab的语音共振峰的估计.doc

    基于matlab的语音共振峰的估计.doc 题目基于MATLAB的语音共振峰的估计英文题目MATLABBASEDESTIMATESOFANTS院系电子工程学院专业通信工程姓名年级二零零六级指导教师武良 ...

  3. 《数字语音处理》- 1. 基于MATLAB的语音信号时域特征分析

    声明 本文仅在CSDN发布,其他均为盗版.请支持正版! 正版链接: https://blog.csdn.net/meenr/article/details/117629753 基于MATLAB的语音信 ...

  4. 共振峰检测matlab百度文库,毕业设计论文-基于MATLAB的语音共振峰的估计.doc

    毕业设计论文-基于MATLAB的语音共振峰的估计 题 目: 基于MATLAB的语音共振峰的估计 英文题目: MATLAB-BASED ESTIMATES OF FORMANTS 院 系: 电子工程学院 ...

  5. 判断清浊音 matlab,基于MATLAB的语音信号的清浊音分析.doc

    基于MATLAB的语音信号的清浊音分析 目录 1 语音信号概述1 1.1 语音信号的基本组成1 1.2 语音信号的"短时谱"1 1.3 基音周期2 1.4 短时分析技术2 2 语音 ...

  6. Matlab语音采集与读写程序,基于MATLAB的语音信号录制采集和分析的程序设计

    理 论广 角 ● I 基于 MATLAB的语音信号录制采集和分析的程序设计 刘 晓炯 (西北民族大学电气工程学院 甘肃 兰州I 730030) [摘 要]语音信号处理技术是语音处理领域中新近发展起来的 ...

  7. 基于matlab语音增强,基于MATLAB的语音增强系统的设计

    187 2010 年第 05 期,第 43 卷 通 信 技 术 Vol.43,No.05,2010 总第 221 期 Communications Technology No.221,Totally ...

  8. 基于matlab的语音信号去噪毕业论文,MATLAB的FIR数字滤波器语音信号的去噪研究和仿真...

    摘要:语音信号作为人类语言交流的重要手段,语音处理的质量直接影响人们的正常通信.本文基于MATLAB对语音信号及加噪信号进行时域和频域分析,设计了FIR数字滤波器,完成对加噪信号滤波的处理.结果表明设 ...

  9. 去除噪声 matlab 论文,基于MATLAB的语音去噪开题报告

    基于MATLAB的语音去噪开题报告 毕业设计(论文)开题报告 基于MATLAB的语音去噪 综述国内外对本课题的研究动态,说明选题的依据和意义 20世纪60年代中期形成的一系列数字信号处理的理论和算法, ...

最新文章

  1. 一线互联网常见的14个Java面试题,你颤抖了吗程序员
  2. 为什么很多人喜欢把软件装在D盘,而不是系统盘C
  3. 最先进的NAS算法不如随机搜索,瑞士学者研究结果让人吃惊,也令人怀疑
  4. 人工智能助力生命科学新发展 | 飞桨博士会第十一期
  5. 下一个嵌入式大神,就是你。
  6. html标题前色块,CSS轻松实现色块标题标识
  7. 前端学习(2390):登录模块介绍
  8. 后宫宛如传服务器维护,合服丨《后宫宛如传》合服公告
  9. React v16版本 源码解读
  10. eclipse中outline中图标含义
  11. 12_统计学习方法总结
  12. 埃博拉疫情蔓延在进行中
  13. mysql数据库下载和创建
  14. Ubuntu14.04上安装Jupyter的方法
  15. 测试人员代码走查基础要点
  16. 【UVM基础】+uvm_set_verbosity 使用介绍
  17. 常见的网络摄像机方案
  18. 直播APP软件开发,直播系统开发的技术架构揭秘
  19. 几种不同的方式用Python连接数据库
  20. 从前端技术到体验科技(附演讲视频)

热门文章

  1. 统计学基础--数据基础
  2. python学习笔记(二)流程
  3. DirectDraw用法
  4. Unity Texture2D图片转换成image
  5. linux文件的三个时间atime,mtime,ctime以及查找和修改方法
  6. dota自定义机器人队友_DOTA2 7.00版本三大英雄模型重制 添加自定义机器人
  7. performClick();
  8. 定制 WebBrowser (Part 1)
  9. unity中事件分发系统 EventDispatcher
  10. Android操作系统中11种传感器的介绍【转】