files/en-us/web/api/audiodata/copyto/index.md
{{APIRef("WebCodecs API")}}{{AvailableInWorkers("window_and_dedicated")}}
The copyTo() method of the {{domxref("AudioData")}} interface copies a plane of an AudioData object to a destination buffer.
copyTo(destination, options)
destination
options
planeIndex
frameOffset {{optional_inline}}
0.frameCount {{optional_inline}}
frameOffset.Undefined.
InvalidStateError {{domxref("DOMException")}}
AudioData object has been transferred.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 });
{{Specifications}}
{{Compat}}