The copyFromChannel() method of the AudioBuffer interface copies the samples from the specified channel of the AudioBuffer to the destination array.


myArrayBuffer.copyFromChannel(destination, channelNumber, startInChannel);


A Float32Array to copy the channel data to.
The channel number of the current AudioBuffer to copy the channel data from. If channelNumber is greater than or equal to AudioBuffer.numberOfChannels, an INDEX_SIZE_ERR will be thrown.
startInChannel Optional
An optional offset to copy the data from. If startInChannel is greater than AudioBuffer.length, an INDEX_SIZE_ERR will be thrown.

Return value



var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate);  
var anotherArray = new Float32Array;
myArrayBuffer.copyFromChannel(anotherArray, 1, 0);


Specification Status Comment
Web Audio API
The definition of 'copyFromChannel' in that specification.
Working Draft  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support141325 No156
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes14 Yes2615 ? Yes

See also

Document Tags and Contributors

Last updated by: Jedipedia,