Discussion:
[Linuxsampler-devel] Andrew's KISS instrument scripts: mono mode and alternation
Andrew C
2017-06-03 07:58:57 UTC
Permalink
Hey list,

Guess someone might find these scripts useful.

First one is a simple mono-mode script that makes the instrument monophonic
when the sustain pedal is pressed down.

The second one is a simple transposition script that alternates between
playing the note you've currently played and the note 3 octaves above it.
Useful for those sample libraries that have their up and down bows mapped
to different octaves on the keyboard.

Enjoy!

Andrew Coughlan.

Mono mode script:
--

on init
declare $active_note
end on

on note

ignore_event()


if (%CC[64] = 127)
note_off($active_note)
$active_note := play_note($EVENT_NOTE, $EVENT_VELOCITY)
else

$active_note := play_note($EVENT_NOTE, $EVENT_VELOCITY)

end if

end on

+++

Alternation script:
---

on init
declare $alt := 0
end on

on note

select $alt

case 0
change_note($EVENT_ID, $EVENT_NOTE) {up bow}
$alt := 1
case 1
change_note($EVENT_ID, $EVENT_NOTE+36) {down bow}

$alt := 0
end select

end on
Christian Schoenebeck
2017-06-03 11:36:49 UTC
Permalink
Post by Andrew C
Hey list,
Guess someone might find these scripts useful.
Just some tips on these ones ...
Post by Andrew C
if (%CC[64] = 127)
note_off($active_note)
$active_note := play_note($EVENT_NOTE, $EVENT_VELOCITY)
else
$active_note := play_note($EVENT_NOTE, $EVENT_VELOCITY)
end if
I would recommend you to always use a comparison like this

if (%CC[64] > 63)
...
end if

for any CC switches instead, especially since half damper (continuous) pedals
become more and more popular. Otherwise your script will not work for those
people.
Post by Andrew C
---
on init
declare $alt := 0
end on
on note
select $alt
case 0
change_note($EVENT_ID, $EVENT_NOTE) {up bow}
$alt := 1
case 1
change_note($EVENT_ID, $EVENT_NOTE+36) {down bow}
$alt := 0
end select
end on
Since you mentioned before that you have some legato/glissando gig files, you
might also have a look at gig_set_dim_zone():

http://doc.linuxsampler.org/Instrument_Scripts/NKSP_Language/Reference/gig_set_dim_zone_function/

That function is extremely useful for writing scripts for gig format sounds.
For example your legato/glissando sounds most probably have their alternative
samples mapped to zones of the "Smart MIDI" dimension. By calling the upper
function i.e. like this:

gig_set_dim_zone($myNoteID, $GIG_DIM_SMARTMIDI, 2)

you would force the sampler to pick the third zone (zero indexed) of the smart
midi dimension for the requested note, and hence you can force the sampler to
play a different sample to be played on the same key (/ same region).

Obviously you can also use this function with all other dimensions. If the
region has more than one dimension, you can also call this function more than
once on the same note, to specifically force one specific dimension zone for
each dimensions.

CU
Christian

Loading...