Flip flop module for Toggle-able modulation target
in progress
Jon Diercks
Most modulation targets that are on/off in behavior will turn on when the modulating source goes above 50% and off when source goes back below 50%. I’d like a way for such targets to behave as toggles instead, so that the target will go on when source is >50%, but won’t go off again until the source has gone back under 50% and then hits >50% again. This would allow for things like routing signals differently on odd vs. even note-on events.
This could be accomplished by just adding a new mod target to the Macro Button module, similar to the existing “Macro” target, but maybe name it “Macro Toggle”, then any other mod target that I want to be toggle-able could just be chained from a Macro Button.
Nikolozi
Jon Diercks Doing last-minute tweaks to this feature, and I realised it makes more sense that the Flop only happens if the MIDI Source module receives the second note-on with the same note number. For example, when it receives C3 the modulation signal jumps to 100%, but it will only jump back down to 0% if it receives C3 again, if it receives, say D3, it will stay on 100%. But now it will wait for another D3 to jump back down to 0%. What I described is the case where a MIDI Source is not processing a Poly signal. In Poly, each voice will wait for the same note to Flop. I bumped into this after I realised a poly preset wasn't behaving predictably and realised things would be more intuitive if flip-flop happened using the same note, rather than flip happening with one and flop with another. But wanted to check with you that this doesn't affect your presets negatively.
Jon Diercks
Nikolozi, interesting. I guess that would make it more similar to how Note Hold works. I did have at least one use case in mind that might be a little harder with that change. The idea is that a mono patch would send every other note down a different signal path, so for example if I play C D E F G, the C would go down signal chain 1, D would use path 2, E to 1, F to 2, G to 1, etc. This was inspired by one of the Physical Modeling recipes I was looking at on the Nord Modular, so that a flute or reed model could process legato a little differently, letting one note's decay resonate in chamber 1 while sending the next note to chamber 2, so that chamber 1 stays on the first note's pitch. I haven't actually tried to implement that yet.
I could probably still make that work if you change the MIDI Source module's Flip Flop behavior, I would just have to fork the signal path first and make sure I'm feeding the Flip Flop with the same note every time, regardless of what note is actually being played.
So... I think I'm OK whatever you decide. Thanks for the heads-up.
Nikolozi
Jon Diercks oh right, when changing code to the new way, it crossed my mind that must be a reason why I did it that way originally, but I quickly dismissed it thinking I probably didn't think it through at the time. Since other Input types like Randon on Note-On and Note-On/Off Gate support polyphony, I do feel it will be less confusing if this also supports Poly modulation signals. But I do want to make your use case easier to achieve. Another thing is, I keep coming across use cases where MIDI notes need to be forced to be one specific value. Maybe I should add that, maybe a Mela Lab module.
Let's call it "One Note" tentatively. It will have 2 parameters: Note and Mode. It will have 2 modes: Filter and Map. In filter, it will filter out all other notes, in Map mode it will change the MIDI note to match the set parameter. Thoughts?
Jon Diercks
Nikolozi, sure, that definitely sounds like it could be useful. I could see it working as you describe with a One Note module, or you might be able to just extend the existing Note Event module to incorporate those options.
Nikolozi
Jon Diercks I thought about that, but One Note feels different enough. I could potentially add a mode to Note Event, but it has parameters: Channel and Velocity. These aren't needed for this mode. One Note module, wouldn't touch channel and velocity, it would only modify the note number. So with the hypothetical new mode, I would need to disable most of the Note Event parameters. So I think a separate module makes more sense, unless you had something else in mind?
Jon Diercks
Nikolozi, something else just occurred to me - the Note Range module already does almost exactly what you're proposing for One Note, just in different terms. I would suggest one slight change to the Note Range module behavior: if mode is Transpose and Low/High values are less than an octave apart, then notes outside the range should be transposed to fit the closest available note in range, rather than dropped if an octave-shift doesn't land it in range. So if Low/High are exactly the same note, you get a One Note/Map behavior. Does that make sense?
Nikolozi
Jon Diercks The design / parameters of One Note is based on the Note Range module. But you might be onto something here. I could introduce a third mode, "Clamp", which would force the note in range by clamping. i.e. If it's set to C3-C4 and you play G4, it will be changed to C4. E2 would become C3.
Jon Diercks
Nikolozi - I like that. Using a third mode guarantees it won't break any existing patches, but it still keeps the implementation simple and aligned with what's already there, avoiding the creation of a whole new module that does almost the same thing.
Nikolozi
Jon Diercks Cool, I agree. I'm thinking of making the module compact like Groove. The only downside is that the user will have to adjust 2 parameters to lock to a single note. But that trumps having a whole other module with similar functionality. Plus, Clamp mode introduces other interesting use cases.
Jon Diercks
Nikolozi - I like that you're shifting to more compact module layouts where possible. I tend to zoom in pretty big for my impaired eyesight, so I don't want a lot of wasted space on modules that are spread out bigger than they need to be for the functionality.
Nikolozi
Jon Diercks 100%, these are older designs, some of the MIDI processor modules are from Mela v3. And if a module is performing a small task, it makes sense that it's as compact as possible.
Nikolozi
in progress
Ready for testing in build 438
Jon Diercks
Nikolozi - quick initial test successful! See attached.
I cranked up the Smooth parameter which gives it a nice crossfade … which of course will be even more useful when we get long slew :-)
Thanks much for adding this useful feature!
Nikolozi
Jon Diercks Nice, works with Poly signals also.
Jon Diercks
Nikolozi - interesting, hadn’t even thought about that because I’m usually playing mono leads from windsynth. The concept of flip-flop in poly is actually a little brain-bending if I think about it too hard, but I guess it makes sense, just like everything else in poly, the signal chain has to behave as if there is a separate path for each poly voice. Cool.
The use case that actually started me down this flip-flop road in the first place comes from one of the physical modeling example recipes I found where they’re using flip-flop to alternate sending successive notes through two identical resonators, so that legato phrases will behave more like the legato of an actual acoustic wind instrument, and less like a typical synth legato. If I get it working I’ll be sure to post an example.
Nikolozi
Jon Diercks Initially, I was thinking that each poly voice would have its own flip-flop state, i.e when a voice got reused, it would toggle the state assigned to that voice. But then I started thinking about your original requirement, and I realised that every new note-on simply flip-flops the last state, regardless of which voice it was.
Nikolozi
Interesting idea, I'll think about it.
Jon Diercks
Nikolozi - I guess this is actually a pretty well-defined thing in the modular world, usually referred to as a flip-flop, or a 1-bit sample & hold. I was trying to find a way to build it using the Multiply/Add module in labs, based on multiplying by -1, but haven’t cracked it yet.
Nikolozi
Jon Diercks. I don't think it's possible atm in any way. If I understand the problem correctly, you want a digital pulse signal to be converted to a step-up or step-down signal. It will be converted to a step-up if previously it was converted to a step-down and vice versa. That would require the modulator/converter to have memory of the previous state. So, I think it will require a new module. And maybe Flip-Flop is an appropriate module name for that :)
Jon Diercks
Nikolozi I like it!
Nikolozi
Jon Diercks thinking about it some more, maybe rather than being a modulation signal converter, it can just be triggered using MIDI notes. When it receives a MIDI note-on the it will flip up the modulation signal to 100%, when it receives another note-on, it will flip down to 0% and so on. I think that would address your needs, yeah?
Nikolozi
And actually, rather than a whole new module, MIDI Source is a perfect home for the feature. MIDI Source already offers things like "Random on Note-On" and "Note-On/Off Gate", and this will be something like "Flip-Flop on Note-On ".
Jon Diercks
Nikolozi, sure that would work. I can think of other use cases like triggering flip flop from an LFO or beat pulse, but those could be implemented by first modulating a Note Event module, which in turn triggers a flip flop via midi source.
Jon Diercks
A dedicated module would probably be more intuitive for the Eurorack crowd.
Jon Diercks
Plus it would be nice to have a clear visual indicator of the current flip flop state.
Nikolozi
Jon Diercks :
> Plus it would be nice to have a clear visual indicator of the current flip flop state.
You will have a clear indication of the flop flop state, the MIDI Source's graph shows the latest value.
Nikolozi
Jon Diercks:
> A dedicated module would probably be more intuitive for the Eurorack crowd.
Separate module where it converts MIDI notes to modulation, or do you mean have a dial so you can do mod-to-mod signal conversion?
Nikolozi
Jon Diercks:
> sure that would work. I can think of other use cases like triggering flip flop from an LFO or beat pulse, but those could be implemented by first modulating a Note Event module, which in turn triggers a flip flop via midi source.
Doing it in MIDI Source means the module becomes even more flexible, and also means I can do it sooner. A new module usually takes a bit more time to think about various details etc.
(Just realised that my answers didn't appear the ones I was answering, so I copy pasted your comments for clarity)
Update:
But to be fair, I can see pros/cons of both approaches, so maybe I'll let these ideas brew for a bit longer and not rush implementing it.Jon Diercks
Nikolozi, sounds fine, and you're right there are some advantages to doing it as an expansion of the existing midi source module.
Nikolozi
Jon Diercks and another thing, that occurred to me, should velocity be ignored? I guess it should be, doesn't have much meaning here. Like if velocity is 102, does that mean modulation should jump up to 80% (=102/127) and then maybe down to 20%?
Jon Diercks
Nikolozi hmm could be useful, but I'd want the option to ignore it.
Nikolozi
Jon Diercks yeah, I was just thinking out loud, don't think it's useful at all. So velocity probably should be ignored.
Jon Diercks
Nikolozi if for some reason I did want something like that I could probably wire up a separate midi source module instance for the velocity component and then combine that modulation with the flip flop via Multiply/Add. Yeah default for flip flop should be to toggle on every note-on, regardless of velocity.
Jon Diercks
One other possible wrinkle... I can imagine some scenarios where I would want a way to force the flip flop to a specific state, regardless of the current state. For example, if the flip flop was being used to control whether Strummer is going upward or downward, and the strumming pattern is partially random, might want to ensure that the first strum of each bar is always the same direction. In a hardware module I guess that would probably be done with a dedicated CV/gate input for resetting the cycle. Not sure what would make sense in the midi source module.
Jon Diercks
Nikolozi
Jon Diercks having a general way to reset state in a module would probably be great. At the moment, the LFO module, for example, has Trigger modes to reset. And it uses MIDI note-on events. I've thought about having another signal type like Gate, for things like this, but haven't been able to come up with anything useful yet, that just doesn't add more confusion with little benefit. Maybe there's a way to do it. Something to think about, I guess.
Re screen recording, can you explain how it works?
Jon Diercks
Nikolozi - for state reset, I would suggest that any modules that need it could just have a new "Reset" mod target added, which triggers when any >50% mod signal is sent to it.
My cobbled-together flip-flop works by using the Strummer module to track flip-flop state. On each new note-on from the keyboard, the Chord module sends a two-note chord to the strummer, which is set to 2 steps, one up and one down, thereby alternating between last-note-high and last-note-low on output. Then the Key Track MIDI Source module is set to modulate the Macro Button, which in turn modulates two Macro sliders +100%/-100%, just to demonstrate a possible use case that flips between two signal paths.
I'm not in a rush to actually use this, but it was bugging me that I couldn't figure out a way to do it. A dedicated flip-flop option in the MIDI Source module would be much better, of course.