Aftertouch on note on for snappier attacks

Hi,

have been playing around with a script that sends an aftertouch message as soon as I play a note on - with the value of the velocity of the note.

Why would you want this?
Was wondering why I don’t get snappy attacks with Linnstrument when directly modulating the VCA of a modular synth plugin via aftertouch. After looking at the midi stream I have an indication now: Before the note on the Linnstrument sends an aftertouch 0. And then the first non-zero aftertouch message at least 10 ms after the note on. I guess the synth is smoothing out the aftertouch value, so I never get attacks below these 10 ms. The idea was now to synthetically add an aftertouch message with GigPerformer directly after the note on. As we are off the USB bus at this point this is possible within the same millisecond. This hopefully improves attacks for synths that do internal smoothing for midi aftertouch. Usually people use ADSRs, so it’s not an issue for them. Not what you want for 3d expression controllers though…).

P.S.: Unfortunately I cannot really test it with the synth I wanted to use (VCV) because the MPE module only understands poly aftertouch :confused: Would be nice if we could also send PolyTouch instead of Channel Aftertouch via GPScript (haven’t found such a generator function, event handlers also don’t exist for that).

MIDI messages without the script:
16:44:26.309 channel 16 channel-pressure 0
16:44:26.310 channel 16 note-on C2 68
16:44:26.320 channel 16 pitch-bend 8148
16:44:26.321 channel 16 control-change 74 64
16:44:26.322 channel 16 channel-pressure 19
So the first non zero channel pressure arrives 12 ms after the note on

MIDI messages when the script is active:
17:47:57.601 channel 16 note-on C2 18
17:47:57.602 channel 16 channel-pressure 18
now we get the channel pressure that corresponds the velocity 0-1 ms after the note on. That’s better :slight_smile:

Script:
var
midiin2 : MidiInBlock

On NoteOnEvent(m : NoteMessage) from midiin2
var
velocity : Integer
channel : Integer
aftertouch : AfterTouchMessage

channel = GetChannel(m)
velocity = GetVelocity(m)
aftertouch = MakeAfterTouchMessageEx(velocity, channel)
SendNow(midiin2, m)
SendNow(midiin2, aftertouch)
End

Hmm, probably not a big deal to add an explicit callback for polytouch and to create a polytouch message.

Having said that, with a bit of hackery, you should be able to use the MakeMidiMessage function (which just takes byte values) to create your own PolyTouch events.

Also, there’s

On MidiEvent(m:MidiMessage) from block

and along with the GetByte function you could test for Polytouch events.

Ah, perfect, should do. Thanks!

OK — now I’m embarrassed — I figured I’d spend a few minutes and implement a polytouch callback – turns out this already exists in GPScript

On PolyTouchEvent(m : PolyTouchMessage) from Foo

End

Unfortunately I forgot to provide any access functions to get at the data so you still need to use the GetByte function to get data out of it! I’ll add explicit access functions for a future update

1 Like