Got a question about releases in KSP. So I'm trying to make the releases so that when group 1 has been played it will trigger on release group 2 no matter what, and the same pattern for the other groups. Got 8 groups in total. I believe it has to be scripted, or else the releases on chords just triggers a bunch of the other groups which it can't in this case.
What am I doing wrong here? Having a hard time understanding the KSP reference manual on these parameters, so any help would be greatly appreciated! The chord time tolerance script is from Nils Liberg originally posted on Native Instruments Kontakt forum, just need it to work with multiple groups with their respective release groups.
The comments in the on release part is just what I thought the code would do, but doesn't seem to do.
on init
declare $rr { round-robin state (range: 0-7) }
declare $last_note_time
declare const $CHORD_TIME_TOLERANCE := 25 { milliseconds }
end on
on note
{ go to next round-robin state if not too close in time to previous note }
if ($ENGINE_UPTIME - $last_note_time > $CHORD_TIME_TOLERANCE)
$rr := ($rr + 2) mod 8
$last_note_time := $ENGINE_UPTIME
end if
{ allow only the group with index corresponding to the RR state }
disallow_group($ALL_GROUPS)
allow_group($rr)
end on
on release
disallow_group($ALL_GROUPS)
allow_group(1)
allow_group(3)
allow_group(5)
allow_group(7)
if ($ENGINE_UPTIME - $last_note_time > $CHORD_TIME_TOLERANCE)
$last_note_time := $ENGINE_UPTIME
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0) = 0) {if the note is from this group, 0 (which is group 1)}
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,1) {change the note destination to 1 (which is group 2, the release)}
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0) {play the note in 1 (group 2, the release)}
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,2) = 2)
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,3)
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0)
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,4) = 4)
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,5)
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0)
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,6) = 6)
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,7)
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0)
end if
end on
What am I doing wrong here? Having a hard time understanding the KSP reference manual on these parameters, so any help would be greatly appreciated! The chord time tolerance script is from Nils Liberg originally posted on Native Instruments Kontakt forum, just need it to work with multiple groups with their respective release groups.
The comments in the on release part is just what I thought the code would do, but doesn't seem to do.
on init
declare $rr { round-robin state (range: 0-7) }
declare $last_note_time
declare const $CHORD_TIME_TOLERANCE := 25 { milliseconds }
end on
on note
{ go to next round-robin state if not too close in time to previous note }
if ($ENGINE_UPTIME - $last_note_time > $CHORD_TIME_TOLERANCE)
$rr := ($rr + 2) mod 8
$last_note_time := $ENGINE_UPTIME
end if
{ allow only the group with index corresponding to the RR state }
disallow_group($ALL_GROUPS)
allow_group($rr)
end on
on release
disallow_group($ALL_GROUPS)
allow_group(1)
allow_group(3)
allow_group(5)
allow_group(7)
if ($ENGINE_UPTIME - $last_note_time > $CHORD_TIME_TOLERANCE)
$last_note_time := $ENGINE_UPTIME
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0) = 0) {if the note is from this group, 0 (which is group 1)}
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,1) {change the note destination to 1 (which is group 2, the release)}
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0) {play the note in 1 (group 2, the release)}
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,2) = 2)
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,3)
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0)
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,4) = 4)
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,5)
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0)
end if
if (get_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,6) = 6)
set_event_par_arr($EVENT_ID,$EVENT_PAR_ALLOW_GROUP,0,7)
play_note ($EVENT_NOTE,$EVENT_VELOCITY,0,0)
end if
end on