Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I decode to raw, resample to 44,1khz and split stereo into dual mono buffers? #202

Open
Jurek-Raben opened this issue Dec 9, 2017 · 0 comments

Comments

@Jurek-Raben
Copy link

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];
}

Also is there a working browser exmaple for using the resampler?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant