在Matlab中的dsp.AudioFileReader函数的认识和学习
- 1.描述
- 2.语法
- 2.1 语法描述
- 2.2 属性Properties
- 2.3 举例
Stream from audio file
来自音频文件的流
1.描述
dsp.AudioFileReader系统对象™ 从音频文件读取音频样本。
要从音频文件读取音频样本,请执行以下操作:
1.创建dsp.AudioFileReader对象并设置其属性。
2.用参数调用对象,就像它是一个函数一样。
要了解有关系统对象如何工作的更多信息,请参阅什么是 系统对象(System object)?
2.语法
- afr = dsp.AudioFileReader
- afr = dsp.AudioFileReader(File name)
- afr = dsp.AudioFileReader(Name,Value)
2.1 语法描述
-
afr = dsp.AudioFileReader returns an audio file reader System object, afr that reads audio from an audio file.
afr=dsp.AudioFileReader返回一个音频文件读取器系统对象,afr从音频文件中读取音频。
-
afr = dsp.AudioFileReader(File name) returns an audio file reader object, afr, with Filename property set to File name.
afr=dsp.AudioFileReader(File name)返回一个音频文件读取器对象afr,利用Filename属性设置File name。
-
afr = dsp.AudioFileReader(Name,Value) returns an audio file reader System object, afr, with each specified property set to the specified value. Enclose each property name in single quotes. Unspecified properties have default values.
afr=dsp.AudioFileReader((Name,Value)返回音频文件读取器系统对象afr,每个指定属性设置为指定值。将每个属性名称用单引号括起来。未指定的属性具有默认值。
2.2 属性Properties
Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.
If a property is tunable, you can change its value at any time.
(1)Filename
Filename — Name of audio file from which to read
‘speech_dft.mp3’ (default) | character vector | string scalar
(2)PlayCount
PlayCount — Number of times to play file
1 (default) | positive integer
(3)SamplesPerFrame
SamplesPerFrame — Number of samples in audio frame
1024 (default) | positive integer
(4)OutputDataType
OutputDataType — Data type of output
‘double’ (default) | ‘single’ | ‘int16’ | ‘uint8’
(5)FilenameIsTunableInCodegen
FilenameIsTunableInCodegen — Enable file name tunability in generated code
false (default) | true
(6)CodegenPrototypeFile
CodegenPrototypeFile — Prototype audio file for code generation
‘speech_dft.mp3’ (default) | character vector | string scalar
(7)SampleRate
SampleRate — Sampling rate of audio file
positive scalar
(8)ReadRange
ReadRange — Range of samples to be read
[1 inf] (default) | two-element row vector
2.3 举例
在命令行窗口运行,下列指令
s1= dsp.AudioFileReader('speech_dft.mp3','ReadRange',[1 3*22050]);
得到