Open Jurek-Raben opened 6 years ago
How do I decode to raw, resample to 44,1khz and split stereo into dual mono buffers? Would like to have a working example for within a browser.
Tried this, but errors on " this.context.createBuffer":
asset2.decodeToBuffer(function(buffer) { var channels = asset2.format.channelsPerFrame; var samples = buffer.length/channels; var audioBuf = this.context.createBuffer(channels, samples, asset2.format.sampleRate); audioChans[i] = []; for(var i2 = 0; i2 < channels; i2++) { audioChans[i].push(audioBuf.getChannelData(i2)); } for(var i2 = 0; i2 < buffer.length; i2++) { audioChans[i][i2 % channels][Math.round(i2/channels)] = buffer[i2]; }
asset2.decodeToBuffer(function(buffer)
{ var channels = asset2.format.channelsPerFrame; var samples = buffer.length/channels; var audioBuf = this.context.createBuffer(channels, samples, asset2.format.sampleRate); audioChans[i] = []; for(var i2 = 0; i2 < channels; i2++) { audioChans[i].push(audioBuf.getChannelData(i2)); } for(var i2 = 0; i2 < buffer.length; i2++) { audioChans[i][i2 % channels][Math.round(i2/channels)] = buffer[i2]; }
Also is there a working browser exmaple for using the resampler?
How do I decode to raw, resample to 44,1khz and split stereo into dual mono buffers? Would like to have a working example for within a browser.
Tried this, but errors on " this.context.createBuffer":
Also is there a working browser exmaple for using the resampler?