dev discussion - bypassing m4l limits w/ midi over udp

  • Here's some sample code to address the following data flows:

    * m4l generated sysex -> max runtime -> hardware

    * poly aftertouch from hardware -> max runtime -> max for live



    ----------begin_max5_patcher----------
    3159.3oc6cssiqaaE84Y9JHLJPaA7wPjTTWBBBPJxKAno8gz9TZv.YaZOJGY
    ICI4Iyjf7uWdQxVxVWnjkokyQ.mimYzEpMWbu4kE2Z4e+4mlsL5cZxLvWA9I
    vSO86O+zShCwOvSY+8Sy1489p.uDwkMaUztczvzYykmKk9dp33+svCAAf8Q9
    gozX.88Uz8o9QgI.uXJXo254fO9qdAA+87abS71k7azXgQ9QhBSS7+MJ+nvS
    GdeLMg8.83k1KwzUoRqEgcWPlCftNheXSX2..5rv.7yY2X3gc9gAzTgcCyKM
    uzUu5GtsPIgQF7h.Cw0UREMghEl+ZQUOZ4u7IHzbVg5Qn2NQ8X12F66EL6jE
    EcHM2jL3G7Od9Y9GyuRzeeTbJfU7KowLDeYzaTfW3ZvRZPzuBRe0OAD3GRA6
    NjjB9W+6+CXGGF.TO1GQouRiUrUA0VqBDYu.ZYYQr3HonoA65tfcDKG64.FR
    eBUWtcUTPTr7F4OvBe.6Q6Hxv43yF4ha7YqTKpQ8snf+QTv5ZZVKz1TnBByp
    Vm9.7yCnC.OraarWJEv9sHvNy.vZ5a9qn.9e48YJ3PBEDsg4LPALyJfAaz0r
    30fO.daXgroQGXNCq8R8xKatGypnCghG.pp18Juhq0ExzxjCPHhk3GHQ3HF2
    CGBBxUbuNhdJppjTwMvvQGA1xX27xSVXoermJqI7l2YyAyV5Etc1QquFbUU3
    wJKdgGbPbIbLhHB9JEoTBJr5JTbzswKlc0L2rWngdKCnOPvDgf5JLYe2gI5u
    xrjK5j3P3duUetMzi+ipAOiqC7rDgil3KFesD3Q5L3Mb.zN+09r1fDZsXDGf
    x+eA7Z9sA8LEiUPjPliUy.Wmm.h8vAbAQdqEQc0gaMDR1abwzxV.OnlwEbWw
    EX0ifarvDwdjlyy9MK3weys+Cnef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NRkwGtH9v
    VwgQ8C+0IzpgrzMa.J4qGBwpQzhniWPh6fGSFFnjGycWerJyK6IWljORnuCx
    NaBXaDXsOuJF7AO+7YqIh9UUlt83d6hc9vNHhCDKF1gfsQ7eAa6Z6fanOwlR
    ebhnyPWwmPYFTaRpoUAqEOyFkIFVgqcchggy4ooGCjraTkjrHSxDS54iXOsa
    3S6F9PKRLKUTZXprGgaglvXI0RpIMgYRSXlzDlIMgYRSXlzDlub0DlGPsJQ6
    59wWlpXyinjvneENZZKmGCYQe1aq+rggFAK4V8hPh4ikkYB0Pi.wterLOZzT
    iLJSjeUfzhd3XMbjGcyEA5rM9WtoEsIBze6+E7c+yeD7ieDl9ZAofdSbztyT
    G5iGB0er1FVmMov1ZXcuUG51TCEIwq9gkz+Df38zkYU7sn5G99u66aRwSv59
    adCI0p71k9+EugS1RfQhkvIWuhc2ZZI364WnN0+8oBWkZjspkI08NISMxnnr
    1Lb++xRAJWzQ16zsrIqqpTC4OcpTSFtJ2mglUoFyIUpYhR7IJwmTolIUpYRk
    ZlTolIUpYRkZlToFMvyttUJiuXkijGKMeANIdQZXyWlzb8IUp41qRMYTvCcE
    TzzrJ0fcmTolIRHlHgXRkZlTolIUpYRkZlTolIUpYRkZtcY42itJY7Eo1l7H
    JgLOfJ0yindHoaUmZhRiw.kFm8hyzV9zck7YffxsFTtmLjFeyDwcNEuf89MS
    71o5OhDFZXjqjpjRfZxMHhbzSYV+cEBURN+SxT0qeBUBDNITIFcT+QpVddJ5
    K0t37HuZ8IMO2GO8LM44p8zy6Y5Z7zwSN5Cfi949RJHfNCkqdSxmiqKxF4x8
    NsLssHNxwPrHl18UMcxVRCVlqrtRWNS2ZRvdygKOJ0Y0LK6Rsyn5F2XkzApm
    J4UKERYeyNl8EVJIKe1q6qO.m1qUh6q7xykUxymFeVU8xouaPJtf75VtgQoM
    t7xYte4r1u.16lEYzpEYqQKxTILhnMKxEqDDYpMCxwQICBqw1LUfHWhFMHjB
    NQtHMZPFpXPVZ1fZ2IRmPDTIKxPaVjsJ8Mx+pGuPC6MsiHWUrG80h4pD9nut
    gNK7oA7QOsW1lJXO1D8YOVpZOZJ9RkQML0m+LVE7Qiipph4XoulKKUB2szq4
    z57Dg5ydTvbH5adzXUFrPm1ipw55ouPnJS13LLTc6QtRwyR+NtobVZ2cVJ2c
    d51wJs+34+O.7JTrx
    -----------end_max5_patcher-----------

  • This all happens over udp (broadcasting to localhost). Port number is user-selectable, arbitrarily ranged from 64,000 to 65,000.

    Changing port numbers on either end first triggers midiflush, in case you've got held notes in that stream (which is very unlikely since we're not transmitting note data).

    Give that a try if you're so inclined, report back on what works or doesn't. (This isn't tested as thoroughly as I'd like.)

    Is the approach sound, or should we bark up a different tree? Can we make this more intuitive?

    Let's get all nerdy and talk numbers, yo.

  • My gut instinct is that we shouldn't use this for actual note data. It is faster than [send] and [receive], but there's no protection against packet loss, which is critical if the packet in question was meant to end a note, turn an effect off, etc.

    Likewise, it's worth reiterating that painting a large group of LEDs all at once (in one command) is smarter than addressing individual LEDs one by one; stuck LEDs aren't much better than stuck notes.

    So, yeah. Best used w/ a flood of continuous data that gets refreshed often.