How to trigger a pattern reliably from the start?

Hello,

I've started using tidal in a jam session environment, where we agree on a tempo and sync with our ears rather than a midi clock.

I've been trying to stop tidal and trigger a pattern reliably from the start without success. I've tried resetCycles, setCps(-1), and even attempted to stop/restart the tidal process, but to no avail.

Would you suggest a simple way to do this?

Alternatively, is it possible to adjust the clock by some ms when I notice downbeats are off? I think FoxDot offers this with Clock.nudge (cf. FoxDot | Documentation | Using The Tempoclock).

Thanks for the great software, by the way!

2 Likes

Hi!
I think you can use the nudge param to offset the pattern slighlty (nudge - TidalCycles userbase).
On the other hand I think reseting the clock using resetCycles or cps(-1) has always been buggy, in the sense that it skips the first events on a pattern. Haven't tried myself lately though...

Hi, thanks for your reply! I've nudged individual patterns and it works fine, but I'd rather have a global nudge or a big "restart all" button if such a thing exists...

the 'restart all' button would be smth like resetCycles but I think its not reliable. Regarding a global nudge you can do all $ (#nudge ...) to apply a nudge to every active connection

1 Like

Thanks for the global nudge, I'm going to try it!

Hi @domeav! I think you are looking for the qtrigger (shortcut qt) function. You can find the documentation here: qtrigger - TidalCycles userbase
This function starts a pattern from the beginning and is quantized to the next cycle position.

There is an other function trigger which starts the pattern immediately from the beginning and ignores the current cycle position. Hope this fits your needs!

The global nudge works fine, thanks @Tomas_Ciccola! However after I apply a global nudge to every active connection it seems I am unable to apply a nudge to a given pattern anymore, which is unexpected but not too annoying for my usage.

Thanks for the pointers @mrreason! But for some reason, after I start

d1 $ sound "bd"

Executing any of these commands seems to do the same thing in my setup: the pattern starts on the next beat with the expected sample from the cycle position, and the bd is synced with the one from d1.

d2 $ sound "bd hh hh hh"
d2 $ qtrigger 1 $ sound "bd hh hh hh"
d2 $ trigger 1 $ sound "bd hh hh hh"

Not what I expected :frowning:

My TidalCycles is the last release, but maybe I need to upgrade my SuperCollider? (I'm using 3.11.2-rc1, which might not be a good idea.)

This is just because for d2 you need to pass the 2 to qtrigger and trigger :slight_smile:

Unfortunately the stream does not know his id. That's why you need to pass it manually. Your code should looks like this:

d2 $ sound "bd hh hh hh"
d2 $ qtrigger 2 $ sound "bd hh hh hh"
d2 $ trigger 2 $ sound "bd hh hh hh"
2 Likes

Thanks for your explanation, I appreciate it!

trigger is indeed working and is perfect for my use case :+1:

1 Like

awesome! didn't know about qtrigger and trigger!!
regarding applying nudge globally and to each pattern, remember that using the '#' operator sets the parameter, so if you use it on individual patterns and on all only one would take effect (I think?). On that case you should use another operator on one of the instances. For example:

d1 $ s "bd*4" # nudge 0.9 -- here I'm setting the nudge for this pattern
d2 $ fast 2 $ s "~ sn" # nudge 0.4 -- different value

all $ (|+ nudge 0.2) -- here I'm adding 0.2 to the nudge param. 
-- So on the case of d1, that would result in # nudge 1.1 and in the case of d2 that would be a nudge of 0.6

Rather than doing all $ (|+ nudge ...), you can also do:

nudgeAll 0.2
1 Like

Hey All,

I would expect qtrigger to wait until the start of the next cycle and then start playing the pattern from the begging but it appears to start playing the pattern before the beginning of the cycle, does it not?

@ben i also get inconsistent results with this myself. let me go through some old code and see what has worked historically. i feel like my sequences (used mostly with ur) tend to start in the middle.

thanks @kit-christopher

@ben yeah, looking through some old code, i was using trigger to reset my pattern and it starts things on the second beat every time i launch it. i can give it pretty much any number as its argument and it does the same thing. trigger 0, trigger 1, trigger 2, whatever. my code is sitting on d2, so trigger 2 doesn't "work as expected". however! when i use qrigger, same deal...whatever number i pass to that first argument starts the code on the second beat of my measure, except for qtrigger 2, which starts the measure on the last beat of the cycle preceding it (the "four" of the previous bar).

@yaxu should i open an issue on git?

1 Like

Thanks @kit-christopher.

From what I understand of the arguments to trigger and qtrigger, the number is supposed to correspond to the pattern number. I could of course be wrong, and thanks for confirming the behavior either way.

You can filter out preceding sounds like this:

d2 $ qtrigger 2 $ filterWhen (>=0) $ sound "bd sn!7"

The parameter is indeed the pattern id, although these days the pattern id is already available to the code, so that parameter will disappear / become optional in a future version.

2 Likes

Thanks @yaxu. One issue with the filterWhen code is that it will silence an existing playing pattern...

So for example, something I often want to do in Tidal is have a pattern replace a currently playing pattern but at the beginning of the next cycle. So if d1 is playing then I'd like to trigger a new d1 but only have it replace the current d1 at the beginning of the next cycle (like the way clip quantization works in Ableton)... I'd also like the option to have the newly trigged clip play from the beginning of it's pattern.

This is often how I expect qtrigger to work but I can't tell if it reliably does. Is it supposed to work this way? Or is there maybe another way to accomplish this if not?

Thank you!

1 Like

Have a look at transitions, e.g.
Transitions | Tidal Cycles

1 Like