TidalCycles MIDI Help (Rounding numbers?)

Hey all,

I’m trying to control euclidean fill via MIDI CC 19… running into type issues:

d1 $ euclid (segment 16 $ (range 1 8 $ (cF 0 "19"))) 8 $ sound "cp"

gives me back

• Couldn't match type ‘Double’ with ‘Int’
  Expected type: Pattern Int
    Actual type: Pattern Double

Tidal is expecting Int but I have no idea how to round.

d1 $ euclid (segment 16 $ round (range 1 8 $ (cF 0 "19"))) 8 $ sound "cp"

results in the following error:

Error in pattern: round: not supported for patterns
CallStack (from HasCallStack):
  error, called at src/Sound/Tidal/Pattern.hs:470:13 in tdl-1.4.5-b2ba2d22:Sound.Tidal.Pattern

Any ideas?



Welcome @tejomay

You can’t use round directly on patterns, for technical, slightly annoying reasons. However you can use <$> to apply a function to values inside a pattern. So this should work:

d1 $ euclid (segment 16 $ round <$> (range 1 8 $ (cF 0 "19"))) 8 $ sound "cp"

Alternatively, you could send the value as an integer, receiving it with cI instead of cF.

1 Like


What is the range of cF? From my experimentation it seems like it’s either 0 or 1.

Another question: now I’m trying to control the rotation parameter (unclear why euclid is giving me so much trouble haha) —

Any idea why

rot 1 $ euclid 3 8 $ s "hh"

doesn’t work?

Like I would expect that line to rotate the euclidean sequence by one step. Instead it outputs the original unrotated sequence.

EDIT: So I found out that the pattern shifter ~> works:

(((1/8) ~>) (euclid 3 8 "hh"))

Is this the way I should be doing this? Just curious why rot wasn’t giving me the expected result. Thanks!

cF receives messages across the network, the range will depend on the client that’s sending the messages.

rot rotates values per cycle, so e.g. rot 1 "0 2 ~ 3" will become "2 3 ~ 0" (I think, I’m not sure which direction it rotates the values in). ~> is indeed what you want here