This feature is not Baseline because it does not work in some of the most widely-used browsers.
Note: This feature is available in Dedicated Web Workers.
The copyTo() method of the AudioData interface copies a plane of an AudioData object to a destination buffer.
copyTo(destination, options)
destinationAn ArrayBuffer, a TypedArray, or a DataView to copy the plane to.
optionsAn object containing the following:
planeIndexThe index of the plane to copy from.
frameOffset OptionalAn integer giving an offset into the plane data indicating which plane to begin copying from. Defaults to 0.
frameCount OptionalAn integer giving the number of frames to copy. If omitted then all frames in the plane will be copied, beginning with the frame specified in frameOffset.
Undefined.
InvalidStateError DOMException
Thrown if the AudioData object has been transferred.
RangeErrorThrown if one of the following conditions is met:
AudioData object describes a planar format, but options.planeIndex is outside of the number of planes available.AudioData object describes an interleaved format, but options.planeIndex is greater than 0.The following example copies the plane at index 1 to a destination buffer.
AudioData.copyTo(AudioBuffer, { planeIndex: 1 });
| Specification |
|---|
| WebCodecs> # dom-audiodata-copyto> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
copyTo |
94 | 94 | 130 | 80 | 26 | 94 | No | 66 | 26 | 17.0 | 94 | 26 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/AudioData/copyTo