# Script module - effect presets



## kotori (Jun 21, 2007)

Hi everyone,
I wrote an http://nilsliberg.se/ksp/scripts/effect_presets.html (effect presets script module). It's free for noncommercial use (if anyone likes to use it commercially please contact me).

It's largely a reimplementation of Kontakt's effect presets in KSP. Using this module you can tell KSP things like: "store all current instrument effect settings as preset 4", or "load preset 5 and modify all instrument effect parameters accordingly". All that in three lines of code. Just to be clear: this script doesn't provide a script UI for modifying effects. What it does is to let you for example add a preset menu to your script performance view where the user can select presets. 

Compared to native effect presets it has two advantages:
* The user can select preset from a menu in the performance view which is more user friendly than installing preset files and then opening the instrument in edit mode.
* The script can change preset dynamically at any time.

There's also one disadvantage to using KSP for this:
* Scripts cannot load or unload effects, only set parameters for already loaded ones.

However, this can be overcome by loading all the effects you need and bypass the ones you don't need for each preset. The bypass button status is saved as part of each preset, so all you have to do is configure the effect parameters set the bypass buttons and then instruct the script to store the preset. I hope this explanation was clear enough. Feel free to ask otherwise.

Cheers,
Nils


----------



## polypx (Jun 21, 2007)

Nils,

This is a great idea! But I can't seem to get your editor to work (Mac 1.2 version)... it says it compiles okay, but there's actually nothing in the clipboard to paste. 

Any chance you can upload a compiled or KSP version?

cheers
Dan


----------



## kotori (Jun 21, 2007)

Hi Dan,
What I posted is just a general purpose module which can be imported by any other script, but it does nothing on it's own. Here's a little sample script which uses the above module. It assumes that the above source code (the text, not the html page) has been saved in a file called "EffectPresets.txt" in the same folder the script below. I made a http://nilsliberg.se/ksp/scripts/EffectPresetsUsage_compiled.txt (compiled version) available as well. Please note that this is not to be distributed as part of or in close connection to any commerical instrument. It's free for personal use though.

````*import* "EffectPresets.txt" *as* effect_presets

````*on init*
``````_{ initialize effect presets }_
``````effect_presets.on_init
``````
``````_{ setup preset menu: }_``
``````*declare* ui_menu preset
``````add_menu_item(preset, 'Preset 1', 1)``
``````add_menu_item(preset, 'Preset 2', 2)``
``````add_menu_item(preset, 'Preset 3', 3)````
``````add_menu_item(preset, '>> Save as Preset 1', -1)
``````add_menu_item(preset, '>> Save as Preset 2', -2)
``````add_menu_item(preset, '>> Save as Preset 3', -3)``
``````preset := 1``
``````make_persistent(preset)``
````*end on*

````*on ui_control*(preset)
``````*if* preset > 0
````````effect_presets.load_preset(preset)````_{ loads the selected preset }_
``````*else*
````````preset := -preset
````````effect_presets.store_preset(preset)```_{ saves the selected preset }_ 
``````*end if*
````*end on*


----------



## polypx (Jun 21, 2007)

Ah ha, I see ! This is really great!

cheers
Dan


----------



## Fernando Warez (Jun 21, 2007)

Sounds like a great idea.

Thank you!


----------



## Thonex (Jun 21, 2007)

Thanks Kotori... this looks like it could be a very handy script.... especially if I customize it for CC controllable loading... for personal use of course.  ... unless you want me to share it when I get to it.

Thanks again.... great work as always.

Oh... I should mention I had the same issue as someone else trying to paste the compiled code in to K2.1.... nothing was in the clipboard buffer... very odd. It seems to be only with this script... I can't reproduce this with any other script. Any ideas?

Cheers,

T


----------

