I got stuck with my first scripting project

Options
Zeek Souza
Zeek Souza Member Posts: 4 Newcomer

Hi there...My name's Ezequiel, from Brazil...First of all, I wanna thank in advance for taking the time to help me with this... I tried to my limits to finish this without help, but unfortunately i got stuck with my first scripting project.


To shorten my story, I've been using kontakt as my vst instrument for over 10 years, but this time I decided to venture myself with scripting to create the following projetc:

A multitrack kit that will be triggered by a pad controller with knobs that will control the volumes of each track for each song, as shown on the picture bellow

so each pad will correspond to a song...

So far I managed to load and declare the songs fine, and even got to the part where the knobs do control the volumes for the separate parts, and thats where I got Stuck

....

I can only use the knobs for the first Song(pad), and I need for each Knob to control the part for all songs... i.e: Vocal knobs to control all vocal groups...


Here is the script I made so far


on init


set_ui_height_px(500)

set_control_par_str($INST_ICON_ID,$CONTROL_PAR_PICTURE,"Icon")

set_control_par_str($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE,"SHOW ZS BLOCO 1 REP2")

make_perfview


{Declara tracks}

  declare ui_slider $VOLUME_MASTER (0,1000000)

  set_control_par_str(get_ui_id($VOLUME_MASTER),$CONTROL_PAR_PICTURE,"pv_world_knob_big")

  set_control_par(get_ui_id($VOLUME_MASTER), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($VOLUME_MASTER,495,50)

  make_persistent ($VOLUME_MASTER)


  declare ui_slider $CLICK (0,1000000)

  set_control_par_str(get_ui_id($CLICK),$CONTROL_PAR_PICTURE,"pv_world_knob_big")

  set_control_par(get_ui_id($CLICK), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($CLICK,560,50)

  make_persistent ($CLICK)


  declare ui_slider $BATERIA (0,1000000)

  set_control_par_str(get_ui_id($BATERIA),$CONTROL_PAR_PICTURE,"Fader1")

  set_control_par(get_ui_id($BATERIA), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($BATERIA,485,110)

  make_persistent ($BATERIA)


  declare ui_slider $INSTRUMENTAL (0,1000000)

  set_control_par_str(get_ui_id($INSTRUMENTAL),$CONTROL_PAR_PICTURE,"Fader1")

  set_control_par(get_ui_id($INSTRUMENTAL), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($INSTRUMENTAL,550,110)

  make_persistent ($INSTRUMENTAL)


  declare ui_slider $BAIXO (0,1000000)

  set_control_par_str(get_ui_id($BAIXO),$CONTROL_PAR_PICTURE,"Fader1")

  set_control_par(get_ui_id($BAIXO), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($BAIXO,485,250)

  make_persistent ($BAIXO)


  declare ui_slider $VOCAL (0,1000000)

  set_control_par_str(get_ui_id($VOCAL),$CONTROL_PAR_PICTURE,"Fader1")

  set_control_par(get_ui_id($VOCAL), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($VOCAL,550,250)

  make_persistent ($VOCAL)


  declare ui_slider $SPEED (0,1000000)

  set_control_par_str(get_ui_id($SPEED),$CONTROL_PAR_PICTURE,"pv_world_knob_big")

  set_control_par(get_ui_id($SPEED), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($SPEED,495,400)

  make_persistent ($SPEED)


  declare ui_slider $TUNE (0,1000000)

  set_control_par_str(get_ui_id($TUNE),$CONTROL_PAR_PICTURE,"pv_world_knob_big")

  set_control_par(get_ui_id($TUNE), $CONTROL_PAR_MOUSE_BEHAVIOUR, -1000)

  move_control_px($TUNE,560,400)

  make_persistent ($TUNE)


{Declarar play}

   

  declare $Play_01

  declare ui_button $P

  make_persistent($P)

  read_persistent_var($P)

  set_control_par_str(get_ui_id($P),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P),$CONTROL_PAR_TEXT,"")

  move_control_px($P,60,100)


  declare $Play_02

  declare ui_button $P2

  make_persistent($P2)

  read_persistent_var($P2)

  set_control_par_str(get_ui_id($P2),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P2), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P2), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P2),$CONTROL_PAR_TEXT,"")

  move_control_px($P2,170,100)



  declare $Play_03

  declare ui_button $P3

  make_persistent($P3)

  read_persistent_var($P3)

  set_control_par_str(get_ui_id($P3),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P3), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P3), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P3),$CONTROL_PAR_TEXT,"")

  move_control_px($P3,280,100)


  declare $Play_04

  declare ui_button $P4

  make_persistent($P4)

  read_persistent_var($P4)

  set_control_par_str(get_ui_id($P4),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P4), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P4), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P4),$CONTROL_PAR_TEXT,"")

  move_control_px($P4,390,100)

   

  declare $Play_05

  declare ui_button $P5

  make_persistent($P5)

  read_persistent_var($P5)

  set_control_par_str(get_ui_id($P5),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P5), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P5), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P5),$CONTROL_PAR_TEXT,"")

  move_control_px($P5,60,208)


  declare $Play_06

  declare ui_button $P6

  make_persistent($P6)

  read_persistent_var($P6)

  set_control_par_str(get_ui_id($P6),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P6), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P6), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P6),$CONTROL_PAR_TEXT,"")

  move_control_px($P6,170,208)

 

  declare $Play_07

  declare ui_button $P7

  make_persistent($P7)

  read_persistent_var($P7)

  set_control_par_str(get_ui_id($P7),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P7), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P7), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P7),$CONTROL_PAR_TEXT,"")

  move_control_px($P7,280,208)


  declare $Play_08

  declare ui_button $P8

  make_persistent($P8)

  read_persistent_var($P8)

  set_control_par_str(get_ui_id($P8),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P8), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P8), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P8),$CONTROL_PAR_TEXT,"")

  move_control_px($P8,395,208)

   

  declare $Play_09

  declare ui_button $P9

  make_persistent($P9)

  read_persistent_var($P9)

  set_control_par_str(get_ui_id($P9),$CONTROL_PAR_PICTURE,"nord_button_led_6_2")

  set_control_par(get_ui_id($P9), $CONTROL_PAR_HEIGHT, 42)

  set_control_par(get_ui_id($P9), $CONTROL_PAR_WIDTH, 42)

  set_control_par_str(get_ui_id($P9),$CONTROL_PAR_TEXT,"")

  move_control_px($P9,60,318)



end on


{Controle Tracks}

on ui_control ($BATERIA)

set_engine_par($ENGINE_PAR_VOLUME,$BATERIA,0,-1,-1)


end on



{Controle Tracks}

on ui_control ($INSTRUMENTAL)

set_engine_par($ENGINE_PAR_VOLUME,$INSTRUMENTAL,1,-1,-1)


end on



{Controle Tracks}

on ui_control ($BAIXO)

set_engine_par($ENGINE_PAR_VOLUME,$BAIXO,2,-1,-1)


end on



{Controle Tracks}

on ui_control ($VOCAL)

set_engine_par($ENGINE_PAR_VOLUME,$VOCAL,3,-1,-1)


end on



..... I apologise for the inconvenience and for my written English(Since it's not my first language) hope someone can help me get through this problem

Comments

  • Zeek Souza
    Zeek Souza Member Posts: 4 Newcomer
    Options
    I hoped by now I'd get an answer... but as the french say...c'est la vie
    


  • medusa
    medusa Member Posts: 85 Helper
    Options

    You have four volume sliders controlling the volume of groups 0, 1, 2, and 3 (BATERIA, INSTRUMENTAL, BAIXO, and VOCAL). Maybe your other songs are not in those four first groups?

  • Zeek Souza
    Zeek Souza Member Posts: 4 Newcomer
    edited January 24
    Options

    well its exactly my issue... i've 16 groups for each isntrument (16 BATERIA, 16 INSTRUMENTAL, 16 BAIXO, and 16 VOCAL) and I need to assing The 4 Knobs to control the volume all 16 corespondent samples...(i.e.: BATERIA knob will control the volume of all 16 BATERIA groups)... and so on.... can I achieve that?


    Thanks for the resnponse, by te way!!!

  • medusa
    medusa Member Posts: 85 Helper
    edited January 24
    Options

    So for each, you need to loop through all the groups that you need to change. We usually do this with a counter variable and a while loop.

    So for set_engine_par($ENGINE_PAR_VOLUME,$VOCAL, 3 ,-1,-1), where it currently says "3" (the group choice) you need to use your variable and do something like this.

    $counter := 0
    while ($counter < 16)
    set_engine_par($ENGINE_PAR_VOLUME,$VOCAL, $counter ,-1,-1)
    inc($counter)
    end while
    

    But the problem you might see right away here is that this changes the FIRST 16 groups, from group 0 to group 15. So that might not be how your instrument is structured.

    You could go back and structure your instrument so that group 0-15 was all the vocals, 16-32 was all the Baixa, etc. But you could also do it a couple of other ways.


    If the structure of your instrument is such so that every fourth group is correct, you could do something like this, jumping 4 groups each time:

    $counter := 0
    while ($counter < 64)
    set_engine_par($ENGINE_PAR_VOLUME,$VOCAL, $counter ,-1,-1)
    $counter := $counter + 4
    end while
    

    You would need to make sure you start at the correct place for each set.



    A third way is using an array to define the set of groups for each type, ie. %array_baixa[16]. Define the array with the correct collection of group numbers, and use the counter to step through the array like this:

    $counter := 0
    while ($counter < 16)
    set_engine_par($ENGINE_PAR_VOLUME,$VOCAL, %array_baixa[$counter] ,-1,-1)
    inc($counter)
    end while
    


  • Zeek Souza
    Zeek Souza Member Posts: 4 Newcomer
    Options

    thanks man, ill give it a try... ill let you know how it goes

Back To Top