Ogg Vorbis (.ogg, .oga)


    • MIME types: audio/ogg, audio/vorbis
    • Ogg Vorbis digital audio format.
    • A lossy compression scheme commonly used for consumer audio streaming, storage, transfer and playback, which can also be used on the web.
    • Binary file format.
    • Stores up to 255 channels of compressed audio data.
    • Ogg Vorbis uses variable bit rate (VBR) per sample.
    • Supports arbitrary sampling frequencies from 8 kHz to 192 kHz.

Import & Export

  • Import["file.ogg"] imports an Ogg Vorbis file, returning an audio object.
  • Import["file.ogg",elem] imports the specified element from an Ogg Vorbis file.
  • The import format can be specified with Import["file","OGG"] or Import["file",{"OGG",elem,}].
  • Export["file.ogg",expr] exports an audio or sound object to an Ogg Vorbis 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 Ogg Vorbis 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
    "AudioFile"audio signal given as an out-of-core Audio object
    "Data"raw audio samples, given as a list of real numbers, each sublist representing an individual audio channel
    "SampledSoundList"audio signal given as a SampledSoundList object
    "Sound"audio signal given as a Sound object
  • Import by default uses the "Audio" element for short Ogg Vorbis files and the "AudioFile" element otherwise.
  • Multiple channels are represented as an array of audio samples.
  • Advanced Import element:
  • "AudioChannels"number of audio channels
    "AudioEncoding"audio encoding
    "Duration"duration of the audio given in seconds
    "Length"number of samples
    "SampleDepth"number of bits used to store every sample
    "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 "Xiph".


  • Import and Export option:
  • "AudioChannels"Automaticnumber of audio channels
    IncludeMetaInformationAllmetadata types to import and export
    SampleRateAutomaticsamples per second for each channel
  • Export options:
  • "CompressionLevel"0.5compression level, given as a number between 0 and 1
  • If the number of channels is unspecified, the highest number of simultaneous channels is taken, and silence is inserted if necessary.
  • If "AudioChannels" is set to a value n that is less than the number of channels to be exported, only the first n channels are exported.
  • "CompressionLevel" can be set to values in the range from 0 to 1, with larger values resulting in smaller file sizes.
  • Supported IncludeMetaInformation settings are: "Xiph", "RawXiph", All and None.


open all close all

Basic Examples  (2)

Import an Ogg Vorbis file:

Click for copyable input

Export to an Ogg Vorbis file:

Click for copyable input
Click for copyable input

Decrease compression level:

Click for copyable input

Scope  (5)

Import Elements  (16)

Import Options  (5)

Export Options  (4)

Introduced in 2014
Updated in 2018