Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. AudioData

AudioData

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Note: This feature is available inDedicated Web Workers.

TheAudioData interface of theWebCodecs API represents an audio sample.

AudioData is atransferable object.

Description

An audio track consists of a stream of audio samples, each sample representing a captured moment of sound. AnAudioData object is a representation of such a sample. Working alongside the interfaces of theInsertable Streams API, you can break a stream into individualAudioData objects withMediaStreamTrackProcessor, or construct an audio track from a stream of frames withMediaStreamTrackGenerator.

Note:Find out more about audio on the web inDigital audio concepts.

The media resource

AnAudioData object contains a reference to an attachedmedia resource. This media resource contains the actual audio sample data described by the object. A media resource is maintained by the user agent until it is no longer referenced by anAudioData object, for example whenAudioData.close() is called.

Planes and audio format

To return the sample format of anAudioData use theAudioData.format property. The format may be described asinterleaved orplanar. In interleaved formats, the audio samples from the different channels are laid out in a single buffer, described as aplane. This plane contains a number of elements equal toAudioData.numberOfFrames *AudioData.numberOfChannels.

In planar format, the number of planes is equal toAudioData.numberOfChannels, and each plane is a buffer containing a number of elements equal toAudioData.numberOfFrames.

Constructor

AudioData()

Creates a newAudioData object.

Instance properties

AudioData.formatRead only

Returns the sample format of the audio.

AudioData.sampleRateRead only

Returns the sample rate of the audio in Hz.

AudioData.numberOfFramesRead only

Returns the number of frames.

AudioData.numberOfChannelsRead only

Returns the number of audio channels.

AudioData.durationRead only

Returns the duration of the audio in microseconds.

AudioData.timestampRead only

Returns the timestamp of the audio in microseconds.

Instance methods

AudioData.allocationSize()

Returns the number of bytes required to hold the sample as filtered by options passed into the method.

AudioData.copyTo()

Copies the samples from the specified plane of theAudioData object to the destination.

AudioData.clone()

Creates a newAudioData object with reference to the same media resource as the original.

AudioData.close()

Clears all states and releases the reference to the media resource.

Specifications

Specification
WebCodecs
# audiodata-interface

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp