audioread
Read an audio file.
📝Syntax
y = audioread(filename)
[y, fs] = audioread(filename)
[y, fs] = audioread(filename, range)
[y, fs] = audioread(filename, type)
[y, fs] = audioread(filename, range, type)
📥Input Arguments
Parameter Description
filename a string: an existing filename.
range a vector: [start end].
type a string: 'double' or 'native'.
📤Output Arguments
Parameter Description
y a matrix: audio data.
fs an integer value: sampling rate.
📄Description

audioread reads an audio file.

Supported format: 'wav', 'ogg', 'flac', 'mp3', 'caf', 'au', 'aiff'. See audiosupportedformats function to have all supported formats.

If type is 'native' then audio data depends on the file format (single, double, integers).

💡Examples
wav_audio = [modulepath('audio'), '/examples/haha.wav'];
[y, fs] = audioread(wav_audio);
playObj = audioplayer(y, fs);
playblocking(playObj)
delete(playObj)
clear playObj
🔗See Also
playblockingaudioplayeraudiosupportedformatsaudiowrite
🕔Version History
Version Description
1.0.0 initial version
Edit this page on GitHub