kontakt

Kontakt 6 KSP Wavetable Control - UI_Wavetable

I recently tried to figure out how to implement some of the new KSP features in Kontakt 6, and hit a wall when trying to implement the new UI_Wavetable control. Scripting the wavetable position onto a slider was easy, but for some reason making a visible wavetable would not work. So to save you some time, here's a brief explanation of how to implement UI_Wavetable and also how to make a wavetable position knob.

Kontakt 6 KSP UI_Wavetable

The new KSP reference manual for Kontakt 6 does have a section on UI_Wavetable, but they left something out - how to actually map the UI_Wavetable to a specific zone. First, you want to declare your wavetable in your on init function:

declare ui_wavetable $wt

Next, open up the expert tab and click the zone tab - this will show a list of the samples (or wavetables) in your instrument, and the zone ID that goes with them. Use that ID in the following code (in this case its zone ID 1). This piece is missing in the KSP reference manual, and I couldn't find anything online about it. To figure this out I opened up the script for Analog Dreams by Native Instruments, copied it into a text editor, and did a search for anything referencing wavetable or WT. Not sure why they left this piece of information out, maybe its obvious to some people but it wasn't to me.

set_control_par(get_ui_id($wt),$CONTROL_PAR_WT_ZONE,1)

Now you can go through and assign the position, width, height, wave color, and background alpha (and more, just reference the KSP manual for the other parameters).

move_control_px($wt,50,50)

set_control_par(get_ui_id($wt), $CONTROL_PAR_WIDTH,145)

set_control_par(get_ui_id($wt), $CONTROL_PAR_HEIGHT,32)

set_control_par(get_ui_id($wt), $CONTROL_PAR_WAVE_COLOR, 9ff00000h)

set_control_par(get_ui_id($wt), $CONTROL_PAR_BG_ALPHA, 0)

If you did all that correctly you should see a red wavetable on a clear background. Now we can look at the very simple code to implement the position slider:

declare ui_slider $position (0, 1000000)

Then we define a ui_control function for that slider (outside of the on init):

on ui_control ($position)

set_engine_par($ENGINE_PAR_WT_POSITION, $position, 0, -1, -1)

end on

At this point you will have a slider that controls the wavetable position, and also updates that ui_wavetable control you defined before.

For reference, here is the full script used in the instrument I made with this:

on init

make_perfview

set_ui_height_px(200)

declare ui_wavetable $wt

set_control_par(get_ui_id($wt),$CONTROL_PAR_WT_ZONE,1)

set_control_par(get_ui_id($wt), $CONTROL_PAR_WT_VIS_MODE, $NI_WT_VIS_2D)

move_control_px($wt,50,50)

set_control_par(get_ui_id($wt), $CONTROL_PAR_WIDTH,145)

set_control_par(get_ui_id($wt), $CONTROL_PAR_HEIGHT,32)

set_control_par(get_ui_id($wt), $CONTROL_PAR_WAVE_COLOR, 9ff00000h)

set_control_par(get_ui_id($wt), $CONTROL_PAR_BG_ALPHA, 0)

declare ui_slider $position (0, 1000000)

end on

on ui_control ($position)

set_engine_par($ENGINE_PAR_WT_POSITION, $position, 0, -1, -1)

end on

Reading next

GS Update - New website, new store!