# Close HiHat cut off open HiHat



## d.healey (Jul 9, 2013)

I'm working on a drum kit instrument at the moment and have a little problem. When the HiHat closed note is played it is set to turn off the last played HiHat open note.

I do this by storing the EVENT_ID in an array (indexed by EVENT_NOTE) when the open hihat is played, then when the closed hihat is played I do note_off(saved_event_id). However this doesn't work if the open hihat is played twice, only the last one will be cut off when the closed note is played. How can I get it to turn off all playing open hihat notes?


----------



## kb123 (Jul 9, 2013)

One way to do it would be to use get_event_ids() and find out which events were associated with your note of interest, that would catch all the events


----------



## mk282 (Jul 9, 2013)

I do this via event marks.


----------



## germancomponist (Jul 9, 2013)

I do this via voice groups, no scripting... .


----------



## mk282 (Jul 10, 2013)

That's the simple way out, using scripting is a lot more flexible, because you can do this down at the event level, and not depend on groups...


----------



## Raptor4 (Jul 11, 2013)

TotalComposure @ Tue Jul 09 said:


> However this doesn't work if the open hihat is played twice, only the last one will be cut off when the closed note is played. How can I get it to turn off all playing open hihat notes?


Hi,
I just created a complex script "HH Choking". I have declared and array which stores the Open HH ID history. Note, I use fade_out instead of note_off cause it works with more scenarios (like long or endless envelope release, play_note etc) where note_off does not work.


```
{***********************************************
HH CHOKING v1.0
Author: www.audiogrocery.com
Written by: Ivan Kovachev 
Modified: July 11, 2013
*************************************************}
on init
message("")
set_script_title("HH Choking")
make_perfview
declare const $ARRAY_SIZE := 10 {Set the Note ID history amount here}
declare %n_num_ids[$ARRAY_SIZE]
declare $id_pos
declare $i
declare ui_value_edit $OpenHH (0,127,0)
declare ui_value_edit $ClosedHH (0,127,0)
make_persistent($OpenHH)
make_persistent($ClosedHH)
end on

on note
if ($EVENT_NOTE=$ClosedHH)
$i:=0
while($i<$ARRAY_SIZE)
fade_out(%n_num_ids[$i],10000,1)
inc($i)
$id_pos:=0
end while
end if
if ($EVENT_NOTE=$OpenHH)
inc($id_pos)
%n_num_ids[$id_pos]:=$EVENT_ID
end if
end on

on release
if ($EVENT_NOTE=$OpenHH)
ignore_event($EVENT_ID)
end if
end on
```
Cheers :wink: 
_____________________
www.audiogrocery.com


----------



## Raptor4 (Jul 12, 2013)

Hi,
Here is a little code update v1.1. In my original quick prototype there was a given scenario when the ARRAY SIZE which stores the Open HH IDs could exceed its border if the drummer loves to hit the Open HH mostly, without using the "Closed" one. /\~O 
I just fixed that and made some other slight changes as well. I have packed two HH samples in a monolith NKI for those who want to try it out - DOWNLOAD (393Kb).


```
{***********************************************
HH CHOKING v1.1
Author: www.audiogrocery.com
Written by: Ivan Kovachev 
Modified: July 12, 2013
*************************************************}
on init
message("")
set_script_title("HH Choking")
make_perfview
declare const $ARRAY_SIZE := 20 {Set the Note ID history amount here}
declare %n_num_ids[$ARRAY_SIZE]
declare $id_pos
declare $i
declare ui_value_edit $OpenHH (0,127,0)
declare ui_value_edit $ClosedHH (0,127,0)
make_persistent($OpenHH)
make_persistent($ClosedHH)
end on

on note
if ($EVENT_NOTE=$ClosedHH)
$i:=0
while($i<$ARRAY_SIZE)
fade_out(%n_num_ids[$i],10000,1)
%n_num_ids[$i]:=0
inc($i)
end while
$id_pos:=0
end if
if ($EVENT_NOTE=$OpenHH)
ignore_event($EVENT_ID)
inc($id_pos)
if($id_pos=$ARRAY_SIZE-1)
$id_pos:=0
end if
%n_num_ids[$id_pos]:=play_note($EVENT_NOTE,$EVENT_VELOCITY,-1,0)
end if 
end on
```
Regards,
R4
______________________
www.audiogrocery.com


----------



## d.healey (Jul 17, 2013)

Thanks for all the responses, I'll like that HH script, and the event marks idea sounds like something I want to investigate further!


----------



## dpclarkson (Jul 22, 2013)

That's a very nice script indeed, and it works!
However, I'm struggling to find a way to perform
proper hihat foot-splashes in Kontakt with a hihat controller (Hart E-pedal II & Roland TD20)
The TD20 itself doesn't output a note when playing
a footsplash on the controller.

But I found this at chaoticbox (e-drum midi mapper):

"Foot Splash Time Threshold
A foot splash note is generated if the time between depressing the hi-hat pedal and releasing it is less than this value (in milliseconds). Quicker releases result in higher note velocities (i.e. louder splashes)."

Is there any way to translate this into a script?
I know that Kontakt can recognize the speed of
incoming notes, e.g. percussion legato, but can the same be done with controller data?
Basically, I'm trying to mimic the same behaviour
of the internal footsplash of the TD20, but I have no idea how it works.
Any help would be greatly appreciated!


----------

