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

**URL:** <https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641>\
**Category:** TidalCycles\
**Tags:** questions\
**Created:** [6 May 2020 19:07 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641 "2020-05-06T19:07:24Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ben/32/362_2.png) [@ben](https://uzu.lurk.org/u/ben)\
**Post date:** [6 May 2020 19:07 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/1 "2020-05-06T19:07:24Z")

</div>

Hello,

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?

Thanks.

---

<div class="post-metadata">

**Author:** ![ben](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ben/32/362_2.png) [@ben](https://uzu.lurk.org/u/ben)\
**Post date:** [7 May 2020 04:22 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/2 "2020-05-07T04:22:18Z")

</div>

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)`

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [7 May 2020 10:58 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/3 "2020-05-07T10:58:43Z")

</div>

Hi Ben,

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

```haskell
val1 :: Pattern Int

```

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

```haskell
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:

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

```

So something like this should work:

```haskell
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:

```haskell
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](https://github.com/tidalcycles/Tidal/issues/645)

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [7 May 2020 11:01 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/4 "2020-05-07T11:01:37Z")

</div>

> [@ben](#):
>
> `# nrpn "45" # nrpnv (range 50 164 sine)`

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

```haskell
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:

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

```

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

---

<div class="post-metadata">

**Author:** ![ben](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ben/32/362_2.png) [@ben](https://uzu.lurk.org/u/ben)\
**Post date:** [7 May 2020 22:42 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/5 "2020-05-07T22:42:51Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [8 May 2020 07:07 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/6 "2020-05-08T07:07:12Z")

</div>

> [@ben](#):
>
> - 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.

`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.

> [@ben](#):
>
> - 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?

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.

---

<div class="post-metadata">

**Author:** ![ben](https://uzu.lurk.org/user_avatar/uzu.lurk.org/ben/32/362_2.png) [@ben](https://uzu.lurk.org/u/ben)\
**Post date:** [9 May 2020 04:16 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/7 "2020-05-09T04:16:08Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [9 May 2020 07:29 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/8 "2020-05-09T07:29:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kit-christopher](https://uzu.lurk.org/user_avatar/uzu.lurk.org/kit-christopher/32/686_2.png) [@kit-christopher](https://uzu.lurk.org/u/kit-christopher)\
**Post date:** [24 June 2020 00:11 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/9 "2020-06-24T00:11:37Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![yaxu](https://uzu.lurk.org/user_avatar/uzu.lurk.org/yaxu/32/2_2.png) [@yaxu](https://uzu.lurk.org/u/yaxu)\
**Post date:** [24 June 2020 08:57 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/11 "2020-06-24T08:57:15Z")

</div>

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](https://github.com/musikinformatik/superdirt/issues)

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

---

<div class="post-metadata">

**Author:** ![kit-christopher](https://uzu.lurk.org/user_avatar/uzu.lurk.org/kit-christopher/32/686_2.png) [@kit-christopher](https://uzu.lurk.org/u/kit-christopher)\
**Post date:** [24 June 2020 11:16 UTC](https://uzu.lurk.org/t/what-can-and-cant-be-controlled-with-midi-osc/641/12 "2020-06-24T11:16:31Z")

</div>

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.
