MATLAB 帮助中心
将录制的音频信号存储在数值数组中
y = getaudiodata(recorder)
y = getaudiodata(recorder,dataType)
y = getaudiodata(recorder) 在 double 数组 y 中返回与 audiorecorder 对象 recorder 相关联的录制音频数据。
y
recorder
double
audiorecorder
示例
y = getaudiodata(recorder,dataType) 将信号数据转换为指定的数据类型。
dataType
全部折叠
使用 audiorecorder 对象创建一段录音,然后以不同数据类型的数值数组形式获取音频信号。
创建一个 audiorecorder 对象,并从麦克风录制五秒的音频片段。
recObj = audiorecorder; disp('Start speaking.')
Start speaking.
recordblocking(recObj,5); disp('End of Recording.');
End of Recording.
以 double 数组形式获取音频信号,并绘制数据。
doubleArray = getaudiodata(recObj); plot(doubleArray); title('Audio Signal (double)');
以 int8 数组形式获取音频信号,并绘制数据。根据指定的数据类型,返回的相同音频信号具有不同范围的值。在本例中,int8 数组中的值可以在 -128 和 127 之间。
int8
-128
127
int8Array = getaudiodata(recObj,'int8'); plot(int8Array); title('Audio Signal (int8)');
录音机对象,指定为 audiorecorder 对象。使用 audiorecorder 函数创建该对象。
'double'
'single'
'int16'
'int8'
'uint8'
输出音频信号的数据类型,指定为下列值之一:'double'、'single'、'int16'、'int8' 或 'uint8'。
数据类型: char | string
char
string
音频信号数据,以数值数组形式返回。
y 中的列数取决于录制中使用的通道数:单声道为一列,立体声为两列。
y 的值范围取决于指定的 dataType。
数据类型
样本值范围
-128 至 127
uint8
0 至 255
int16
-32,768 至 32,767
single 或 double
single
-1 至 1
在 R2006a 中推出
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
欧洲
亚太
联系您当地的办事处