Toggle note + time division control with notes

Hi, I’d like to toggle a note : sustained when note is on, stays sustained when off for the first time, and when note is sustained, a second press on this note will end the sustained + note off.

I can’t find how to do this.

I’d also like to convert midi notes to time division changes of the repeater or arpegiator.

The Goal is to make kick rolls, using keys/ notes to change time division.
Example :
C1 is the Four on the floor kick, toggle on/off
D1 is the 1/8 (twice faster roll) of this kick (active only when pressed
E1 is the 1/16 (twice faster roll) of this kick (active only when pressed …
and so on …

Thank you