onNoteOn: Engage multiple MIDI events
-
Hey Gang,
How can I engage multiple MIDI Events with a single MIDI note?
Im trying to create a one-touch drum generator. I have samples loaded on C,D,E,F,G & A. When I press B, I would like it to engage the previous keys as well.
I see how I can do it with a button on the GUI, but how can I do it via onNoteOn so its engaged via MIDI?
-
@trillbilly said in onNoteOn: Engage multiple MIDI events:
I see how I can do it with a button on the GUI, but how can I do it via onNoteOn so its engaged via MIDI?
Same way you do it for a button. Just use the note on callback instead of the button's callback.
-
@d-healey Hi David. Thanks but I couldn't get that to work.
I forgot to note that all of the individual drum sounds are in their own sampler. So I have 6 samplers total that I'm trying to engage with MIDI #71.
Here is the original from an old chord gen project:
inline function onCHORD1Control(component, value) { if (value) { Synth.playNote(60, 64); Synth.playNote(64, 64); Synth.playNote(67, 64); Synth.playNote(48, 64); Synth.playNote(36, 64); } else Engine.allNotesOff(); }; Content.getComponent("CHORD1").setControlCallback(onCHORD1Control);
Here is what I used in my onNoteOn:
if (Message.getNoteNumber() = 71) { Synth.playNote(60, 64); Synth.playNote(62, 64); Synth.playNote(64, 64); Synth.playNote(65, 64); Synth.playNote(67, 64); Synth.playNote(69, 64); } else Engine.allNotesOff();
I have a feeling this is way off.
-
Take advantage of HISE's modularity. Note triggering should not be done from your UI script, this script should be deferred and the MIDI stuff handled by other, non-deferred, scripts.
In this snippet I'm using sine wave gens instead of samplers. Each sine wave generator has a script called noteSetter. The script has two knobs, trigger and note. Set the trigger to 71, all other notes will be ignored, and set the note to the note number you want to play.
This works by redirecting the incoming note number using
Message.setNoteNumber
.HiseSnippet 1232.3oc6YstaaaCElxNLX1YMXsnXX+TnX+vAHHvNqWFPPPct3TXz5DuH2r8u.FoisIrDolDsa7F1qwdcVA1KvdT5av1gRxQxIZINdcqoc1+PP7bg7biemifaGHsgvPY.wnTmw9.w3yoViEp960mwEjl6SLVk1hEpf.yXR6N1mEFBNDCihuPSvnzRjneu646xbYBaHkDgbhjaCuh6wUoTaW+kbW2CXNPGtWFoeb8l1RwdRW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