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:

Wolfram Research (2016), AudioData, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioData.html (updated 2017).

Text

Wolfram Research (2016), AudioData, Wolfram Language function, https://reference.wolfram.com/language/ref/AudioData.html (updated 2017).

CMS

Wolfram Language. 2016. "AudioData." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2017. https://reference.wolfram.com/language/ref/AudioData.html.

APA

Wolfram Language. (2016). AudioData. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AudioData.html

BibTeX

@misc{reference.wolfram_2024_audiodata, author="Wolfram Research", title="{AudioData}", year="2017", howpublished="\url{https://reference.wolfram.com/language/ref/AudioData.html}", note=[Accessed: 02-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_audiodata, organization={Wolfram Research}, title={AudioData}, year={2017}, url={https://reference.wolfram.com/language/ref/AudioData.html}, note=[Accessed: 02-November-2024 ]}