版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Dr WangZhengsheng - Lecture Notes,1,Lecture 4 MATLAB信号分析(Sound Analysis),Dr WangZhengsheng - Lecture Notes,2,Lecture 4 Matlab语音分析,基本要求 (1)掌握语音文件的创建与控制,以及语音文件的基本操作; (2)熟练掌握录制语音基本的命令和控制; (3)初步掌握用傅里叶变换来表现信号的波形和频谱。 (4)掌握坐标轴的控制和图形标注命令及其用法。,Dr WangZhengsheng - Lecture Notes,3,Lecture 4 Matlab语音分析,1.语音录制函数
2、 wavrecord Record sound using Windows audio input device. wavrecord will be removed in a future release. Use AUDIORECORDER instead. 命令格式: Y = wavrecord(N,FS,CH) records N audio samples at FS Hertz from CH number of input channels from the Windows WAVE audio device. Standard audio rates are 8000, 110
3、25, 22050, and 44100 Hz. CH can be 1 or 2 (mono or stereo). Samples are returned in a matrix of size N-by-CH. If not specified, FS=11025 Hz, and CH=1.,Dr WangZhengsheng - Lecture Notes,4,Lecture 4 Matlab语音分析,Y=wavrecord(., DTYPE) uses the data type specified by the string DTYPE to record the sound.
4、The string values for DTYPE are listed in the following table along with corresponding bits per sample and acceptable data ranges for Y. DTYPE Bits/sample Ys Data range - - - double 16 -1.0 = Y +1.0 single 16 -1.0 = Y +1.0 int16 16 -32768 = Y = +32767 uint8 8 0 = Y = 255,Dr WangZhengsheng - Lecture
5、Notes,5,Lecture 4 Matlab语音分析,Example: Record and play back 5 seconds of 16-bit audio sampled at 11.025 kHz. Fs = 11025; y = wavrecord(5*Fs, Fs, int16); wavplay(y, Fs);,Dr WangZhengsheng - Lecture Notes,6,Lecture 4 Matlab语音分析,2.语音文件生成函数 wavwrite Write Microsoft WAVE (.wav) sound file. wavwrite(Y,FS,N
6、BITS,WAVEFILE) writes data Y to a Windows WAVE file specified by the file name WAVEFILE, with a sample rate of FS Hz and with NBITS number of bits. NBITS must be 8, 16, 24, or 32. Stereo data should be specified as a matrix with two columns. 命令格式: wavwrite(Y,FS,NBITS,WAVEFILE) wavwrite(Y,FS,WAVEFILE
7、) assumes NBITS=16 bits. wavwrite(Y,WAVEFILE) assumes NBITS=16 bits and FS=8000 Hz.,Dr WangZhengsheng - Lecture Notes,7,NBITS Ys data type Ys Data range Output Format - - - - 8 uint8 0 = Y = 255 uint8 16 int16 -32768 = Y = +32767 int16 24 int32 -223 = Y = 223-1 int32 If Y contains floating point dat
8、a: NBITS Ys data type Ys Data range Output Format - - - - 8 single or double -1.0 = Y +1.0 uint8 16 single or double -1.0 = Y +1.0 int16 24 single or double -1.0 = Y +1.0 int32 32 single or double -1.0 = Y = +1.0 single,Lecture 4 Matlab语音分析,Example: Record and play back 5 seconds of 16-bit audio sam
9、pled at 11.025 kHz. Fs = 11025; y = wavrecord(5*Fs, Fs, int16); wavwrite(y, Fs, d:matlab.wav); %存储录音 wavplay(y,fs); %播放录音,Dr WangZhengsheng - Lecture Notes,9,Lecture 4 Matlab语音分析,3.语音文件读出函数 wavread Read Microsoft WAVE (.wav) sound file. Y=wavread(FILE) reads a WAVE file specified by the string FILE,
10、 returning the sampled data in Y. The .wav extension is appended if no extension is given. 命令格式: Y,FS,NBITS=wavread(FILE) .=wavread(FILE,N) .=wavread(FILE,N1 N2) Y,.=wavread(.,FMT) SIZ=wavread(FILE,size) Y,FS,NBITS,OPTS=wavread(.),Dr WangZhengsheng - Lecture Notes,10,Lecture 4 Matlab语音分析,FMT=native
11、#Bits MATLAB data type Data range - - - 8 uint8 (unsigned integer) 0 = Y = 255 16 int16 (signed integer) -32768 = Y = +32767 24 int32 (signed integer) -223 = Y = 223-1 32 single (floating point) -1.0 = Y = +1.0 FMT=double #Bits MATLAB data type Data range - - - N32 double -1.0 = Y +1.0 N=32 double -
12、1.0 = Y = +1.0 Note: Values in y might exceed -1.0 or +1.0 for the case of N=32 bit data samples stored in the WAV file.,Example: Record and play back 5 seconds of 16-bit audio sampled at 11.025 kHz. Fs = 11025; y = wavrecord(5*Fs, Fs, int16); wavwrite(y, Fs, d:matlab.wav); %存储录音 wavplay(y,fs); %播放录
13、音 %读取录音文件 y, Fs, nbits = wavread(d:matlab.wav);,Dr WangZhengsheng - Lecture Notes,12,Lecture 4 Matlab语音分析,4.语音文件播放函数 wavplay Play sound using Windows audio output device. wavplay will be removed in a future release. Use AUDIOPLAYER instead. 命令格式: wavplay(Y,FS) : sends the signal in vector Y with sam
14、ple frequency of FS Hertz to the Windows WAVE audio device. Standard audio rates are 8000, 11025, 22050, and 44100 Hz. wavplay(Y) wavplay(.,async) wavplay(.,sync),Supported data types for Y and the corresponding number of bits per sample used during playback in each format are as follows: Data Type
15、bits/sample double 16 single 16 int16 16 uint8 8,Example: Record and play back 5 seconds of 16-bit audio sampled at 11.025 kHz. Fs = 11025; y = wavrecord(5*Fs, Fs, int16); wavwrite(y, Fs, d:matlab.wav); %存储录音 wavplay(y,fs); %播放录音 %读取录音文件,Dr WangZhengsheng - Lecture Notes,15,Lecture 4 Matlab语音分析,5.傅里
16、叶变换函数 fft Discrete Fourier transform. fft(X) is the discrete Fourier transform (DFT) of vector X. For matrices, the fft operation is applied to each column. For N-D arrays, the fft operation operates on the first non-singleton dimension. 命令格式: fft(X,N) is the N-point fft, padded with zeros if X has
17、less than N points and truncated if it has more. fft(X,DIM) or fft(X,N,DIM) applies the fft operation across the dimension DIM.,Example: 对获取的语音信号进行傅里叶变换. N=length(y); %求语音信号的长度 Y=fft(y,N); %傅里叶变换,Dr WangZhengsheng - Lecture Notes,17,Lecture 4 Matlab语音分析,6.傅里叶逆变换函数 ifft nverse discrete Fourier transform. ifft(X) is the inverse discrete Fourier transform of X. 命令格式: ifft(X,N) is the N-point inverse transform. ifft(X,DIM) or ifft(X,N,DIM) is the inverse discrete Fourier transform of X across
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 湖北省黄冈市麻城市顺河镇重点达标名校2026年学业水平考试生物试题含解析
- 2026年食品与饮品行业绿色包装选型指南与合规要求
- 河北省临城县重点中学2026届初三3月质检化学试题试卷含解析
- 日照市重点名校2026年高频错题卷(五)生物试题含解析
- 2026年大班幼儿任务意识与时间观念培养方案
- 2026年612老旧小区“微更新 海绵化”省级示范项目解析
- 2026年阿蒙森海海洋生态系统关键要素调查方案
- 航空业飞行经理面试技巧
- 电力行业技术人才选拔标准
- 人力资源公司招聘顾问的面试技巧及常见问题
- GB/T 311.11-2025绝缘配合第11部分:高压直流系统绝缘配合的定义、原则和规则
- 2026届广东省深圳市南山区中考数学仿真试卷含解析
- 冠心病分类及护理
- 系统稳定性与安全性-洞察阐释
- 第10课+马克思主义的诞生和国际工人运动的发展+课件中职高一下学期高教版(2023)世界历史全一册
- 中医儿童助长课件
- 凹版印刷技术培训
- 《急性肝功能衰竭》课件
- 国家中小学智慧教育平台应用指南
- 2025年部编版道德与法治五年级下册第二单元复习课教案
- 学生心理健康一生一策档案表
评论
0/150
提交评论