how to implement StereoMixer?
Closed this issue · 1 comments
Hi there.
I'm implementing superpowered on moises, and looking on the examples you guys made I was able to implement my own time stretching app, however I need to use the StereoMixer feature to synchronously play up to 6 mp3 files, and just by studying the docs I couldn't make it work.
I have a few things that are not clear to me:
-
ok, I have all my decoded audio data buffers ready to be passed to my Superpowered processor, how should I send it?
1.1 can it be just the raw buffer or do I need to break it down in left/right channels like we do on the timestretching example? -
how should I handle it on
processAudiofunction? I tried to pass all my 4 buffers to themixer.process(buffer0, buffer1, buffer2, buffer3, output, 128)but it didn't worked. -
can I change the pitch and speed rate when I'm using the StereoMixer? or is it only possible using
TimeStretching? -
would you happen to have an example that implements the StereoMixer? it would be very helpful to see it working live
-
Is it possible to programmatically seek forward/backward the playback using stereo mixer? In our case we may have up to 6 tracks playing in parallel, since stereo mixer only allows up to 4 inputs, we'll need to use 2 stereo mixers as the docs suggests. Will they keep sync as the user seeks different parts of the audio?
To make it easier to understand our scenario, here is a screenshot of our mixer. We currently use tone.js to handle our audio buffers and control the timeline/pan/mute/solo/volume/seek

I couldn't find a solution to my issue on stackoverflow nor on github (in fact, all the content I found was from people using the Android/iOS sdk's 😄 ), hopefully we'll see an adoption increase of wasm in the future.
Thankyou!
- You can do it either way, it's your choice.
- You need to maintain some playhead I guess. Always passing the beginning of each buffer will always use the same data from the beginning (I hope those are pointers to data in WASM linear memory).
- Yes, it's totally independent from the StereoMixer. Yes, do it like in the time stretching example.
- No, sorry. But the documentation has an almost complete example: https://superpowered.com/js-wasm-sdk/docs.html#section_2_3
- The StereoMixer class has no information about any playhead. You need to implement the playhead yourself (refer to the time stretching example on how). Yes, you'll need two StereoMixer instances to mix 6 tracks. If you maintain a single playhead number for each track, then they will stay in sync, since it's only an offset from the beginning of each buffer.