Zone Round Robin issue

JordonBeal
JordonBeal Member Posts: 11 Member

Hey all.

I'm having an issue with a round robin script. It's basically functional and working as intended, except for this:

Depending on how I have my MIDI mapping set up (I have menus and presets for this that are working perfectly), it will trigger random groups. It's almost like "disallow_group(ALL_GROUPS)" isn't working properly. I've been bashing my head against my desk trying to get this to work.

This is a trimmed-down version with an example mapping and two drum articulations. Each kit piece has multiple articulations per group. 8 round robins, with each articulation set 10 keys apart, starting on 0/C-2, then 10/A#-2, and so on.

I think I know the issue, in that in this example, when the Kick is triggered, and it plays a 0/C-2, the HatPedal is being triggered. I just can't figure out a workaround so that this doesn't happen.

on init
	declare $i
	declare $ArticulationOffset {Offset to determine what key the Round Robin playback starts on}
{*Round Robin*}
	declare %RRobinArr [8]
	declare $RRCount
	$RRCount := num_elements(%RRobinArr)-1
	declare $RR_1
	declare $RR_2


{*NOTE MAPPING*}
	declare $Art_Kick     := 36
	declare $Art_HatPedal := 0

end on

{*****************************************************************}
on note
{*****************************************************************}
	ignore_event(EVENT_ID)
	
	{*Round Robins*}
	 	{*Kick*}
 			if (EVENT_NOTE = $Art_Kick)
		 		disallow_group(ALL_GROUPS)
		 		allow_group(0)
		 		$ArticulationOffset := 0
				change_note(EVENT_ID, $ArticulationOffset+%RRobinArr[$RRCount])
		 		call RoundRobin
		 	end if


	 	{*HiHat*}
 			if (EVENT_NOTE = $Art_HatPedal)
		 		disallow_group(ALL_GROUPS)
		 		allow_group(270)
		 		$ArticulationOffset := 0
				change_note(EVENT_ID, $ArticulationOffset+%RRobinArr[$RRCount])
		 		call RoundRobin
				play_note($EVENT_NOTE, EVENT_VELOCITY, 0, 0)
		 	end if


end on


function RoundRobin
	inc($RRCount)
	if ($RRCount>=num_elements(%RRobinArr))
	$RR_1 := %RRobinArr[num_elements(%RRobinArr)-1]
	%RRobinArr[0] := 0
	$RRCount := 1
	while ($RRCount # num_elements(%RRobinArr))
	$RR_2 := random(0,$RRCount)
	%RRobinArr[$RRCount] := %RRobinArr[$RR_2]
	%RRobinArr[$RR_2] := $RRCount
	inc($RRCount)
	end while
	$RRCount := 0
	if (%RRobinArr[0]=$RR_1)
	%RRobinArr[0] := %RRobinArr[num_elements(%RRobinArr)-1]
	%RRobinArr[num_elements(%RRobinArr)-1] := $RR_1
	end if
	end if
end function

Answers

  • EvilDragon
    EvilDragon Moderator Posts: 1,021 mod

    Perhaps move your disallow_group() to the very top so that it is only happening once, before you check for any of the valid mappings. You don't need to repeat it in each and every case.

    Also, what is that play_note() doing there if you're doing change_note()? Or even better, why are you doing change_note() when you have ignore_event() at the top of note callback? Those should all be play_note() commands I reckon.

  • JordonBeal
    JordonBeal Member Posts: 11 Member

    Without play_note(), the script does nothing. It will transpose the key, and the round robin function works, but none of the zones are triggered, and without the ignore_event() at the top of on note, the zones are directly accessible, if I play notes 0-8 or 10-8 on a keyboard, it will be play every group that has a zone on that key.

  • EvilDragon
    EvilDragon Moderator Posts: 1,021 mod

    Right, so you should replace all instances of change_note() with play_note() only. It makes no sense to change_note() an ignored event ID.

  • JordonBeal
    JordonBeal Member Posts: 11 Member

    I'm afraid I don't follow. I'm using change_note() to trigger and cycle through zones within a group.

Back To Top