What Can (and Can't) be Controlled with MIDI/OSC?


I'm getting some errors when trying to control certain parameters with OSC. It's leading me to think that certain things can't be controlled this way. Is there a way to think about this?

For instance fix does not seem to work:
val1 = (cI 0 "mini1")

d1 $ slow 2 $ fix (val1) (n "[0]") $ n "0 1 2 3 4 5 6" # sound "arpy"

Nor does repeatCycles:
repCycles = (cI 0 "rep")

d1 $ repeatCycles repCycles $ sound "arpy(5,8)" # n (irand 8)

Am I getting the type assignments wrong or am I correct that certain types of data can't be controlled in realtime?


Here's another one. This time with MIDI (NRPN) out.

How come this works:
# nrpn "45" # nrpnv (irand 114 + 50)

But this does not? Can I not modulate MIDI messages with continuous functions?
# nrpn "45" # nrpnv (range 50 164 sine)

1 Like

Hi Ben,

If you look at the output of :t val1, you see this:

val1 :: Pattern Int

So val1 can only be given to functions that can work with patterns of integers. Looking at :t fix:

fix :: (ControlPattern -> ControlPattern) -> ControlPattern -> ControlPattern -> ControlPattern

That first parameter is a function that takes a pattern of controls as input, and gives another one as output.. So you'd need a function that turns a pattern of numbers into such a function.

pickF looks like it might help, it lets you pick a function from a list, using a pattern of integers:

pickF :: Pattern Int -> [Pattern a -> Pattern a] -> Pattern a -> Pattern a

So something like this should work:

d1 $ slow 2 $ fix (pickF val1 [id, fast 2, fast 4] ) (n "[0]") $ n "0 1 2 3 4 5 6" # sound "arpy"

Looking at the repeatCycles type:

repeatCycles :: Int -> Pattern a -> Pattern a

That first parameter is an 'int', and not a pattern of ints. Actually it's only in the last couple of years that you've been able to use patterns as parameters in this way in Tidal.. (the inner workings of this are quite something to behold, it's amazing that it works so well in general..) So this is kind of a bug in Tidal that this parameter isn't 'patternable'. I've made a note to fix it https://github.com/tidalcycles/Tidal/issues/645


nrpnv wants a pattern of integers, but you're giving it a pattern of floats.
This runs:

nrpn "45" # nrpnv (floor <$> range 50 164 sine)

However because the structural rhythm is coming from the left, nrpn "45", you'll only sample one value per cycle. You're probably after something like this:

nrpnv (segment 32 $ floor <$> range 50 164 sine) # nrpn "45"

where segment sets the number of values per cycle to send.


Thanks so much for this help Alex. I've got NRPN's working thanks to you.
Two questions remain:

  1. Both of these solutions (floor and pickF) appear to be Haskell functions yes? It seems like digging into a bit of Haskell might be helpful in the long run if so. I'll start with the Tidal resources page soon.

  2. For posterity's sake (and so that I don't need to change the thread title ;), are there some things that can not be controlled with MIDI? I've been told that values in mini-notation can not directly be controlled. Is the fix method the best way of achieving control over the innards of mini-notation?

1 Like

floor is a haskell function, for rounding down. There's also round for rounding to the nearest integer, and ceiling for rounding up. <$> is also a Haskell thing, for applying a function (in this case floor) to all the values in a collection (in this case a pattern). It's also known as fmap (functor map).

pickF is a tidal one.

I'd say there's generally workarounds for most things you'd want to do, but they might not be obvious, so feel free to ask. fix is useful but a bit inefficient, so you'll hit problems once you have it more than about six times in a pattern. It depends on the problem you're trying to solve really. Mini-notation is currently a bit of a different world to the rest of Tidal, but ur can help with making patterns of patterns for example.


Thanks so much @yaxu. I'll give a good look at ur as well.

I'd assumed pickF was Haskell as I couldn't find it in the documentation. Is this one of those things I'd have to search the source code to find?

Yes - I'm focussing on trying to work on this 'book' format but we need a documentation drive!

1 Like

hey @yaxu, legato is a super useful function for controlling samples...is there an analogous control for MIDI (or any kind of roadmap to adapt it for MIDI)?

1 Like

Hm, doesn't superdirt MIDI already use legato for timing its note-offs? If not, then that's worth creating an issue here: https://github.com/musikinformatik/superdirt/issues

@lannzach You can follow a thread without commenting by clicking the 'bell' icon on the right

let me do some more testing before creating an issue but, no, once i'm in Ableton, legato doesn't seem to have any effect whatsoever on my note on/off values.