Quantcast

Documentation Center

  • Trial Software
  • Product Updates

audioinfo

Information about audio file

Syntax

Description

example

info = audioinfo(filename) returns information about the contents of the audio file specified by filename.

Examples

expand all

Get Information About Audio File

Create a WAVE file from the example file handel.mat, and get information about the file.

Create a WAVE (.wav) file in the current folder.

load handel.mat
filename = 'handel.wav';
audiowrite(filename,y,Fs);
clear y Fs

Use audioinfo to return information about the WAVE file.

info = audioinfo(filename)
info = 
             Filename: 'S:\handel.wav'
    CompressionMethod: 'Uncompressed'
          NumChannels: 1
           SampleRate: 8192
         TotalSamples: 73113
             Duration: 8.9249
                Title: []
              Comment: []
               Artist: []
        BitsPerSample: 16

Input Arguments

expand all

filename — Name of filestring

Name of file, specified as a string. If a path is specified, it can be absolute, relative, or partial.

Example: 'myFile.mp3'

Example: '../myFile.mp3'

Example: 'C:\temp\myFile.mp3'

audioinfo supports the following file formats.

Platform SupportFile Format
All platformsWAVE (.wav)
OGG (.ogg)
FLAC (.flac)
AU (.au)
Windows® 7 (or later), Macintosh, and Linux®MP3 (.mp3)
MPEG-4 AAC (.m4a, .mp4)

On Windows 7 platforms (or later), audioinfo might also return information about the contents of any files supported by Windows Media® Foundation.

On Linux platforms, audioinfo might also return information about the contents of any files supported by GStreamer.

audioinfo can extract audio metadata from MPEG-4 (.mp4, .m4v) video files on Windows 7 or later, Mac OS X 10.7 Lion or higher, and Linux, and from Windows Media Video (.wmv) and AVI (.avi) files on Windows 7 (or later) and Linux platforms.

Output Arguments

expand all

info — Information about audio filestructure

Information about audio file, returned as a structure. info can contain the following fields.

Field NameDescriptionData Type
FilenameFilename including the absolute path to the file and the file extension.string
CompressionMethodCompression method used. string
NumChannelsNumber of audio channels encoded in the audio file.double
SampleRateSample rate of the audio data in the file, in hertz.double
TotalSamplesTotal number of audio samples in the file.double
DurationDuration of the file, in seconds.double
BitsPerSample

Number of bits per sample encoded in the audio file.

Only valid for WAVE (.wav) and FLAC (.flac) files.

double
BitRate

Number of kilobits per second (kbit/s) used for compressed audio files.

Only valid for MP3 (.mp3) and MPEG-4 Audio (.m4a, .mp4) files.

double
TitleValue of 'Title', if any.string
ArtistValue of 'Artist', if any.string
CommentValue of 'Comment', if any.string

    Note:   The BitRate property returns the actual bit rate on Mac platforms, and not the encoded bit rate. This means that bit rate values might be lower than specified at the time of the encoding, depending on the source data.

    Note:   On Mac platforms, audioinfo returns metadata from .m4a and .mp4 files only on Mac OS X 10.7 Lion or higher. Previous versions of Mac OS X will not read the 'Title', 'Author', or 'Comment' fields.

Limitations

  • For MP3 and MPEG-4 AAC audio files on Windows 7 or later and Linux platforms, audioinfo might report fewer samples than expected. On Linux platforms, this is due to a limitation in the underlying GStreamer framework.

  • On Linux platforms, audioinfo interprets single channel data in MPEG-4 AAC files as stereo data.

See Also

|

Was this topic helpful?