博客
关于我
【信号处理】语音信号频谱分析仪matlab源码
阅读量:271 次
发布时间:2019-03-01

本文共 6719 字,大约阅读时间需要 22 分钟。

一、简介

语音信号处理技术是语音处理领域中新近发展起来的一个学科分支,而频谱分析技术是进行语音信号处理的基础。DFT及FFT变换是进行数字信号频谱分析的重要方法。DFT是FFT的基础, FFT是DFT的快速算法。MATLAB是一个数据分析和处理功能十分强大的工程实用软件,运用它来进行语音信号的采集、分析和处理相当方便。本文介绍了在MATLAB环境中如何采集声音信号和采集后的频谱分析方法,并使用MATLAB软件的GUI模块,设计了一个简易的声音信号频谱分析仪。

1 概述
随着信息时代和数字世界的到来,数字信号处理己成为当今一门极其重要的学科和技术领域,数字信号处理在通信、语音、图像、自动控制、医疗和家用电器等众多领域得到了广泛的应用。任意一个信号都具有时域与频域特性,信号的频谱完全代表了信号,因而研究信号的频谱就等于研究信号本身。通常从频域角度对信号进行分析与处理,容易对信号的特性获得深入的了解。因此,信号的频谱分析是数字信号处理技术中的一种较为重要的工具。
声卡是计算机最基本的配置硬件之一,价格便宜,使用方便。MATLAB工具箱集成了一些语音处理功能函数。本文将给出基于声卡与MATLAB的声音信号频谱分析仪的设计原理与实现方法。
2 设计原理
频谱分析用傅立叶变换将波形x(t)变换为频谱X(f),从另一角度来了解信号特征。常见傅里叶变换有DFT和FFT。DFT是FFT的基础, FFT是DFT的快速算法,在MATLAB中可以利用函数fft来计算序列的离散傅里叶变换DFT。FFT是时域和频域转换的基本运算。
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

二、源代码

function varargout = SpectrumAnalysis(varargin)% SPECTRUMANALYSIS MATLAB code for SpectrumAnalysis.fig%      SPECTRUMANALYSIS, by itself, creates a new SPECTRUMANALYSIS or raises the existing%      singleton*.%%      H = SPECTRUMANALYSIS returns the handle to a new SPECTRUMANALYSIS or the handle to%      the existing singleton*.%%      SPECTRUMANALYSIS('CALLBACK',hObject,eventData,handles,...) calls the local%      function named CALLBACK in SPECTRUMANALYSIS.M with the given input arguments.%%      SPECTRUMANALYSIS('Property','Value',...) creates a new SPECTRUMANALYSIS or raises the%      existing singleton*.  Starting from the left, property value pairs are%      applied to the GUI before SpectrumAnalysis_OpeningFcn gets called.  An%      unrecognized property name or invalid value makes property application%      stop.  All inputs are passed to SpectrumAnalysis_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 SpectrumAnalysis% Last Modified by GUIDE v2.5 02-Nov-2011 15:49:23% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name',       mfilename, ...                   'gui_Singleton',  gui_Singleton, ...                   'gui_OpeningFcn', @SpectrumAnalysis_OpeningFcn, ...                   'gui_OutputFcn',  @SpectrumAnalysis_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 SpectrumAnalysis is made visible.function SpectrumAnalysis_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 SpectrumAnalysis (see VARARGIN)% Choose default command line output for SpectrumAnalysishandles.output = hObject;xlabel(handles.axes1,'Time (s)','fontweight','bold');xlabel(handles.axes2,'Freqency (Hz)','fontweight','bold');xlabel(handles.axes3,'Freqency (Hz)','fontweight','bold');ylabel(handles.axes1,'Amplitude','fontweight','bold');ylabel(handles.axes2,'Amplitude','fontweight','bold');ylabel(handles.axes3,'Amplitude','fontweight','bold');% Update handles structureguidata(hObject, handles);% UIWAIT makes SpectrumAnalysis wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = SpectrumAnalysis_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;function edit_Fs_Callback(hObject, eventdata, handles)% hObject    handle to edit_Fs (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 edit_Fs as text%        str2double(get(hObject,'String')) returns contents of edit_Fs as a double% --- Executes during object creation, after setting all properties.function edit_Fs_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit_Fs (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');endfunction edit_TestA_Callback(hObject, eventdata, handles)% hObject    handle to edit_TestA (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 edit_TestA as text%        str2double(get(hObject,'String')) returns contents of edit_TestA as a double% --- Executes during object creation, after setting all properties.function edit_TestA_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit_TestA (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');endfunction edit_TestF_Callback(hObject, eventdata, handles)% hObject    handle to edit_TestF (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 edit_TestF as text%        str2double(get(hObject,'String')) returns contents of edit_TestF as a double% --- Executes during object creation, after setting all properties.function edit_TestF_CreateFcn(hObject, eventdata, handles)% hObject    handle to edit_TestF (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

三、运行结果

在这里插入图片描述

四、备注

完整代码或者代写添加QQ1575304183

往期回顾>>>>>>

转载地址:http://qdgx.baihongyu.com/

你可能感兴趣的文章
nginx配置域名和ip同时访问、开放多端口
查看>>
Nginx配置好ssl,但$_SERVER[‘HTTPS‘]取不到值
查看>>
Nginx配置如何一键生成
查看>>
Nginx配置实例-负载均衡实例:平均访问多台服务器
查看>>
Nginx配置文件nginx.conf中文详解(总结)
查看>>
Nginx配置负载均衡到后台网关集群
查看>>
ngrok | 内网穿透,支持 HTTPS、国内访问、静态域名
查看>>
NHibernate学习[1]
查看>>
NHibernate异常:No persister for的解决办法
查看>>
NIFI1.21.0_Mysql到Mysql增量CDC同步中_日期类型_以及null数据同步处理补充---大数据之Nifi工作笔记0057
查看>>
NIFI1.21.0_NIFI和hadoop蹦了_200G集群磁盘又满了_Jps看不到进程了_Unable to write in /tmp. Aborting----大数据之Nifi工作笔记0052
查看>>
NIFI1.21.0通过Postgresql11的CDC逻辑复制槽实现_指定表多表增量同步_增删改数据分发及删除数据实时同步_通过分页解决变更记录过大问题_02----大数据之Nifi工作笔记0054
查看>>
NIFI1.23.2_最新版_性能优化通用_技巧积累_使用NIFI表达式过滤表_随时更新---大数据之Nifi工作笔记0063
查看>>
NIFI从MySql中增量同步数据_通过Mysql的binlog功能_实时同步mysql数据_根据binlog实现数据实时delete同步_实际操作04---大数据之Nifi工作笔记0043
查看>>
NIFI从MySql中增量同步数据_通过Mysql的binlog功能_实时同步mysql数据_配置binlog_使用处理器抓取binlog数据_实际操作01---大数据之Nifi工作笔记0040
查看>>
NIFI从MySql中增量同步数据_通过Mysql的binlog功能_实时同步mysql数据_配置数据路由_实现数据插入数据到目标数据库_实际操作03---大数据之Nifi工作笔记0042
查看>>
NIFI从MySql中离线读取数据再导入到MySql中_03_来吧用NIFI实现_数据分页获取功能---大数据之Nifi工作笔记0038
查看>>
NIFI从MySql中离线读取数据再导入到MySql中_无分页功能_02_转换数据_分割数据_提取JSON数据_替换拼接SQL_添加分页---大数据之Nifi工作笔记0037
查看>>
NIFI从PostGresql中离线读取数据再导入到MySql中_带有数据分页获取功能_不带分页不能用_NIFI资料太少了---大数据之Nifi工作笔记0039
查看>>
nifi使用过程-常见问题-以及入门总结---大数据之Nifi工作笔记0012
查看>>