Layout remapping script for grid controllers

Hi, my understanding is that you have a Seaboard set up to always send +/- 48 semitones pitch bend events.
And you have some rackspaces with Kontakt instances that expect +/- 12 semitones pitch bend range (and others that want +/- 48 semitones, thus you don’t want to change the setting on the seaboard).
My guess is that you could also set up Kontakt to use +/- 48 semitones - the loss of precision has already happened anyways. But you can also do that with a script (which can easily be derived from the script linked in the original posting).

  • ensure that there is a midi-in module in your rackspace. Right click, go to OSC/GPScript Handle->Set Handle and the handle to “midiin” (to match the name used in the script) and set a checkmark at “use in gpscript”
  • add the following script via Window->Current Rackspace script editor

var
midiin : MidiInBlock

On PitchBendEvent(m : PitchBendMessage) from midiin
var
pitchbendNumber : Integer
newPitchBendNumber : Integer
newPitchBendMessage : PitchBendMessage
channel : Integer

channel = GetChannel(m)
pitchbendNumber = GetPitchBendValue(m)
newPitchBendNumber = (pitchbendNumber - 8192) * 4 + 8192
if newPitchBendNumber > 16383 then newPitchBendNumber = 16383 end
if newPitchBendNumber < 0 then newPitchBendNumber = 0 end
newPitchBendMessage = MakePitchBendMessageEx(newPitchBendNumber, channel)
SendNow(midiin, newPitchBendMessage)
End