Release Trigger + Hammer On Issue

MTC84
MTC84 Member Posts: 49 Member

Hi,

I am having trouble figuring out how to script the On Release block for a Bass Guitar instrument...

I want the following behaviour from 4 groups - Pluck, Hammer On, Pluck Release, Hammer On Release.

  • If the hammer on code is active, the release trigger used for basic pluck notes should mute/not play when the note is release
  • The Hammer On release trigger group should only play on release of the hammer on note.

Coding for the hammer on's (group selects) is all working as it should.

When I copy the code from the On Note block to use it inside of the On Release block it results in no release triggers playing at all. Am I missing something?

Can anyone help me figure this out please? I've spent way too long trying and failing with this battle!

Many thanks in advance.

 on init
	make_perfview {makes the UI visible outside edit mode}
	set_script_title("HAMMER ON + RELEASE TRIGGERS TEST")
	declare const $UI_HEIGHT := 200
	set_ui_height_px(200)

	message ("")

	SET_CONDITION(NO_SYS_SCRIPT_RLS_TRIG)

	declare %id_tracker[128]

{ARTICULATION SELECT BUTTONS - FRET OPEN >}

	declare ui_switch $MONO_POLY_MODE_BUTTON
	move_control_px($MONO_POLY_MODE_BUTTON, 159, 10)
	set_text($MONO_POLY_MODE_BUTTON , "MONOPHONIC OR POLYHONIC MODE SELECT")
	set_control_par_str(get_ui_id($MONO_POLY_MODE_BUTTON), $CONTROL_PAR_PICTURE, "MONO_POLY_MODE_BUTTON")
	set_control_par(get_ui_id($MONO_POLY_MODE_BUTTON), $CONTROL_PAR_HEIGHT, 22)
	set_control_par(get_ui_id($MONO_POLY_MODE_BUTTON), $CONTROL_PAR_WIDTH, 22)
	set_control_par(get_ui_id($MONO_POLY_MODE_BUTTON), $CONTROL_PAR_TEXTPOS_Y, 2000)
	$MONO_POLY_MODE_BUTTON := 0
	make_persistent($MONO_POLY_MODE_BUTTON)
end on


{ON NOTE}

on note
	disallow_group($ALL_GROUPS)

{POLYPHINIC MODE - NO HAMMER ONS}

	if ($MONO_POLY_MODE_BUTTON = 0)
		allow_group(0) {PLUCK ON GRP}
	end if 

{MONOPHONIC MODE - HAMMER ONS}
{FRET - OPEN}

	if ($MONO_POLY_MODE_BUTTON = 1)

	%id_tracker[$EVENT_NOTE] := $EVENT_ID

		if (%KEY_DOWN[$EVENT_NOTE-0] = 1)
			note_off(%id_tracker[$EVENT_NOTE-1])
			allow_group(0) {PLUCK ON GRP}
		end if

		if (%KEY_DOWN[$EVENT_NOTE-1] = 1)
			note_off(%id_tracker[$EVENT_NOTE-1])
			allow_group(1) {HAMMER ON GRP}
		end if
	end if


	_reset_rls_trig_counter($EVENT_NOTE)
end on


{ON RELEASE}

on release

	disallow_group($ALL_GROUPS)

{POLYPHINIC MODE - NO HAMMER ONS}

	if ($MONO_POLY_MODE_BUTTON = 0)
		allow_group(2) {PLUCK RELEASE GRP}

	play_note($EVENT_NOTE, $EVENT_VELOCITY, 0, -1)
	end if 

{MONOPHONIC MODE - HAMMER ONS}

	if ($MONO_POLY_MODE_BUTTON = 1)

	%id_tracker[$EVENT_NOTE] := $EVENT_ID

	if (%KEY_DOWN[$EVENT_NOTE-0] = 1)
			note_off(%id_tracker[$EVENT_NOTE-1])
			allow_group(2) {PLUCK ON GRP}
	end if

	if (%KEY_DOWN[$EVENT_NOTE-1] = 1)
			note_off(%id_tracker[$EVENT_NOTE-1])
			allow_group(3) {HAMMER ON RELEASE GRP}
	end if

	play_note($EVENT_NOTE, $EVENT_VELOCITY, 0, -1)
end if
end on

Comments

  • MTC84
    MTC84 Member Posts: 49 Member

    I think what I need to do is have a code block to tell Kontakt to "ignore previous release trigger message (release trigger of the pluck group), If the next note message is a hammer on note."

    Is that even possible? I am starting to think it isn't as I'd need a time machine to go backwards in the script in real time?

    Thanks for any info.

Back To Top