Yes of course, but I rather tought of a monophonic musical phrase played with the right hand. Apart if you strum your chords, playing chords with the right hand would lead to an unpredictable choice of the single note affected by the aftertouch, so I excluded the use case where you would play chords with the right hand.
OK, it seems to be a GPScript bug (not a bug in the GPScript from @pianopaul). As a workaround, you will have to add:
On NoteOffEvent(m : NoteMessage) from MIN
SendNow(MIN,m)
End
nop, I did not…
I does work but NOT using the MIDI IN (OMNI)
So, on the left is using the OMNI - on the right is the actually MIDI device. strange no?
edit:
so this is using the actuall MIDI device
I have only virtual MIDI devices on my test laptop and the Note OFF are not sent whatver the virtual MIDI device.
I’m confused — it doesn’t matter what you do with right hand — if you press down on one key, all the other notes that are sounding via what you’re playing with left hand will be impacted by that aftertouch.
Yes you are right, if you send them to the same instance of the plugin this is what will happen. You are very right
You will need two instances of the plugin to make it work like I thought.
Ok for the NOTE OFF, but it still is erratic. @pianopaul
Only one value of Polyphonic aftertouch message… (one fast press of G2 note)
and don’t know why it changes MIDI channel?
Try to add -1 in this line:
CH = GetChannel(m)-1
And modify this other line:
MM = MakeMidiMessage(160 + CH, NN, GetAfterTouchValue(m))
Sorry, the script was quick&dirty (between 2 Zoom-Sessions…)
No worries @pianopaul Im having fun troubleshooting with @David-san
SO this last corrections gives us the “transformation” BUT… only one note at a time, that is
- when you press example G2 and then go to C3, only this last note is affected (even if you press harder on G2)
- G2 is then unaltered
edit: I can make a video showing this is needed… to better understand?
With Channel Aftertouch we have no information about the played note.
So with the script we are coming from a general information to a detailled information…
But we could use an array (or NoteTracker?) to hold information about played notes and then create polyphonic aftertouch for all currently not “Note Offed” notes.
This could be a better way overall !!
Let me think
From Brain to Keyboard…many chances for bugfixing and improvement
Var
MIN : MidiInBlock
MM : MidiMessage
VV : Integer
CH : Integer
NN : Integer
NA : Integer Array
i : Integer
on Activate
For i=0; i<128; i=i+1 Do
NA[i] = 0
end
End
On NoteOnEvent(m : NoteMessage) from MIN
SendNow(MIN,m)
CH = GetChannel(m)
NN = GetNoteNumber(m)
NA[NN] = 1
End
On NoteOffEvent(m : NoteMessage) from MIN
SendNow(MIN,m)
NA[NN] = 0
End
On AfterTouchEvent(m : AfterTouchMessage) from MIN
for i=0; i<128; i=i+1 Do
if NA[i] == 1 then
MM = MakeMidiMessage(160 + CH, i, GetAfterTouchValue(m))
SendNow(MIN, MM)
end
end
End
ummm, no Polyphonic aftertouch messages
and Script logger error:
Array index out of bounds
Try this:
Var
MIN : MidiInBlock
MM : MidiMessage
VV : Integer
CH : Integer
NN : Integer
NA : Integer[128]
i : Integer
on Activate
For i=0; i<128; i=i+1 Do
NA[i] = 0
end
End
On NoteOnEvent(m : NoteMessage) from MIN
SendNow(MIN,m)
CH = GetChannel(m)
NN = GetNoteNumber(m)
NA[NN] = 1
End
On NoteOffEvent(m : NoteMessage) from MIN
SendNow(MIN,m)
NA[NN] = 0
End
On AfterTouchEvent(m : AfterTouchMessage) from MIN
for i=0; i<128; i=i+1 Do
if NA[i] == 1 then
MM = MakeMidiMessage(160 + CH, i, GetAfterTouchValue(m))
SendNow(MIN, MM)
end
end
End
We got messages back,
but not yet, Its the same behaviour, this time both notes get the messages no matter what note pressed…
and it changes MIDI channel?
That we cannot avoid because the On AfterTouchEvent does not have any information about the pressed note…
That is MIDI Standard for Channel Aftertouch
Please try this again;
Var
MIN : MidiInBlock
MM : MidiMessage
VV : Integer
CH : Integer
NN : Integer
NA : Integer[128]
i : Integer
on Activate
For i=0; i<128; i=i+1 Do
NA[i] = 0
end
End
On NoteOnEvent(m : NoteMessage) from MIN
SendNow(MIN,m)
CH = GetChannel(m)
NN = GetNoteNumber(m)
NA[NN] = 1
End
On NoteOffEvent(m : NoteMessage) from MIN
SendNow(MIN,m)
NA[NN] = 0
End
On AfterTouchEvent(m : AfterTouchMessage) from MIN
for i=0; i<128; i=i+1 Do
if NA[i] == 1 then
MM = MakeMidiMessage(160 + CH-1, i, GetAfterTouchValue(m))
SendNow(MIN, MM)
end
end
End
There is nothing else to do. With only one aftertouch ribbon under all the keys of the keyboard you can only have one aftertouch value.
Then you can think of strategies regarding which played notes will have this aftertouch message and which won’t. e.g. with polyphonic aftertouch and MIDI split, you can have the left hand not having its own aftertouch value and the right hand having another one. Or you can think of any other strategies for having aftertouch only on the last n played notes, the higher or lower note or whatever. You could also play a plugin from two different controllers and have different aftertouch applied to one unique plugin synth depending on the aftertouch on each of the controllers. But, I still don’t exactly know, if musically speaking, it makes sense… well, there is probably a way to use it…
Maybe @David-san is right
Its a bit better, not yep there…
Still no “separation” of control between notes, the latest note (PolyAT messages) still has control of both held notes.
**carefull with volume - sound is Basic waveform - no filters-.
this is using the Xkey keyboard set to PolyAftertouch straight to Pigments