Can a slider change both an ir_sample and a second slider in Kontakt 5.8?

Sampler and Sampling discussion (techniques, tips and tricks, etc.)
Post Reply New Topic
RELATED
PRODUCTS

Post

AUTO-ADMIN: Non-MP3, WAV, OGG, SoundCloud, YouTube, Vimeo, Twitter and Facebook links in this post have been protected automatically. Once the member reaches 5 posts the links will function as normal.
I'm in dire need of some assistance on scripting in Kontakt.

Maybe there's a better way of going about this but this is how I would think it could work in my mind. I'm a noob at scripting.

Problem: Turn a knob to select through IR samples, but also give a read out of what the samples are.

What I've done is create a slider that controls ir_sample_menu selection. That works.
I've made the slider control another slider to act as a sort of image display. That works.

Image
The 'TYP' knob is meant to control the display panel below and select through IR.

My issue is that they will not work together.

Thanks for any and all suggestions.

Code: Select all (#)

on init

message("")
	make_perfview
	set_ui_height_px(665)
	set_ui_width_px(700)

		{declare ui_xy ?oystercursor[2]
		declare $xy_ID
		$xy_ID := get_ui_id(?oystercursor)
set_control_par_str_arr($xy_ID, $CONTROL_PAR_PICTURE, "Transparent",0)

set_control_par_str_arr($xy_ID, $CONTROL_PAR_CURSOR_PICTURE, "Card Cursor Tiny",0)

set_control_par($xy_ID, $CONTROL_PAR_MOUSE_MODE, 2)
set_control_par($xy_ID, $CONTROL_PAR_MOUSE_BEHAVIOUR_X, 1000)
set_control_par($xy_ID, $CONTROL_PAR_MOUSE_BEHAVIOUR_Y, 1000)

set_control_par($xy_ID, $CONTROL_PAR_POS_X, 0)
set_control_par($xy_ID, $CONTROL_PAR_POS_Y, 0)
set_control_par($xy_ID, $CONTROL_PAR_WIDTH, 700)
set_control_par($xy_ID, $CONTROL_PAR_HEIGHT, 665)

?oystercursor[0] := 0.5
?oystercursor[1] := 0.5

make_persistent (?oystercursor)}

	{********************************
	Declared Constants & Variables
	********************************}
	
	{Filter Control Constants}
	declare const $FILTER_PRESENT := 1          {<---- If you are using a filter (any type), set this to 1. If you don't want a filter, set this to 0 to hide controls.}
	declare const $FILTER_LOCAL := 1          {<---- Place a number of 1-8 that corresponds to the slot location of the Insert Effect.}
	declare const $RES_PRESENT := 1          {<---- If the filter you have chosen has a Resonance control, set to 1. Else, set to 0.}

	{Insert Reverb Control Constants}
	declare const $Reverb_PRESENT := 1          {<---- If you are using a Reverb (any type), set this to 1. If you don't want a reverb, set this to 0 to hide controls.}
	declare const $Reverb_INSERT := 1          {<---- Set to 1 if the Reverb is in an Insert Effect Slot. Set to 0 if it is in a Send Effect Slot.}
	declare const $Reverb_LOCAL := 2          {<---- Place a number of 1-8 that corresponds to the slot location of the Send Effect.}

    {Send Reverb Control Constants}
	declare const $IRC_PRESENT := 1          {<---- If you are using a Reverb (any type), set this to 1. If you don't want a reverb, set this to 0 to hide controls.}
	declare const $IRC_INSERT := 0          {<---- Set to 1 if the Reverb is in an Insert Effect Slot. Set to 0 if it is in a Send Effect Slot.}
	declare const $IRC_LOCAL := 1          {<---- Place a number of 1-8 that corresponds to the slot location of the Send Effect.}


	{Counter 1}
	declare $i := 0 

	{Counter 2}
	declare $ii := 0


	{********************************
	Creating the UI Controls
	********************************}


	{----ADSR Controls----}

		{Attack}
		declare ui_slider $Att (0, 1000000)
		make_persistent($Att)

		declare $Att_ID
		$Att_ID := get_ui_id($Att)
		set_control_par_str ($Att_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($Att, 57, 264)
		$Att := get_engine_par ($ENGINE_PAR_ATTACK,0,0,-1)
		set_control_par($Att_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		set_control_par($Att_Id, $CONTROL_PAR_VERTICAL, 1)

		{Delay}
		declare ui_slider $Dec (0, 1000000)
		make_persistent($Dec)
		declare $Dec_ID
		$Dec_ID := get_ui_id($Dec) 
		set_control_par_str ($Dec_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($Dec, 97, 264)
		$Dec := get_engine_par ($ENGINE_PAR_DECAY,0,0,-1)
		set_control_par($Dec_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		

		{Sustain}
		declare ui_slider $Sus (0, 1000000)
		make_persistent($Sus)
		declare $Sus_ID
		$Sus_ID := get_ui_id($Sus) 
		set_control_par_str ($Sus_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($Sus, 136, 264)
		$Sus := get_engine_par ($ENGINE_PAR_SUSTAIN,0,0,-1)
		set_control_par($Sus_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)

		{Release}
		declare ui_slider $Rel (0, 1000000)
		make_persistent($Rel)
		declare $Rel_ID
		$Rel_ID := get_ui_id($Rel)
		set_control_par_str ($Rel_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($Rel, 175, 264)
		$Rel := get_engine_par ($ENGINE_PAR_RELEASE,0,0,-1)
		set_control_par($Rel_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)


	{----LP Filter Controls----}

		{Cutoff}
		declare ui_slider $Cut (0, 1000000)
		declare $Cut_ID := get_ui_id($Cut)
		set_control_par_str ($Cut_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($Cut, 574, 264)
		$Cut := get_engine_par ($ENGINE_PAR_CUTOFF,-1,($FILTER_LOCAL-1),1)
		set_control_par(get_ui_id($Cut),$CONTROL_PAR_DEFAULT_VALUE,1000000)
		set_control_par($Cut_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		make_persistent($Cut)

		{Resonance}
		declare ui_slider $Res (0, 1000000)
		declare $Res_ID := get_ui_id($Res)
		set_control_par_str ($Res_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($Res, 613, 264)
		$Res := get_engine_par ($ENGINE_PAR_RESONANCE,-1,($FILTER_LOCAL-1),1)
		set_control_par(get_ui_id($Res),$CONTROL_PAR_DEFAULT_VALUE,0)
		set_control_par($Res_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		make_persistent($Res)


	{----Insert Reverb Controls----}

		{Insert Reverb Wet Mix}
		declare ui_slider $IRWM (0, 397000)
		declare $IRWM_ID := get_ui_id($IRWM)		
		set_control_par_str ($IRWM_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($IRWM, 97, 363)
		$IRWM := get_engine_par ($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN,-1,($REVERB_LOCAL-1),$REVERB_INSERT)
		set_control_par(get_ui_id($IRWM),$CONTROL_PAR_DEFAULT_VALUE,0)		
		set_control_par($IRWM_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		make_persistent($IRWM)

		{Insert Reverb Pre-Delay}
		declare ui_slider $IRPD (0, 1000000)
		declare $IRPD_ID := get_ui_id($IRPD)		
		set_control_par_str ($IRPD_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($IRPD, 134, 363)
		$IRPD := get_engine_par ($ENGINE_PAR_IRC_PREDELAY , -1, 1, 1)
		set_control_par(get_ui_id($IRPD),$CONTROL_PAR_DEFAULT_VALUE,0)
		set_control_par($IRPD_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		make_persistent($IRPD)

		{Insert Reverb Size}
		declare ui_slider $IRSZ (0, 1000000)
		declare $IRSZ_ID := get_ui_id($IRSZ)		
		set_control_par_str ($IRSZ_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($IRSZ, 174, 363)
		$IRSZ := get_engine_par ($ENGINE_PAR_IRC_LENGTH_RATIO_LR , -1, 1, 1)
		set_control_par(get_ui_id($IRSZ),$CONTROL_PAR_DEFAULT_VALUE,500000)
		set_control_par($IRSZ_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		make_persistent($IRSZ)

	{----Send Reverb Controls----}

		{Send Reverb Selector}

	declare !IRlist[21]
		!IRlist[ 0] := "ir_bishopsgate_clerkplacecourtyard"
		!IRlist[ 1] := "ir_bricklane_graffititunnel"
		!IRlist[ 2] := "ir_broadgate_central"
		!IRlist[ 3] := "ir_broadgatetower_breezeway"
		!IRlist[ 4] := "ir_canaltunnel_short"
		!IRlist[ 5] := "ir_councilestate_foyer"
		!IRlist[ 6] := "ir_councilestate_lowerlevel"
		!IRlist[ 7] := "ir_councilestate_upperlevel"
		!IRlist[ 8] := "ir_greenwichft_longways"
		!IRlist[ 9] := "ir_greenwichft_shortways"
		!IRlist[10] := "ir_leadenhallmarket"
		!IRlist[11] := "ir_leakestreet_largehall"
		!IRlist[12] := "ir_leakestreet_smallhall"
		!IRlist[13] := "ir_londonbridge_clinkstreet"
		!IRlist[14] := "ir_londonbridge_haysgalleria"
		!IRlist[15] := "ir_shoreditchplayground_slide"
		!IRlist[16] := "ir_shoreditchplayground_talkingtube"
		!IRlist[17] := "
		!IRlist[18] := "
		!IRlist[19] := "
		!IRlist[20] := "

	{declare const $SIRSEL_items := 21}

	declare ui_menu $SIR_menu
		add_menu_item($SIR_menu,"BYPASS", -1)
		add_menu_item($SIR_menu,"Bishopsgate Clerk Place Courtyard", 0)
		add_menu_item($SIR_menu,"bricklane_graffititunnel",1)
		add_menu_item($SIR_menu,"broadgate_central",2)
		add_menu_item($SIR_menu,"broadgatetower_breezeway",3)
		add_menu_item($SIR_menu,"canaltunnel_short",4)
		add_menu_item($SIR_menu,"councilestate_foyer",5)
		add_menu_item($SIR_menu,"councilestate_lowerlevel",6)
		add_menu_item($SIR_menu,"councilestate_upperlevel",7)
		add_menu_item($SIR_menu,"greenwichft_longways",8)
		add_menu_item($SIR_menu,"greenwichft_shortways",9)
		add_menu_item($SIR_menu,"leadenhallmarket",10)
		add_menu_item($SIR_menu,"leakestreet_largehall",11)
		add_menu_item($SIR_menu,"leakestreet_smallhall",12)
		add_menu_item($SIR_menu,"londonbridge_clinkstreet",13)
		add_menu_item($SIR_menu,"londonbridge_haysgalleria",14)
		add_menu_item($SIR_menu,"shoreditchplayground_slide",15)
		add_menu_item($SIR_menu,"shoreditchplayground_talkingtube",16)
		add_menu_item($SIR_menu,"",17)
		add_menu_item($SIR_menu,"",18)
		add_menu_item($SIR_menu,"",19)
		add_menu_item($SIR_menu,"",20)
    		
		move_control_px($SIR_menu,530,413)
		hide_part($SIR_menu, $HIDE_WHOLE_CONTROL)

		{move_control_px($SIR_menu,525,375)}

	declare ui_slider $SIR_menu_alias (-1, 20)
		set_control_par(get_ui_id($SIR_menu_alias),$CONTROL_PAR_AUTOMATION_ID,0)
		set_control_par_str(get_ui_id($SIR_menu_alias),$CONTROL_PAR_AUTOMATION_NAME,"Type")
		set_control_par_str (get_ui_id($SIR_menu_alias), $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($SIR_menu_alias, 535, 363)
		set_control_par(get_ui_id($SIR_menu_alias),$CONTROL_PAR_DEFAULT_VALUE,-1)		
		set_control_par(get_ui_id($SIR_menu_alias), $CONTROL_PAR_MOUSE_BEHAVIOUR, -300)
		make_persistent($SIR_menu_alias)
		make_persistent($SIR_menu)

	declare ui_slider $TFL_PXL_SIGN(-1,20)
		set_control_par_str (get_ui_id($TFL_PXL_SIGN), $CONTROL_PAR_PICTURE, "TFL Sign Animation")
		move_control_px($TFL_PXL_SIGN, 485, 434)
		set_control_par(get_ui_id($TFL_PXL_SIGN), $CONTROL_PAR_MOUSE_BEHAVIOUR, -300)
		make_persistent($TFL_PXL_SIGN)

    message("") 

		{Send Reverb Wet Mix}
		declare ui_slider $SRWM (0, 630000)
		make_persistent($SRWM)
		declare $SRWM_ID := get_ui_id($SRWM)
		set_control_par_str ($SRWM_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($SRWM, 575, 363)
		set_control_par(get_ui_id($SRWM),$CONTROL_PAR_DEFAULT_VALUE,0)		
		set_control_par($SRWM_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)

		{Send Reverb Pre-Delay}
		declare ui_slider $SRPD (0, 1000000)
		declare $SRPD_ID := get_ui_id($SRPD)		
		set_control_par_str ($SRPD_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($SRPD, 613, 363)
		$SRPD := get_engine_par ($ENGINE_PAR_IRC_PREDELAY , -1, 0, 0)
		set_control_par(get_ui_id($SRPD),$CONTROL_PAR_DEFAULT_VALUE,0)
		set_control_par($SRPD_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		make_persistent($SRPD)

		{Send Reverb Size}
		declare ui_slider $SRS (0, 1000000)
		declare $SRS_ID := get_ui_id($SRS)		
		set_control_par_str ($SRS_ID, $CONTROL_PAR_PICTURE, "Underground Knob Standard")
		move_control_px($SRS, 651, 363)
		$SRS := get_engine_par ($ENGINE_PAR_IRC_LENGTH_RATIO_LR , -1, 0, 0)
		set_control_par(get_ui_id($SRS),$CONTROL_PAR_DEFAULT_VALUE,500000)
		set_control_par($SRS_Id, $CONTROL_PAR_MOUSE_BEHAVIOUR, -500)
		make_persistent($SRS)
end on

{--------------------------------On UI Control Blocks--------------------------------}

{on ui_control (?oystercursor)
set_engine_par ($ENGINE_PAR_VOLUME,real_to_int(?oystercursor[1] * 630000.0),1,0,-1)
set_engine_par ($ENGINE_PAR_VOLUME,real_to_int(?oystercursor[0] * 630000.0),2,0,-1)

{Attack Control}
	on ui_control ($Att)
		$ii := 0
		while ($ii < $NUM_GROUPS)
			set_engine_par($ENGINE_PAR_ATTACK, $Att, $ii, 0, -1)
			inc ($ii)
		end while
	end on

{Decay Control}
	on ui_control ($Dec)
		$ii := 0
		while ($ii < $NUM_GROUPS)
			set_engine_par($ENGINE_PAR_DECAY, $Dec, $ii, 0, -1)
			inc ($ii)
		end while
	end on

{Sustain Control}
	on ui_control ($Sus)
		$ii := 0
		while ($ii < $NUM_GROUPS)
			set_engine_par($ENGINE_PAR_SUSTAIN, $Sus, $ii, 0, -1)
			inc ($ii)
		end while
	end on

{Release Control}
	on ui_control ($Rel)
		$ii := 0
		while ($ii < $NUM_GROUPS)
			set_engine_par($ENGINE_PAR_RELEASE, $Rel, $ii, 0, -1)
			inc ($ii)
		end while
	end on

{Cutoff Control}
	on ui_control ($Cut)
		set_engine_par($ENGINE_PAR_CUTOFF, $Cut, -1, ($FILTER_LOCAL-1), 1)
	end on

{Resonance Control}
	on ui_control ($Res)
		set_engine_par($ENGINE_PAR_RESONANCE, $Res, -1, ($FILTER_LOCAL-1), 1)
	end on

{Insert Reverb Wet Mix Control}
	on ui_control ($IRWM)
		set_engine_par($ENGINE_PAR_SEND_EFFECT_OUTPUT_GAIN, $IRWM, -1, ($Reverb_LOCAL-1), $Reverb_INSERT)
	end on

{Insert Reverb Pre-Delay Control}
	on ui_control ($IRPD)
		set_engine_par($ENGINE_PAR_IRC_PREDELAY, $IRPD, -1, 1, 1)
	end on

{Insert Reverb Size Control}
	on ui_control ($IRSZ)
		set_engine_par($ENGINE_PAR_IRC_LENGTH_RATIO_LR , $IRSZ, -1, 1, 1)
	end on


{Send IR Selector Control}
	
	{function select_sir_type
		$SIR_menu := $SIR_menu_alias

	end function}

	on persistence_changed
		$SIR_menu_alias := $SIR_menu
		$SIR_menu_alias := $TFL_PXL_SIGN
		{call select_sir_type}
	end on

	on ui_control($SIR_menu)
		$SIR_menu_alias := $SIR_menu
		{call select_sir_type}
	end on

	on ui_control($SIR_menu_alias)
	if	($SIR_menu_alias # $SIR_menu)
		$SIR_menu := $SIR_menu_alias
		{call select_sir_type}
	end if
	end on





	on ui_control($SIR_menu_alias)
	    if ($SIR_menu_alias = -1)        
			set_engine_par($ENGINE_PAR_SEND_EFFECT_BYPASS, 1, -1, 0, 0)

	    else
	        set_engine_par($ENGINE_PAR_SEND_EFFECT_BYPASS, 0, -1, 0, 0)
	        load_ir_sample(!IRlist[$SIR_menu_alias],0,0)

	    end if
	end on

	on ui_control($SIR_menu_alias)
	if	($SIR_menu_alias # $TFL_PXL_SIGN)
		 $TFL_PXL_SIGN := $SIR_menu_alias

	end if
	end on

{Send Reverb Mix Control}
	on ui_control ($SRWM)
		set_engine_par($ENGINE_PAR_SENDLEVEL_0, $SRWM, -1, 7, 0)
	end on

{Send Reverb Pre-Delay Control}
	on ui_control ($SRPD)
		set_engine_par($ENGINE_PAR_IRC_PREDELAY, $SRPD, -1, 0, 0)
	end on

{Send Reverb Size Control}
	on ui_control ($SRS)
		set_engine_par($ENGINE_PAR_IRC_LENGTH_RATIO_LR, $SRS, -1, 0, 0)
	end on


    

Post

You have two "on ui_control($SIR_menu_alias)" callbacks. That's why it doesn't work, if you have two, Kontakt will ignore one.

The other thing is, don't do that. That is, don't automate any convolution controllers. Adjusting size or loading an IR will make Kontakt process the sample file, it takes time, hits CPU and Kontakt can't handle it well. Flooding it with automation calls will crash the program.
You could try working around it by dismissing any calls until previous call is finished. In which case you may want use wait_async, which is not available in 5.8. And which I'm not sure if it works with convolution, can't remember at the moment.
Anyway, it's not worth the trouble.

Post Reply

Return to “Samplers, Sampling & Sample Libraries”