AudioData

AudioData[audio]

gives an array of audio samples.

AudioData[audio,"type"]

gives an array of audio samples converted to the specified "type".

Details and Options

  • AudioData returns a 2D array of data, where rows correspond to channels.
  • The number of samples in each channel is equivalent to the duration of the audio multiplied by the sample rate.
  • By default, AudioData[audio] returns values normalized to lie between and for audio objects of type "SignedInteger8", "SignedInteger16" or "SignedInteger32". For audio objects of a real type, AudioData[audio] returns whatever real values are used.
  • Possible types specified by AudioData[audio,"type"] are:
  • "SignedInteger8"signed 8-bit integers from through
    "SignedInteger16"signed 16-bit integers from through
    "SignedInteger32"signed 32-bit integers from through
    "Real32"single-precision real (32 bit)
    "Real64"double-precision real (64 bit)
  • AudioData[audio,Automatic] is equivalent to AudioData[audio,AudioType[audio]].
  • For multichannel audio objects, AudioData returns the data in the form {{v11,v12,},{v21,v22,},}, with values vij corresponding to channel i.
  • Use the option Interleaving->True to get interleaved data.

Examples

open allclose all

Basic Examples  (1)

Extract data from an Audio object:

Scope  (1)

Audio data of a stereo sound:

Plot one second of the sum of the channels:

Generalizations & Extensions  (1)

AudioData of a Sound object samples notes and returns the equivalent data:

Plot sampled data:

Options  (1)

Interleaving  (1)

By default, non-interleaved data is returned:

Extract interleaved data:

Applications  (2)

Import a stereo audio sample:

Use AudioData to separate stereo into two mono audio samples:

Generate a histogram of audio sample values:

Introduced in 2016
 (11.0)
 |
Updated in 2017
 (11.2)