Max/Msp SuperDirt timing problem

Hey everyone,
This week I’m working on how to create my own SuperDirt, but in max.
But I’m having an issue, maybe you can help me.
I really don’t understand how to schedule events received from tidal.
I explain :
If I do
d1 $ s “bd bd bd bd” # cps 1.0
everything is correct, events received in max are equally spaced.
but if I do
d1 $ s “bd bd bd” #cps 1.0
events are not equally spaced. That means SuperDirt “re schedule” some events to be in sync, but I don’t know how. all of that haunting me since few days now, but I’m really stuck. Someone can explain to me this behaviour?

Thank you very much !

Guillaume

Yes messages are sent ahead of time, in batches. You’ll need to read the bundle timestamp, compare it with the current time, and delay by the difference. Alternatively in tidal you can configure the target to have oTimeStamp set to NoStamp and tidal will do the scheduling for you. Then you just add a tiny bit of internal network delay and jitter, but probably not noticeable in most circumstances.

That’s perfect thank you yaxu!
Which solution would you suggest, let tidal schedule events or do that in max?
I will try both options, because I like when there are lots of quick elements in patterns, so maybe let tidal doing the scheduling will be not the best option…

THANK YOU very much YAXU :slight_smile:

Probably try doing it in Max, then in the future you can e.g. have max running on a different computer… that’s when network jitter becomes more noticeable

I just tried to create a max patch, but is not efficient and I don’t know exactly why. where is the code of SuperDirt which do this?

here is the patch I did


----------begin_max5_patcher----------
1437.3oc2Zs0jaZCE9Yuyr+GXXZeIwwEIwM2ouzeGcxriLVXqD.QAwl0IS6u
8pKfM1w.ZoZcc5ryZvRBcNem6bj+1iOrvcC6ERsqyu57GNKV7MwHKTiIGYQ2
.KbywujjgqUKzsLCeHiVy+a2ksSyZ3YDN+PIQuSt0zcE3L2kW+N4+aoIbJq.
Wcv04ic6Ccqh.rMe5CqOt4kXdxdZwtmpHIb89iPqW4szINNTdAD3IufDedZq
JZxoEBlRwxfdip4U0vAcCuEywsHtCxKbSxnkGkL8mQLGdSMKqgSD71dEKuY6
62ueElll1w2xkkRyHE3bxDK4yzBMvwMaoL4H8WQMIinjUZdQgUPOnJWSFiUJ
m1q2XIrBNof+TMGyIcn6LXHzqrscprM3ZZha+cUnWqn6nBkFmjWxzqC.8Nm1
BHvp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Ns.e5715vlbQCK1MmbxSvZZBFXSJ5YBEUm
HgkH4ZyHHxhXzH03ZqQvXSHmHjuCvJjKxLAp0fWnIzK1ZjqyZeJ74YMJ5Gar
Wnczfx9nJ2pwInu8jo9HyjoAVihn.iBkFZOBZjYCxdVMHihxnjC1wpAYTnaE
aYIBZrJzNzCZTjFe6ko.ZtJzRDTrSvIo24LEqZqn.zweAF6y.fqv.dVhALHP
zZqJxmLTq5.5sU4GQ2XiJPjIPzhUzALxOsSNXCBZTxDf8hDIatlgDzydDbZy
z.6hPnQDzRHzrRP7s3qADbiKqCXVvMK9lNdF+pGuUITLjEBGfE7rFKLoyykE
H9eBO.LTUz1LCbY4yjp51MQSd2b7mXpGJdo96zB820MJwsh7Ls6QZGBWkrmx
II7lJ8u5lWBaO9.0ux6phFZGWHE.RRqZSj7WoScINo8GoN6E2GePrf+Al1fV
W
-----------end_max5_patcher-----------

arg… it’s not working at all, I don’t understand what I need to do precisely to achieve the scheduling. for the moment I compare the timestamp in the message with “real time ellapsed” between events. some of them are late, others are ahead of time (in my case I try with e ternary beat for the moment, s “bd bd bd”).
maybe counting the ellapsed time between events is not the best strategy? I’m lost, thank you for your help

Guillaume

I’m not a Max user, but I note below that there’s a Dirt for Pure Data project out there (PureDirt ( a pure data sound engine for tidal)). I believe Max and Pd scheduling is not terribly different. Maybe you could get some tricks from there.

Scheduling is tricky for sure. (Sorry that I don’t have a detailed answer but I don’t have the software to open your patch.)

hjh

Thank you for the answer :blush: this patch is not working anyway. Pure dirt is working well until we try to modulate the cps each step. This night I found a solution. I write events in an audio driven sequencer when they arrived in max, and I read this seq
with the rate defined by cps and also with a latency. I think this is the best solution I found. I share the patch this afternoon

every day I try, and I’m still stuck with this problem. Now I understand messages are sent ahead of time, in batches at a specific rate defined by cFrameTimespan = 1/20 in BootTidal.hs.
But I still don’t find the good algorythm to schedule everything. For instance if I eval this :
d1 $ s “1 2 3”
1 will be received ahead of time or just in time?
And also if we change the cps, something like 1.056842, it will affect the cFrameTimespan?
Sorry if all of this seems to be obvious for you but I really need help to go further here.

Thank you very much :slight_smile: