Hey everybody,
I am trying to get a MidiInDevice object corresponding to one of my physical input devices. Specifically, I want to capture MIDI notes from that device, apply a velocity curve, and re-inject them into the input. This is based on an idea that David suggested in an older community post.
This is what I came up with so far:
var Lower : MidiInDeviceAlias
var curve_ns2 : CurveComponent
var curvepath_ns2 : String = "/path/to/Gig Performer/ScalingCurves/velocity.gpscale"
Initialization
If !CC_LoadFromFile(curve_ns2, curvepath_ns2) Then
Print("Error loading curve")
End
End
On NoteOnEvent(m : NoteMessage) from Lower
var newVelo : int
If GetMidiInDeviceFromRigManager("Lower") == "Nord Stage 2 MIDI Output" Then
newVelo = ParamToMidi(CC_Scale(curve_ns2, MidiToParam(GetVelocity(m))))
InjectMidiEventViaRigManager(Lower, WithVelocity(m, newVelo))
Else
InjectMidiEventViaRigManager(Lower, m)
End
End
Used as a Gig script, this works fine, but it is limited to the case where my Nord is assigned the “Lower” alias. I would prefer working directly on the physical input, regardless of alias. For the injection, I should be able to just use InjectMidiEvent with the device name, but for the callback header, I need a MidiInDevice that corresponds to my keyboard - and I just can’t figure out how to get that. Is there a way to do this?
Thanks!
Maybe an idea
Use 2 instances of GP
In the 1st instance you can use MIDI In block with velocity scaling and the send the MIDI messages via OSC to the 2nd instance.
Or when you are on Mac you can use IAC for sending MIDI between the instances.
You could also use GP Relayer for sending MIDI between the instances.
Thanks for the reply! I don’t think I’d even need a second instance in that scenario: I could just put my Nord input on the global rackspace, apply the curve, and feed it into an IAC (that I’d then use in RigManager). In fact, I had this set up a while ago and dismissed it due to latency concerns - which I must have dreamed up, because doing the same thing just a minute ago works perfectly fine
This is kinda embarrassing, but I guess I’ll just go with that then!
But since we’re here, just for me to understand the scripting bit better: If I said “var FooBar : MidiInDevice”, and my keyboard’s MIDI input was actually called “FooBar”, would it just work? And if so, does that mean my problem is that my actual input’s name has spaces, so I can’t reference it?
Very good idea.
You know that you can send MIDI between the global rackspace and the local rackspaces using the To Rackspaces and From Global Rackspace using the red connector in the right of the Plugins ?
1 Like
Yes, absolutely! I had thought about using those, but they don’t really solve my problem here: I often have multiple “keyboard zones”, so I’d need MidiIn blocks in my local rackspaces anyway. Feeding them from a device alias (rather than merge-feeding them from the global RS) is simpler, and also allows me to leverage Rig Manager’s powers 