2024年3月22日发(作者:)
whos y
Name Size Bytes Class Attributes
y 16384x1 131072 double
The data type of
y
is
double
.
Request audio data in the native format of the file, and then view the data type of the sampled data
y
.
[y,Fs] = audioread(filename,'native');
whos y
Name Size Bytes Class Attributes
y 16384x1 32768 int16
The data type of
y
is now
int16
.
Input Arguments
string
Name of file to read, specified as a string that includes the file extension. If a path is specified, it can be absolute, relative or
partial.
Example:
'3'
Example:
'../3'
Example:
'C:3'
audioread
supports the following file formats.
Platform Support
All platformsWAVE (
.wav
)
OGG (
.ogg
)
FLAC (
.flac
)
AU (
.au
)
AIFF (
.aiff
,
.aif
)
AIFC (
.aifc
)
Windows
®
7 (or later), Macintosh, and Linux
®
MP3 (
.mp3
)
File Format
MPEG-4 AAC (
.m4a
,
.mp4
)
On Windows platforms prior to Windows 7,
audioread
does not read WAVE files with MP3 encoded data.
On Windows 7 (or later) platforms,
audioread
might also read any files supported by Windows Media
®
Foundation.
On Linux platforms,
audioread
might also read any files supported by GStreamer.
audioread
can extract audio from MPEG-4 (
.mp4
,
.m4v
) video files on Windows 7 or later, Macintosh, and Linux, and from Windows
Media Video (
.wmv
) and AVI (
.avi
) files on Windows 7 (or later) and Linux platforms.
[1,inf]
(default) | two-element vector of positive scalar integers
Audio samples to read, specified as a two-element vector of the form
[start,finish]
, where
start
and
finish
are the first and last
samples to read, and are positive scalar integers.
start
must be less than or equal to
finish
.
start
and
finish
must be less than the number of audio samples in the file,
You can use
inf
to indicate the last sample in the file.
Note: When reading a portion of some MP3 files on Windows 7 platforms,
audioread
might read a shifted range of samples.
This is due to a limitation in the underlying Windows Media Foundation framework.
When reading a portion of MP3 and M4A files on Linux platforms,
audioread
might read a shifted range of samples. This is due
to a limitation in the underlying GStreamer framework.
Example:
[1,100]
Data Types:
double
'double'
(default) |
'native'
Data format of audio data,
y
, specified as one of the following strings:
'double'
'native'
Double-precision normalized samples.
Samples in the native format found in the
file.
For compressed audio formats, such as MP3 and MPEG-4 AAC that do not store data in integer form,
'native'
defaults to
'single'
.
Output Arguments
matrix
Audio data in the file, returned as an
m
-by-
n
matrix, where
m
is the number of audio samples read and
n
is the number of audio
channels in the file.
If you do not specify
dataType
, or
dataType
is
'double'
, then
y
is of type
double
, and matrix elements are normalized values
between −1.0 and 1.0.
If
dataType
is
'native'
, then
y
can be one of several MATLAB data types, depending on the file format and
the
BitsPerSample
value of the input file. Call
audioinfo
to determine the
BitsPerSample
value of the file.
File Format
WAVE (
.wav
)
BitsPerSample
8
16
24
32
32
64
FLAC (
.flac
)8
16
24
MP3 (
.mp3
), MPEG-4 AAC
(
.m4a
,
.mp4
), OGG (
.ogg
), and
certain compressed WAVE
files
N/A
Data Type of y
uint8
int16
int32
int32
single
double
uint8
int16
int32
single
Data Range of y
0 ≤
y
≤ 255
-32768 ≤
y
≤ +32767
-2^32 ≤
y
≤ 2^32–1
-2^32 ≤
y
≤ 2^32–1
-1.0 ≤
y
≤ +1.0
-1.0 ≤
y
≤ +1.0
0 ≤
y
≤ 255
-32768 ≤
y
≤ +32767
-2^32 ≤
y
≤ 2^32–1
-1.0 ≤
y
≤ +1.0
Note: Where
y
is
single
or
double
and the
BitsPerSample
is 32 or 64, values in
y
might exceed −1.0 or +1.0.
positive scalar
Sample rate, in hertz, of audio data
y
, returned as a positive scalar.
Limitations
For MP3, MPEG-4 AAC, and AVI audio files on Windows 7 or later and Linux platforms,
audioread
might read fewer
samples than expected. On Windows 7 platforms, this is due to a limitation in the underlying Media Foundation framework.
On Linux platforms, this is due to a limitation in the underlying GStreamer framework. If you require sample-accurate
reading, work with WAV or FLAC files.
On Linux platforms,
audioread
reads MPEG-4 AAC files that contain single-channel data as stereo data.
翻译


发布评论