web-audio-javascript-webassembly-SDK-interactive-audio icon indicating copy to clipboard operation
web-audio-javascript-webassembly-SDK-interactive-audio copied to clipboard

Syncing two advanced players doesn't work

Open robclouth opened this issue 2 years ago • 5 comments

Sorry this still isn't resolved and there are no examples or other issues for me to refer to for help.

There are two players A and B. Both are playing, I know this because I can hear them. Both are playing the same track. The BPM and firstBeatMs are accurate, I know this because the phase of each player individually is reported correctly and is correctly synced to the bar. Both have:

player.outputSamplerate = 44100; player.timeStretching = false; player.formantCorrection = 0.5; player.fixDoubleOrHalfBPM = true; player.syncMode = this.Superpowered.AdvancedAudioPlayer.SyncMode_TempoAndBeat; player.originalBPM = trackTempo; player.firstBeatMs = trackFirstBeatMs; player.syncToBpm = 120; player.syncToQuantum = 4; I'm trying to sync B to A. Currently I'm calling playerB.syncToPhase = playerA.getPhase(); every call of processAudio but it's not changing the phase of playerB. I've confirmed this by sending the phases back from the audio engine to the UI and showing the phase difference. It should be 0 but it's a random amount that depends on when I start playback of player B.

What are the exact steps I need to take?

Thank you

robclouth avatar Jun 28 '22 10:06 robclouth

You need some "event" when the two players can synchronize, such as calling playSynchronized (despite of they're playing already).

gaborszanto avatar Jul 05 '22 08:07 gaborszanto

So calling playSynchronized on B when A is already playing? B won't play if I start it with playSynchronized(). It only starts with play()

robclouth avatar Jul 05 '22 12:07 robclouth

you can call playSynchronized later

gaborszanto avatar Jul 05 '22 15:07 gaborszanto

Later when? It's not doing anything when I call playSynchronized(). It doesn't play.

robclouth avatar Jul 05 '22 15:07 robclouth

@gaborszanto I've tried literally everything, I think it must be a bug. I'm completely blocked with this project until you give me more information. Any hints would be hugely helpful. Thanks.

robclouth avatar Aug 17 '22 13:08 robclouth