Need KSP Help: Small adjustments for a keyswitch note fade out/mute script for Kontakt
There are two adjustments I've been looking to make to a keyswitch note fadeout script that I've been working on for an instrument.:
- I'd like for the keyswitch to ignore any notes that I still have my fingers held down on, and to only fade out/mute the notes that I've taken my fingers off of.
- I'd like for the keyswitch to activate essentially from the initial note on event only (if that makes any sense). So if I were to play a note, then release my finger, the keyswitch would effectively fade out/mute the released notes, yet if I were to keep the keyswitch held down, the script would still allow for me to play any consecutive notes without fading out. Essentially making the initial triggering of the keyswitch the gate in which the fadeout is activated, as oppose to it being during the entire duration that the keyswitch is held down.
Side Note: The keyswitch uses C-1 as its trigger to fade out any resonating notes while or after a note has been played. The ADSR release envelope should also be turned all the way up for the script to work as intended
The Code:
on init declare $count declare $fade_out declare ui_knob $fade_time(10000,1000000,100000) set_text($fade_time,"Length") make_persistent($fade_time) move_control($fade_time,1,1) declare const $KEY_SWITCH := 12 set_key_color(12,$KEY_COLOR_RED) end on on note if ($EVENT_NOTE=$KEY_SWITCH) fade_out($ALL_EVENTS,$fade_time,0) $fade_out := 0 end if end on
...
I am not the best with scripting, so any help with this would be greatly appreciated!
Best Answers
-
Actually maybe a better way would be set marks on the released IDs, in the on release callback. And then fade out by marks with your keyswitch, so only the released IDS will have the mark and be faded out.
I'm not with Kontakt at the moment, but something like this in concept:
on note if ($EVENT_NOTE=$KEY_SWITCH) fade_out(by_marks($MARK_1), $fade_time,0) end if end on on release set_mark($EVENT_ID, MARK_1) end on
0 -
Missing $ before MARK_1.
0
Answers
-
Maybe use the %KEY_DOWN array to check if the notes are being held?
1 -
Not sure if I'm thinking of this the right way? I've got something like this, but it doesn't seem to work:
on note if ($EVENT_NOTE=$KEY_SWITCH) fade_out($ALL_EVENTS, $fade_time,0) $fade_out := 0 else ignore_event(%KEY_DOWN[13-127]) end if end on
0 -
Any idea how I would implement this into my script?
0 -
Actually maybe a better way would be set marks on the released IDs, in the on release callback. And then fade out by marks with your keyswitch, so only the released IDS will have the mark and be faded out.
I'm not with Kontakt at the moment, but something like this in concept:
on note if ($EVENT_NOTE=$KEY_SWITCH) fade_out(by_marks($MARK_1), $fade_time,0) end if end on on release set_mark($EVENT_ID, MARK_1) end on
0 -
For some reason I'm getting an "'end on' expected" error?
0 -
Missing $ before MARK_1.
0 -
This works! Heres the final script:
on init
declare $fade_out
declare ui_knob $fade_time(10000,1000000,100000)
set_text($fade_time,"Length")
make_persistent($fade_time)
move_control($fade_time,1,1)
declare const $KEY_SWITCH := 12
set_key_color(12,$KEY_COLOR_RED)
end on
on note
if ($EVENT_NOTE=$KEY_SWITCH)
fade_out(by_marks($MARK_1), $fade_time,0)
$fade_out := 0
end if
end on
on release
set_event_mark($EVENT_ID, $MARK_1)
end on
0 -
Please use the code block feature when pasting code in... Select your text and press the paragraph symbol, then quotation mark button:
2
Categories
- All Categories
- 19 Welcome
- 1.4K Hangout
- 60 NI News
- 735 Tech Talks
- 3.9K Native Access
- 15.9K Komplete
- 1.9K Komplete General
- 4.1K Komplete Kontrol
- 5.5K Kontakt
- 1.5K Reaktor
- 364 Battery 4
- 817 Guitar Rig & FX
- 416 Massive X & Synths
- 1.2K Other Software & Hardware
- 5.5K Maschine
- 7K Traktor
- 7K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators