On Donnerstag, 27. Juni 2019 10:36:54 CEST Andrew C wrote:
> Am I SOL on scripting MIDI notes that can affect keyswitch areas of the
> keyboard?
> While I thought set_gig_dimension would point me in the right direction,
> but it does not seem to have any bearing on the keyswitch dimension.

These are two different things:

The keyswitch dimension is the standard solution that requires no scripting at 
all. So with that solution you just a) add a "keyboard" dimension with gigedit 
and b) define the keyswitching range with gigedit (low and high note of the 
keyswitching range. That's it.

If you want to implement keyswitchting by script instead, i.e. because you 
want a more fine graded keyswitching behaviour than the standard built-in one 
described above, then don't use the "keyboard" dimension. In fact when doing 
such things by script then I recommend you to pick a dimension type which 
would not trigger implied actions by the sampler. Because if you pick e.g. the 
"modulation wheel" dimension, then of course the sampler would switch 
dimensions if you rotate the modulation wheel, likewise if you pick the 
"keyboard" dimension the sampler would switch dimension when the keys of the 
instrument's keyswitch range are triggered.

In the NKSP instrument scripting examples that you find online, e.g. on the old 
LS  2.0 release notes:
http://doc.linuxsampler.org/Release_Notes/LinuxSampler_2_0_0/
I commonly used the "smartmidi" dimension instead for the purpose of switching 
the dimension regions by scripts, because that dimension type is not switched 
automatically by the sampler unless you have created iMIDI rules. [ Probably a 
more cleaner solution would be if we introduce some dedicated, new dimension 
type in the gig format for scripting purposes instead. ]. So with scripting 
you would e.g.. use

        if (%KEY_DOWN[28])

to check for a certain key currently being pressed down and then switch to the 
desired dimension zone of the smart midi dimension:

        gig_set_dim_zone($newNote, $GIG_DIM_SMART_MIDI, 2)

where the last argument stands for the precise dimension region zone you want 
to switch to.

About change_note() and set_event_par() not having any affect on the built-in 
"keyboard" dimension: that is not a bug, that's intended behaviour. These 
functions are intended to modify voice parameters, they are not really 
intended as MIDI filters. For MIDI event filtering KSP has a separate event 
handler which is currently not implemented in LS yet.

What you could also do though in the "on note" event handler you could use the 
ignore_event() function to drop the respective MIDI note on event, and then 
immediately call play_note() instead and pass the return value of the latter 
to git_set_dim_zone() and switch to the desired dimension zone.

CU
Christian


_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel

Reply via email to