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

Tidal sync not working? #681

Closed
yaxu opened this issue Jun 12, 2020 · 5 comments
Closed

Tidal sync not working? #681

yaxu opened this issue Jun 12, 2020 · 5 comments
Assignees

Comments

@yaxu
Copy link
Member

yaxu commented Jun 12, 2020

Running two streams, and they don't synchronise..

import Sound.Tidal.Tempo
import Control.Concurrent.MVar
import qualified Sound.OSC.FD as O

nowCps str = do tempo <- readMVar $ sTempoMV str
                return $ Sound.Tidal.Tempo.cps tempo 
  
nowCps tidal
setcps 0.8
nowCps tidal

atomStream <- startStream (defaultConfig {cCtrlListen = False})
  [(Target {oName = "atom",
            oAddress = "127.0.0.1",
            oPort = 20202,
            oLatency = 0,
            oWindow = Nothing,
            oSchedule = Live,
            oBusPort = Nothing,
            oHandshake = False
           },
     [OSC {path = "/cps",
           args = ArgList [("cps", Nothing),
                           ("cycle", Nothing)
                          ]
          }
     ]
   )
  ]

nowCps atomStream
setcps 0.6
nowCps tidal
nowCps atomStream

@yaxu yaxu self-assigned this Jun 12, 2020
@yaxu
Copy link
Member Author

yaxu commented Mar 1, 2021

It seems past improvements to fine-grained cps changes have broken network sync. doCps isn't called at all in Stream.hs.

The cps can change from one event to the next. To calculate this accurately, the tempo is manipulated from one event to the next, during a frame.

Previously, the cps was changed via a shared clock server over OSC. This server still runs but no cps is shared.

Probably some changes need to made to the old clock server code, to cope well with these cps changes which can be very frequent. Or longer term we could switch to use superdirt as a clock server, for easy integration with link etc..

@yaxu
Copy link
Member Author

yaxu commented Apr 23, 2021

@ndr-brt noticed that two processes are perfectly in sync if the cps has never been changed, up until it is next changed

@yaxu
Copy link
Member Author

yaxu commented Apr 23, 2021

It could be nice to move the clock server to superdirt, and then benefit from the new link support in supercollider. That would mean superdirt would need to keep a list of current tidal clients and update them when the cps changes though.

For now tidal could send out a cps update to the existing clock server once per frame, if it's changed that frame.

@yaxu
Copy link
Member Author

yaxu commented Apr 23, 2021

This works:

import Sound.Tidal.Tempo

setcps = setCps (sTempoMV tidal)

setcps 2

@yaxu yaxu closed this as completed in 9e16e1f Apr 23, 2021
@ndr-brt
Copy link
Contributor

ndr-brt commented Apr 24, 2021

@yaxu it works also without the setcps redefinition, just

setcps 2

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

2 participants