WOLFRAM LANGUAGE IMPORT/EXPORT FORMAT

Ogg Vorbis (.ogg, .oga)

BackgroundBackground

    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 bitrate (VBR) per sample.
    Supports arbitrary sampling frequencies from 8 kHz to 192 kHz.

Import and ExportImport and Export

  • Import["file.ogg",elements] imports the specified elements.
  • Export["file.ogg",expr] exports a sound object to an Ogg Vorbis file.
  • Import["file.ogg"] converts the compressed data to pulse-code modulation (PCM) and gives an expression of the form Sound[SampledSoundList[data,r]].
  • Export["file.ogg",expr] creates an Ogg Vorbis file from the sound object expr.
  • Import["file.ogg",elem] imports the specified element from an Ogg Vorbis file.
  • Import["file.ogg",{{elem1,elem2,}}] imports multiple elements.
  • The import format can be specified with Import["file","OGG"] or Import["file",{"OGG",elem,}].
  • Export["file.ogg",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
  • Export["file.ogg",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the Ogg format.

ElementsElements

  • 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:
  • "Data"raw audio samples, given as a list of real numbers, each sublist representing an individual audio channel
    "SampledSoundList"sound data given as a SampledSoundList object
    "Sound"sound data given as a Sound object
  • The element corresponds to the first argument of SampledSoundList.
  • Multiple channels are represented as an array of audio samples.
  • Import and Export use the element by default for Ogg files.
  • Advanced Import element:
  • "AudioChannels"number of audio channels
    "SampleRate"number of amplitude samples per second and channel

OptionsOptions

  • General option:
  • SampleRateAutomaticnumber of amplitude samples per second for each channel
  • Export options:
  • "AudioChannels"Automaticnumber of audio channels
    "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 is set to a value n that is less than the number of channels to be exported, only the first n channels are exported.
  • can be set to values in the range from 0 to 1, with larger values resulting in smaller file sizes.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

Import an Ogg Vorbis file:

In[1]:=
Click for copyable input
Out[1]=

Use Play to generate sampled sound and export it to Ogg Vorbis:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Introduced in 2014
(10.0)