Hihat choke with implementation with user-defined MIDI inputs
-
Hi guys, I'm trying to convert an old instrument to HISE and I'm running into a head scratcher as far as implementing Hi Hat choke.
I put together some code that allows the user to map their MIDI inputs for each kit-piece using an array for the source (the actual mapping in the samplemap) and the trigger (the assignable midi input).
// create source array (value is MIDI note) reg kitSource = []; kitSource[0] = 1; // defines kick main source kitSource[1] = 2; // defines snare main source kitSource[2] = 3; // defines snare rimshot source kitSource[3] = 4; // defines snare crossstick source kitSource[4] = 5; // defines snare rim source kitSource[5] = 6; // defines hihats closed source kitSource[6] = 7; // defines hihats open source kitSource[7] = 8; // defines hihats pedal source kitSource[8] = 9; // defines tom1 main source kitSource[9] = 10; // defines tom2 main source kitSource[10] = 11; // defines right_crash main source kitSource[11] = 12; // defines right_crash choke source kitSource[12] = 13; // defines right_crash bell source kitSource[13] = 14; // defines left_crash main source kitSource[14] = 15; // defines left_crash choke source kitSource[15] = 16; // defines left_crash bell source kitSource[16] = 17; // defines ride main source kitSource[17] = 18; // defines ride bell source kitSource[18] = 19; // defines ride crash source kitSource[19] = 20; // defines ride choke source kitSource[20] = 21; // defines china source //create trigger array (value is MIDI input note) reg kitTrigger = []; kitTrigger[0] = 36; // defines kick main trigger kitTrigger[1] = 38; // defines snare main trigger kitTrigger[2] = 40; // defines snare rimshot trigger kitTrigger[3] = 37; // defines snare cross stick trigger kitTrigger[4] = 71; // defines snare rim trigger kitTrigger[5] = 42; // defines hihats closed trigger kitTrigger[6] = 46; // defines hihats open trigger kitTrigger[7] = 44; // defines hihats pedal trigger kitTrigger[8] = 48; // defines tom1 main trigger kitTrigger[9] = 43; // defines tom2 main trigger kitTrigger[10] = 57; // defines right_crash main trigger kitTrigger[11] = 58; // defines right_crash choke trigger kitTrigger[12] = 105; // defines right_crash bell trigger kitTrigger[13] = 49; // defines left_crash main trigger kitTrigger[14] = 50; // defines left_crash choke trigger kitTrigger[15] = 93; // defines left_crash bell trigger kitTrigger[16] = 51; // defines ride main trigger kitTrigger[17] = 30; // defines ride bell trigger kitTrigger[18] = 59; // defines ride crash trigger kitTrigger[19] = 118; // defines ride choke trigger kitTrigger[20] = 52; // defines china trigger
(Side note: I chose to map my samples the bottom of the keyboard because I can't find a way to prevent the midi passing through instead of being aliased to the trigger only. If you have a solution for that, please let me know! I tried Message.ignoreEvent but that only prevent the samples from playing. I think because of the for loop?)
In my onNote fuction I call this:
function onNoteOn() { //Console.print(Message.getNoteNumber()); for(var index = 0; index < 127; index++){ if(Message.getNoteNumber() == kitTrigger[index]){ Message.setNoteNumber(kitSource[index]); } } }
I've found several solutions for choke groups on the forum but none that I could figure out on my own how to apply a choke group to my code. Any ideas?
-
This post is deleted! -
This post is deleted! -
@ObsydianX Sorry I didn't understand your question at first, and maybe still :)
Is this what you want to accomplish?
function onNoteOn() { var nn = Message.getNoteNumber(); if (isDefined(kitSource[nn])) Message.setNoteNumber(kitTrigger[nn]); }
-
There is a choke group midi processor that might be helpful.
-
@d-healey I saw that and I experimented with it but I honestly have no idea how to make it work. Because my end users can reassign the MIDI notes that actually trigger the kit, the low and high note in the choke processor probably won't work for me. I think I need a different solution.
-
@ulrik Might be on a different page. I've got the user selected MIDI working just fine, but I need a way for one note to cut off another note.
-
If you‘re doing the reassignment before the ChokeProcessor using setTransposeAmount(), the choke settings can be static - otherwise the range parameters of this module can also be controlled by a script.
-
@Christoph-Hart Now, pretend like you’re explaining it to a 5 year old. Haha. I mean, I just learned how to use my first arrays.
I’m honestly tempted to post the project on GitHub and collaborate with everyone on a drum sampler template.
-
@ObsydianX said in Hihat choke with implementation with user-defined MIDI inputs:
Now, pretend like you’re explaining it to a 5 year old. Haha. I mean, I just learned how to use my first arrays.
Maybe start with a simpler project ;)
A MIDI processor is like any other module, you can set its parameters from your main interface script. So when the user re-assigns the triggers keys you can (via scripting) change the range of the choke group MIDI processor. Or as Christoph said you can use the transposition function to handle the key remapping.
-
@d-healey I was never able to work this out but I found an easy solution by just limiting the voices for each thing I want choked to 2 and putting them in their own sampler. Not the most realistic but it's all I can figure out for now.
I learn by tackling the problems before me, not necessarily by trying different things first. My main reason for switching to HISE is because I'm trying to build a drum sampler, not much else. Therefore any issues I have with building a sampler is something I HAVE to overcome because I'm not really trying to become a programmer or developer, just hoping to be able to create what's on my mind.
That all being said, I'm going to put this project on github once I'm finished building the UI so anyone else can use it as a starting block for their own drum sampler. Hopefully, more people working on it will help it become a really good starting template for others.
My hope for the future of HISE is to implement something along the lines of Kontakt's exclusive groups via UI not scripting because it's pretty useful to have.