Closed praveenpuglia closed 2 years ago
Yes that is currently how it works, I'm sure there is a way to get stereo output if you'd like to investigate. But i recall spending time on this previously with no solution.
I wish I had known more about WebAudio API to be of any help. Wondering if this would be of any help to you. https://developer.mozilla.org/en-US/docs/Web/API/AudioNode/channelInterpretation
Two channels can be merged.
I got stereo channels to export when I swapped the default _interleave
method with this one
private _interleaveStereo(input: AudioBuffer): Float32Array {
const [left, right] = [input.getChannelData(0), input.getChannelData(1)];
const result = new Float32Array(left.length + right.length);
for (let src = 0, dst = 0; src < left.length; src++, dst += 2) {
result[dst] = left[src];
result[dst + 1] = right[src];
}
return result;
}
When I find some time I'll try submitting a PR
Very interesting. Nice work @spajo, would be appreciated whenever you can 👍
@praveenpuglia @jaggad I made a PR (linked above) that should fix this issue. The problem was indeed with the exporting, the merge/concat worked fine with stereo.
Good timing. I just left a review.
I was taken aback when I received a notification for this repo. I was like wow this is still active! Appreciate it! <3 Fun fact, I left the company where I actually needed it over a year ago! :D I have lost the context too.
Thanks @MikeyZat @jaggad for your work.
My source audio is stereo but once I merge I only get sound from single channel. The other channel is lost.
I am guessing this is because concat / merge methods only take channel 0 into account ?