copyFromChannel()
方法在
AudioBuffer
interface copies the audio sample data from the specified channel of the
AudioBuffer
to a specified
Float32Array
.
myArrayBuffer.copyFromChannel(destination, channelNumber, startInChannel);
destination
Float32Array
to copy the channel's samples to.
channelNumber
AudioBuffer
to copy the channel data from.
startInChannel
可选
An optional offset into the source channel's buffer from which to begin copying samples. If not specified, a value of 0 (the beginning of the buffer) is assumed by default.
undefined
.
indexSizeError
channelNumber
specifies a channel number which doesn't exist (that is, it's greater than or equal to the value of
numberOfChannels
on the channel).
startInChannel
is outside the current range of samples that already exist in the source buffer; that is, it's greater than its current
length
.
This example creates a new audio buffer, then copies the samples from another channel into it.
var myArrayBuffer = audioCtx.createBuffer(2, frameCount, audioCtx.sampleRate); var anotherArray = new Float32Array(length); myArrayBuffer.copyFromChannel(anotherArray, 1, 0);
| 规范 | 状态 | 注释 |
|---|---|---|
|
Web 音频 API
The definition of 'copyFromChannel' in that specification. |
工作草案 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
copyFromChannel
|
Chrome 14 | Edge 13 | Firefox 25 | IE 不支持 No | Opera 15 | Safari 6 | WebView Android Yes | Chrome Android 18 | Firefox Android 26 | Opera Android 14 | Safari iOS ? | Samsung Internet Android 1.0 |
完整支持
不支持
兼容性未知
AudioBuffer
copyFromChannel()
copyToChannel()
getChannelData()
AnalyserNode
AudioBufferSourceNode
AudioContext
AudioContextOptions
AudioDestinationNode
AudioListener
AudioNode
AudioNodeOptions
AudioParam
AudioProcessingEvent
AudioScheduledSourceNode
AudioWorklet
AudioWorkletGlobalScope
AudioWorkletNode
AudioWorkletProcessor
BaseAudioContext
BiquadFilterNode
ChannelMergerNode
ChannelSplitterNode
ConstantSourceNode
ConvolverNode
DelayNode
DynamicsCompressorNode
GainNode
IIRFilterNode
MediaElementAudioSourceNode
MediaStreamAudioDestinationNode
MediaStreamAudioSourceNode
OfflineAudioCompletionEvent
OfflineAudioContext
OscillatorNode
PannerNode
PeriodicWave
StereoPannerNode
WaveShaperNode