Both Safari and Edge do not support the
audioContext.copyToChannel() function to populate an audioBuffer with custom content. Is there any other way to do it?
In my case, I want to create an impulse response, populate a buffer with that response and convolve some sound with that buffer. For Chrome and Firefox this works:
buffer = audioCtx.createBuffer(numOfChannels, 1, sampleRate); buffer.copyToChannel(impulseResponse, 0); buffer.copyToChannel(impulseResponse, 1); convolverNode.buffer = buffer;Answer1:
You can just use
getChannelData(channel) on the
AudioBuffer, you then get a regular
Float32Array than you can modify at will. Maybe you want to look at the
set method ?
copyToChannel is there to optimize buffer copies , as noted in the <a href="http://webaudio.github.io/web-audio-api/#widl-AudioBuffer-copyToChannel-void-Float32Array-source-long-channelNumber-unsigned-long-startInChannel" rel="nofollow">spec</a> (see the little green box below.
edge now supports copyToChannel (tested on edge 38.14393.0.0)