Selecting sound layer via Combobox
-
Hello everyone,
I'm attempting my first simple project, I want to create an instrument where I have a number of pads/textures and a menu to select just one of them from the batch. As I understand that using many samplers is bad practice, I thought to stack said sounds on different velocity levels in the same sampler, and then selecting only one via scripting (yes, very Kontakt but that's where I come from).A screenshot of my sampler:
Here's what I have in the NoteOn CB:
function onNoteOn() { local menu_select = sample_vel_map[ComboBox1.getValue()-1]; Console.print(menu_select); Message.ignoreEvent(1); Synth.playNote(Message.getNoteNumber(), menu_select+1); }
menu_select is a variable that reads the velocity values from a predefined array, according to the sound selection from a combobox.
It works at isolating only one sound layer and muting the others, but I lose control of the volume envelope, which I guess is because of the ignoreEvent command. In other words, the sample keeps playing and ignores note off messages.
I also understand that the NoteOff command is deprecated, but I can't find a way to set an event in the NoteOn callback so that I can use NoteOffByEventId in the NoteOff CB.
Any idea?
Also, is my approach valid or should I rethink it? -
@Giuseppe If you use a global modulator for velocity it should work. Place the global modulation container before (above) your sampler.
You can use
Synth.noteOffByEventId()
however there's a better option in your case. Don't ignore the event, and don't use playNote. Just change the velocity of the Message. -
@d-healey Thanks. I managed to get it by simply using setVelocity with no global modulators.
function onNoteOn() { local menu_select = sample_vel_map[ComboBox1.getValue()-1]; Console.print(menu_select); Message.setVelocity(menu_select); }
Well, I actually tried with a Global Velocity Modulator first, but I couldn't see a differenct except that the voice count goes 4x:
Here I'm just holding a single note:
Why does the global modulator affects the voice count?
-
@Giuseppe said in Selecting sound layer via Combobox:
Why does the global modulator affects the voice count?
No idea, I've not seen that before
-
@d-healey I've noticed that for some reason some zones are highlighted more than others in my Sample Map. Does this mean anything?
-
@Giuseppe That means you have multiple samples mapped to the same position.
-
@d-healey d'oh...:person_facepalming_light_skin_tone:
-
By the way, you could also use groups to separate your different sounds and have the menu set the active group.