Implementing logic inside Drambo to read MIDI notes and send out CC strings

edited May 2022 in Tips and Tricks

Hi all,

I know this can be done in either Mozaic or Streambyter - just wondering if it can be done entirely inside Drambo to minimise the dependency on other iOS tools.

I want to send MIDI notes from my Linnstrument to Drambo, then implement some logic inside Drambo so it can send a set of MIDI CC messages to my Linnstrument to set different light combinations. The bit I don't know about is whether the logic part can be implemented inside Drambo.

So for example, I might play a Cmaj chord on my Linnstrument, then I want Drambo to read those CEG notes, process them and send a whole string of MIDI CCs back to the Linnstrument to set the colors of various lights. It's not going to be a simple 1:1-type mapping between notes coming in and lights going out - there's going to be some quite complicated logic used, including tracking the state of the lights before the notes are received and working out which of those need to change after the notes are received.

The incoming MIDI notes will be pre-generated in something like Atom2, so they'll be "perfect" in terms of timing - I won't have to deal with odd corner cases like "if there's 50ms between successive notes, do they constitute part of this chord or the next one?" to deal with. Just listen for notes, look up which colors the lights are currently set to, then send MIDI CCs out to change the colors of those that need to change.

Is this doable entirely inside Drambo? If so, are there any pointers about how to go about it? - ideally a link to some project that's already done something vaguely like this, or even a list of the modules inside Drambo that I should start digging into.

Thanks in advance

Comments

  • Probably. The main question is if Drambo can receive and send all message types that you need.

    From my first glance I see no reason why it shouldn't work!

    A few hints to get you started:

    • You can separate incoming notes using the MIDI Note Filter
    • You can convert MIDI notes to "analog signals" using the MIDI to CV module
    • You can process signals using a number of Math/Logic, Sequencer and Mixer modules (Detect a chord etc.)
    • You can send CC messages using CC Generator. It will send CC messages whenever two conditions occur: 1. A change in incoming CV value and 2. A rising edge at the Trig input. To block 1. you could use the S & H module.
    • Even timing could be detected by using delay modules (they can process control voltages just as well as audio), it'd just be more complex to set up.
  • Thanks @gravitas but that solution requires Streambyter. I'm trying to stick to only Drambo if at all possible

    Thanks @rs2000 I'll start reading about those modules

  • @monch1962

    It was more for the concept of lighting a midi controller rather than Streambyter itself.

    I’ve been doing a similar sort of project that uses the pads on an LP X and

    dRambo modules to change the LED colours on the LP X.

    One of the things that came in handy for me was this

    https://www.inspiredacoustics.com/en/MIDI_note_numbers_and_center_frequencies


    and I used both CC messages and midi notes.

  • @monch1962 . I don't know why you want to avoid StreamByter for this. Remembering the current state of the leds will be difficult in Drambo, but easy in StreamByter. There are several SB projects related to managing a controller to enhance its capabilities. StreamByter is free, and you can include it as an AUv3 MIDI effect in stand-alone Drambo, or route it in AUM.

    If you want to stay in Drambo, you can do arithmetic on the Note value (add 0.5, multiply by 96, quantize) to get a floating number corresponding to the MIDI note number, range 0..127. Unlike modular hardware, Drambo does not care how large the CV values are. This might be useful if you need to do arithmetic on the notes. Handling a chord may be tricky though, since Drambo assigns each note to a different voice.

  • Thanks @gravitas ah got it, thanks. Setting lights on the Linnstrument is really simple and well documented at https://github.com/rogerlinndesign/linnstrument-firmware/blob/master/midi.txt Essentially you set CC 20 to the pad column (0-24), CC21 to the pad row (0-7) and CC22 to a value corresponding to the color (described near the bottom of that link). If only everything was as easy...

    @uncleDave there's a few reasons I'd like to remain completely inside Drambo:

    I want to give this away to anyone who wants to use it. To maximise the number of people who might find it useful, I'd like it to run on both iOS and Mac from the same codebase. While the iOS version of StreamByter is free, the Mac version costs $A30 here in Australia. I work in the software industry and get that the Streambyter author has to feed him/herself, but that price could potentially be a blocker for someone else who might want to try out this tool on Mac in the future.

    Drambo is rock solid and very light on CPU. I haven't tested it, but I suspect adding Streambyter (or Mozaic) to Drambo could make it less reliable and/or slower.

    Drambo runs as both an AU host and client on iOS. As soon as I run Streambyter inside Drambo, I'm forced to use Drambo only as an AU host due to iOS' limitations. Happy to hear about any workarounds to this if they exist...

    I also want something that's as easy as possible for someone else to install, and it's hard to get much simpler than a single Drambo module with no external dependencies. That said, I'm not completely averse to using something like Streambyter in Drambo if it's just too painful in Drambo alone, and right now that's looking to be the case.

  • "Drambo is rock solid and very light on CPU. I haven't tested it, but I suspect adding Streambyter (or Mozaic) to Drambo could make it less reliable and/or slower."


    Nope, it doesn't make it less reliable.

    Tried, tested, burnt in, washed out.


    "I also want something that's as easy as possible for someone else to install, and it's hard to get much simpler than a single Drambo module with no external dependencies. That said, I'm not completely averse to using something like Streambyter in Drambo if it's just too painful in Drambo alone, and right now that's looking to be the case."


    It is possible, it merely requires thinking about.

    The basic premis that I'm getting is that with one note you need

    to be able to send three CC's to the LinnInstrument?

    X/Y position and colour?

    The only caveat with using dRambo which was shown in the video I posted earlier

    is that dRambo cannot read the state that the midi controller was in.

    That normally requires sysex.

  • @monch1962

    Try it!

    Yes, it might take some time to get it working but in your case I think it's worth the effort to keep everything inside Drambo.

    You'd have the benefit of having better realtime access and more options regarding modulations, configurations and parameters and if you get stuck somewhere, just post your specific question here and somebody might be able to help.

    Good luck!

  • @monch1962

    Here’s a starting point.

    The Buttons module in this screenshot sends a simple on/off for all three CC’s.


  • there's going to be some quite complicated logic used, including tracking the state of the lights before the notes are received and working out which of those need to change after the notes are received.

    This will be the most challenging part for sure. Tracking the state of the lights to me means holding all LED states in the Drambo patch to have a clean basis to start from.

  • edited May 2022

    One can afford a $1,500 LinnStrument and a Mac, yet would balk at spending $30 for Streambyter? A convoluted combination of modules and clever hacks to track light states, etc. is going to be more stable and efficient than a single, very light plugin such as Streambyter that is designed for this kind of thing?

    I'm really struggling to follow the reasoning here. 🤷🏼‍♂️

    (But, sounds like a fun intellectual challenge if you can get past that, I guess.)

  • edited May 2022

    @monch1962

    Does the Linninstrument need feedback to switch the LED's on and off and change their colour?

  • Thanks to @gravitas @number37 @rs2000 @uncleDave for your help to date

    I'm making progress (all inside Drambo...). This is where I'm at so far:

    • I've clarified with Roger Linn that the only option to do what I want is to send 3 MIDI CCs to set the color of each pad (MIDI CC20="column" on the Linnstrument, CC21="row", and CC22=color). The color codes are documented at https://github.com/rogerlinndesign/linnstrument-firmware/blob/master/midi.txt which makes it a lot easier
    • the same URL describes the MIDI CCs to set a "main" and "accent" color for each scale note. That's handy as well, but it only gives me 2 color options when I want maybe 5 or 6. Still I can use those to highlight a root & scale, then write the logic to set different colors for other notes myself
    • I've got a Drambo module that lets me select a color, then send it to all the C pads on the Linnstrument. This is working now, but currently in isolation with the color selection and "Do it now" button both in Drambo's UI. It's also surprisingly fast

    Remaining steps:

    • get the module triggering via MIDI in, rather than the Drambo UI. I want to be able to send some sort of message corresponding to color (think I'll pick a CC I'm not using for anything else and send it value), then sending a C note via MIDI will trigger the color change
    • extend it out so sending any other MIDI note (e.g. Bb) will change all the Bb pads on the Linnstrument
    • once I've got any bugs knocked out, upload it to PatchStorage

    I've never tried to do any complex MIDI stuff inside Drambo before, and as a programmer I find it pretty brilliant. Sure it takes loads of different "library units" to do all the maths required, but it's all logical. I'm probably somewhere over 200 "library units" in the module so far, but it's lots of little logical blocks copy/pasted and quite understandable. A few module changes I'd like:

    • an update to the N->1 switch that lets you assign a numeric value to each of the N switches directly, as well as a text label. At the moment you have to create a new switch and give it a text label, create a number "unit" for each switch, then link each number unit to the corresponding switch. There's 12 different colors on the Linnstrument, which means creating 12 different number "units", a N->1 switch with 12 switches labeled with each color, then link each number its respective switch. Lots of scope to mess that up... Same would apply for selecting a note via a N->1, and also for selecting a scale - you wind up with a ton of units when you're implementing this in the UI
    • ability to clear the MIDI Monitor, and maybe a bigger scroll bar for it. I get that scrolling infinitely would chew up a ton of memory and slow things down, but maybe scrolling ~100 messages or so wouldn't be too bad
    • some sort of "zoom out" view when you're scrolling left & right through a large module
    • a NRPN module would be handy, rather than having to assemble one from components
    • ability to set the color manually for different units. That becomes more of a problem once you're stringing together loads of units into one big module
  • @monch1962

    You've pretty much discovered what I discovered when mapping the pads of the LP X.

    We need patience and a lot of the dRambo modules to get them performing the way we need to.


    A couple of tips.

    Use the Section module for collapsing and opening up the modules and the Text module for notes.


    • an update to the N->1 switch that lets you assign a numeric value to each of the N switches directly, as well as a text label. At the moment you have to create a new switch and give it a text label, create a number "unit" for each switch, then link each number unit to the corresponding switch. There's 12 different colors on the Linnstrument, which means creating 12 different number "units", a N->1 switch with 12 switches labeled with each color, then link each number its respective switch. Lots of scope to mess that up... Same would apply for selecting a note via a N->1, and also for selecting a scale - you wind up with a ton of units when you're implementing this in the UI


    We can now input numerical values into the Buttons module which simplifies a lot of things

    and we also have the new the Many 2 Poly module as a multi signal patchbay loom.


    • ability to clear the MIDI Monitor, and maybe a bigger scroll bar for it. I get that scrolling infinitely would chew up a ton of memory and slow things down, but maybe scrolling ~100 messages or so wouldn't be too bad
    • some sort of "zoom out" view when you're scrolling left & right through a large module

    Agreed.

  • The Graphic Shaper has recently received an update that lets you divide the X grid into up to 64 divisions, letting you draw up to 64 bars with unquantized height. I would use it for building a color index.

    By feeding it the value under adjustment and sending color messages frequently (only for adjustment), you could monitor the color live while adjusting a bar, without even messing with numbers.

    +1 for MIDI monitor fixes like a wider module to show most messages without line breaks, scrolling and a clear function.

Sign In or Register to comment.