M4A (.m4a, .mp4)

Background & Context

    • MIME types: audio/mp4M4A is a digital audio format and stands for MPEG 4 Audio.
    • A perception-based lossy compression scheme commonly used for storage, transfer and playback that can also be used on the web.
    • Binary file format.
    • Follows the ISO/IEC 13818-7 standard.
    • Supports a few sampling frequencies from 8kHz to 96kHz.
    • Supports up to 48 audio channels.

Import & Export

  • Import["file.m4a"] imports an M4A file, returning an audio object.
  • Import["file.m4a",elem] imports the specified element from an M4A file.
  • The import format can be specified with Import["file","M4A"] or Import["file",{"M4A",elem,}].
  • Export["file.m4a",expr] exports an audio or sound object to an M4A file.
  • Sound objects including notes are rasterized to sampled audio.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the M4A audio format.

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties and settings
  • Data representation elements:
  • "Audio"audio signal given as an Audio object
    "Data"raw audio samples, given as a list of real numbers, with each sublist representing an individual audio channel
    "SampledSoundList"audio signal given as a SampledSoundList object
    "Sound"audio signal given as a Sound object
  • Import uses the "Audio" element by default for M4A files.
  • Advanced Import element:
  • "AudioChannels"number of audio channels
    "BitRate"number of bits per second
    "Duration"duration of the audio given in seconds
    "Length"number of samples
    "SampleRate"number of amplitude samples per second and channel
  • Metadata elements:
  • "MetaInformation"interpreted as quantities, locations, dates, numbers, etc.
    "RawMetaInformation"uninterpreted as strings and numbers
  • Available metadata tags include "M4A".
  • Multiple channels are represented as an array of audio samples.



open allclose all

Basic Examples  (2)

Import an M4A file:

Generate an audio signal and export to M4A:

Scope  (3)

Show all import elements available in this file:

Import audio properties:

Generate an audio signal and export to M4A:

The final file size will depend on the specified bit rate:

Larger bit rates result in larger files:

Compare to file size of a WAV file:

Import Elements  (14)

Available Elements  (3)

List of available elements:

Get audio-related information as a list of rules:

Import some audio options:

The "Options" element does not return all options that are present in the imported audio object:

Data Representation  (4)

"Audio"  (1)

Import as an Audio object:

This is the default Import element for M4A:

"Data"  (1)

Get raw audio samples, given as a list of real numbers:

Create audio from imported data:

"SampledSoundList"  (1)

Import as a SampledSoundList:

Create a Sound object from the SampledSoundList:

"Sound"  (1)

Get an audio signal given as a Sound object:

Metadata  (7)

"AudioChannels"  (1)

Number of audio channels:

"BitRate"  (1)

Number of bits per second:

"Duration"  (1)

Duration of an audio file in seconds:

"Length"  (1)

Number of samples:

"MetaInformation"  (1)

Get the audio metadata:

"RawMetaInformation"  (1)

Get the audio metadata in a raw form:

"SampleRate"  (1)

Number of amplitude samples per second:

Import Options  (5)

"AudioChannels"  (1)

By default, the number of audio channels is set to be

  • Automatic
  • :

    Specify all the audio channels to be imported:

    Import the second channel only:

    IncludeMetaInformation  (3)

    By default, all available metadata is imported:

    Import an audio file with no metadata:

    Import the audio with only specified classes of metadata:

    SampleRate  (1)

    By default, the sample rate is extracted from the file:

    Specify the sample rate of the imported audio:

    Export Options  (5)

    "AudioChannels" (1)

    By default, the audio is exported using the default number of channels:

    Specify the number of channels of exported audio:

    "BitRate"  (1)

    Specify the bit rate of the created file:

    Smaller bit rates result in smaller files:

    IncludeMetaInformation (2)

    By default, all existing metainformation is exported:

    Specify the metadata to include:

    SampleRate  (1)

    By default, the audio is exported using the default sample rate:

    Specify the sample rate of exported audio:

    Introduced in 2017
    Updated in 2018