Script: translate Aftertouch to CC1 and rescale 0-127 -> 63-127

Hi there

I am not so familiar with scripting. I hope somehow you can help me out.
In order to avoid using different virtual outputs of BOME translator and to avoid using the Panels view with knobs I need a script which translates an aftertouch value to a CC1 value and rescales it for example from 0-127 to 63-127 or from 0-127 to 63 to 95 directly in the wiring view, the only view I need.
I use a Mac Studio M2 with GP 5.1.1, Bome Translator, Divisimate 2.0.6 and mainly Spitfire Audio BBCSO Pro

Thank you so much for helping me out.
I apologize if the topic is covered in other threads which I could not find.

mvc82

If I have understood correctly, this may do what you want. Add a scriptlet block to your wiring and cut and paste this into the editor.


// Set default values
const CC_NUM : Integer = 1
const SCALE_MIN : Integer = 63
const SCALE_MAX : Integer = 127

var cc : ControlChangeMessage

// Called when an aftertouch (channel pressure) message is received
On AfterTouchEvent(m : AfterTouchMessage)
    var value : Integer = GetAfterTouchValue(m)
    SendNow(cc.WithCCValue(ScaleInt(value,0,127,SCALE_MIN,SCALE_MAX)))
End

// Called automatically after script is loaded
Initialization
    cc = MakeControlChangeMessage(CC_NUM, 0)
End

1 Like

Dear Spav!

Thank you so much for your reply and for your script. I have tested it and it works perfectly! Simply great!

Cheers mvc82

1 Like

For a simple conversion without scaling you can use inbuilt functionality

1 Like