Midi in - cI not behaving ? cT cF cN are ok

I'm trying to use midi controllers with the slice function. I'd like to use different knobs to control:

(1) which sample to slice
(2) the amount of slices
(3) which slice is played
(4) the speed of playback
(5) the gain

d1 $ fast ((segment 1 $ cT 1 "4") * 8) $ slice (segment 1 $ range 1 8 $ cI 0 "2") (segment 1 $ range 1 8 (cI 0 "3"))
  $ s "break" # n (segment 1 $ range 1 16 $ cN 0 "1")
  # gain (segment 1 $ range 0 2 $ cF 1 "5")

I had used midi before so I was familiar with (5) cF for gain. It took me a long time to figure out that (1) needs cN, (4) needs cT. But I can't get (2) and (3) to work in the above code. I'm not getting an error, it just seems there's only 2 states: either 8 when the knob is almost all the way up and 1 when the knob is in any other position. What am I doing wrong? Am I not understanding how cI works ??

1 Like

I also have this problem. It seems that cI only registers 0 or 1, so even when you use range it only ever maps it to the lowest or highest number (imagine a square wave).

I think what's happening is that the MIDI input (in the range 0-1, not 0-127) is converted to an integer before it even comes into Tidal, which is why range only ever returns the highest or lowest numbers, since it only evcer receives 0 or 1 as an input.

So it's not 'broken' since I ~think~ this behaviour is deliberate. But it isn't very helpful for your case!

Edited 'cause I figured it out :slight_smile:

You can use cF and round <$> to convert Pattern Float to Pattern Int across your range of values

d1 $ slice 8 (round <$> range 0 7 (cF 0 "92")) $ sound "bev"
2 Likes

yes, this works. thanks so much!!!

1 Like