# Dynamic Filter for Kontakt



## José Herring (Apr 10, 2008)

Don't laugh.  

Last night at about 10pm I decided to build using scripting a DEF like filter for Kontakt so I started to learn how to script. Not soon after I realized OMG!!! The manual assumes that you already know just a little bit about programming which I know not. Heeeeelllllppppppppp.

This is what I got so far:

on init
declare ui_knob $Freq (0,1000000,1000000)
declare ui_knob $Mod (0,1000000,1000000)
declare ui_button $Bypass

end on

on ui_control ($Freq)
_set_engine_par($ENGINE_PAR_CUTOFF,$Freq,0,0,-1)
end on


on ui_control ($Bypass)
_set_engine_par($ENGINE_PAR_EFFECT_BYPASS,$Bypass,0,0,-1)
end on

on ui_control ($Mod)
_set_engine_par($ENGINE_PAR_EXTMOD_INTENSITY,$Mod,0,0,-1)
end on


This is just the beginning of course. What I'm trying to do is to get the script to load and assign a low pass then to use an EQ to tied to velocity. I've got buttons for the filter, and intensity as you can see, but I can't find out how to tie in the EQ freq to a button.

I'm at the early stages of course but if anybody would like to give me some pointers on how to understand the basics I can fill in the rest.

best,

Jose


----------



## José Herring (Apr 10, 2008)

Just what I feared. My first post on the Kontakt forum and it's too stupid for anybody to respond.

Ah well, back to sweatin' the manual....

Jose


----------



## Thonex (Apr 10, 2008)

Hi Jose :D 

Sorry for taking so long to get to you. No question is "too stupid"... only the ones left unasked are 8) 

I'm not entirely sure what the DEF filter does in Giga, so maybe you can describe a little more what you're going after.


Looking at your script, I see you got right into the _set_engine_par() commands... good for you bro!!!


When you say: _" I've got buttons for the filter, and intensity as you can see, but I can't find out how to tie in the EQ freq to a button..."_ 

Do you mean controlling the EQ freq with a 'knob' or a button? A button is either 'on' or 'off' ... so I'm not sure I'm following you here.

Welcome to the addicting world of KSP =o 

T


----------



## kotori (Apr 10, 2008)

Hi Jose,

Glad to see you take the dive into the programming world. I have written a script tutorial for beginners so if you find it useful you can use it as a complement to the tutorial written by NI.

I've also written a free text editor for script files (actually it's much more than that but all the extra features are purely optional). The newest version includes a searchable KSP reference (View menu -> KSP reference) of all variables and functions available. So to find the right engine parameter just search for "freq" and look for the results that are related to EQ. To save you the trouble in this case it's probably $ENGINE_PAR_FREQ1, $ENGINE_PAR_FREQ2 and $ENGINE_PAR_FREQ3 you are looking for.

Double-clicking on a variable/function in the KSP reference inserts it into the script code. I hope this helps.

Best,
Nils


----------



## José Herring (Apr 11, 2008)

Thank you to both.

T,

Yes I mean knobs.

The purpose of the script is to smooth out velocity layers and to provide a musical way to play/program instruments that only have one velocity.

I especially want to use it on drums. I've also used it on a k2 bass to good effect.

My plan is to use a low pass filter then to modulate an EQ with velocity. I have one knob to control the lp cuttoff and one knob to control the modulation intensity. I'm looking for a way to control the freq of a one band EQ. I think Kotori's suggestion will solve that.

Then of course I need to get it all setup and established because as of right now I'm having to change the slot # because everything is being loaded manually. But I did get this thing to work. Now to just make it efficient.

best,

Jose


----------



## Thonex (Apr 11, 2008)

josejherring @ Fri Apr 11 said:


> Thank you to both.
> 
> T,
> 
> ...



I think it's great you're getting in to this Jose. But you know... I think what you're trying to do could (if I'm understanding you correctly) be achieved in K2 without scripting. Just assign a filter and EQ to a group and assign velocity as a modulator for the EQs freq.

T


----------



## kotori (Apr 11, 2008)

Jose, you just got me thinking. Some time ago I wrote an effect preset script which is capable of saving and loading instrument effect presets (I used it on Scarbee Black Bass for example). But the step from that to a script that morphs between different effect presets is not long, so I added this morphing feature and now I have a little proof-of-concept script which lets one save two presets and then morph between them using mod-wheel. For example one can load five different instrument effects, setup two presets with different effect parameters and then let the script morph by crossfading between each pair of effect parameter values.

It seems to me that one could do pretty cool things with something like this. For example: 
use a script-generated lfo instead of modwheel to control the morph ratio
morph not just between two presets but setup chains of effect presets: preset 1 -> preset 2 -> preset 3 and so on.
activate certain effect presets using user-customizable keyswitches
I wonder if there would be a general interest in such a script.
Anyway, thanks for getting me thinking in right direction.  

- Nils


----------



## José Herring (Apr 11, 2008)

Kotori your morph script would be great for musical sound design work.
T,

Yeah I know it can be done without scripting. That's what I do now. The only thing is that every time I need it I have to manually go through setup the low pass, EQ, then assign all the modulation info. Then if I want to tweek it I have to move all the sliders, and cuttoff ect. My hope with the script is I would be able to load the script and then bam! Everything would be in place and I can tweak it via knobs.


This little thing would be just the beginning. Also, I wanted to learn how to script and it seem a good idea to do something that I already know how to do without scripting.

best,

Jose


----------



## José Herring (Apr 11, 2008)

Thank you both. 

Yes I intend to use it mostly on single shot drums in SD and also with impact effects that are recorded in one strike.

I think it's a bit too ambitious for me to think that I'll get anything as complex as DEF anytime soon. 

Jose


----------



## gmet (Apr 13, 2008)

Hi Benjamin,

What is the trigger to shift between EQs? - velocity?
Would it be posible to assign it to a CC#?

Justin


----------



## kotori (Apr 13, 2008)

Justin M @ Sun Apr 13 said:


> Hi Benjamin,
> 
> What is the trigger to shift between EQs? - velocity?
> Would it be posible to assign it to a CC#?
> ...



I don't know the details of the code, but I think you could delete the current 'on note' callback and add this code:

*on note*
``disallow_group(ALL_GROUPS)
``allow_group(find_group("group1"))```````
*end on*

*on controller*
``Use(0, 1, CC[1], 100, find_group("group1"))``_{ change the 1 in CC[1] to use another CC# }_
*end on*


----------



## gmet (Apr 13, 2008)

Thanks Benjamin & Nils - I'll give it a try.

Justin


----------

