# Question about arpeggiator [SOLVED]



## Claud9 (Dec 3, 2016)

Adding a moving playhead (or something similar) to an arpeggiator (please see attached image) is something complicated? No idea how to do it.
Thanks for any suggestion.


----------



## geronimo (Dec 4, 2016)

Perhaps labels on or under every steps which indicate the step's values ?


----------



## Claud9 (Dec 6, 2016)

geronimo said:


> Perhaps labels on or under every steps which indicate the step's values ?


thanks for the help, I will try to understand how to do it with your suggestions!


----------



## geronimo (Dec 6, 2016)

Claud9 said:


> Thanks for any suggestion.


A request was made: I answered but I am certainly unable to implement it _


----------



## Lindon (Dec 6, 2016)

I use a simple button, with an "empty box" image in it that matches the table height and one column width and move it along over the table.


----------



## geronimo (Dec 6, 2016)

Claud9 said:


> thanks for the help, I will try to understand how to do it with your suggestions!


----------



## Claud9 (Jan 9, 2017)

I'm still searching a solution for this.... Is there a code example somewhere? It is too complicated for my scripting skills. Thanks in advance for any help!


----------



## EvilDragon (Jan 10, 2017)

Use another table (make it small vertically) with range 1 (so possible values are 0 to 1), on every arp step set the value of the array index for the current step to 1, but before clear the whole table to 0.


----------



## Lindon (Jan 10, 2017)

what Mario says, then its a resizeable table too...


----------



## Yahiaamine (Jan 12, 2017)

declare ui_table name[columns](width, height, value)
i think this function could help you


----------



## Claud9 (Jan 13, 2017)

Yahiaamine said:


> declare ui_table name[columns](width, height, value)
> i think this function could help you


Hi thanks for the help. Create a table is the part I know , It's the other part of the script I have trouble to do


----------



## EvilDragon (Jan 13, 2017)

Follow my steps and that's it.


----------



## Claud9 (Jan 13, 2017)

EvilDragon said:


> Follow my steps and that's it.


Yes I know and thanks for the help, the problem for me as usual is to translate your steps in code.


----------



## EvilDragon (Jan 13, 2017)

Just think about it really hard and use trial and error. Please don't expect code to be handed to you on a silver plate. Do some hard work sometimes - best way to learn!


----------



## Claud9 (Jan 13, 2017)

EvilDragon said:


> Follow my steps and that's it.


So now I have this new table, just below the main arp table set like you wrote. When I change the step value it moves exactly like the main one. But now how can I link to the arpeggiators steps? This passage is not clear to me.Thanks in advance for any help!


```
declare ui_table %Pattern[32] (5,5,100)
    move_control_px(%Pattern,85,115)
    set_control_par(get_ui_id(%Pattern),$CONTROL_PAR_WIDTH,460)
    set_control_par(get_ui_id(%Pattern),$CONTROL_PAR_HEIGHT,120)
    make_persistent(%Pattern)
    set_table_steps_shown(%Pattern,$Steps)
     
    declare ui_table %Pattern_led[32] (5,5,1)
    move_control_px(%Pattern_led,85,234)
    set_control_par(get_ui_id(%Pattern_led),$CONTROL_PAR_WIDTH,460)
    set_control_par(get_ui_id(%Pattern_led),$CONTROL_PAR_HEIGHT,8)
    make_persistent(%Pattern_led)
    set_table_steps_shown(%Pattern_led,$Steps)

    on ui_control($Steps)
     
    set_table_steps_shown(%Pattern,$Steps)
    set_table_steps_shown(%Pattern_led,$Steps)
```


----------



## Claud9 (Jan 13, 2017)

EvilDragon said:


> Just think about it really hard and use trial and error. Please don't expect code to be handed to you on a silver plate. Do some hard work sometimes - best way to learn!


It's what I'm trying to do


----------



## EvilDragon (Jan 13, 2017)

You need a while loop that clears all steps of that table to 0 and then set it to 1 for the step that is currently active, gotta do this in your arp loop.


----------



## Claud9 (Jan 13, 2017)

EvilDragon said:


> You need a while loop that clears all steps of that table to 0 and then set it to 1 for the step that is currently active, gotta do this in your arp loop.


I m pretty sure that "while(%Pattern[0] =1" is not the correct way to individuate the active arp step but at least there is something correct here? Thanks for any help !

```
%Pattern_led[0]  := 0
    %Pattern_led[1]  := 0
    while(%Pattern[0] = 1) 
    %Pattern_led[0]  := 1
    wait($step_length)
    end while
    %Pattern_led[0]  := 0
    %Pattern_led[1]  := 0
    while(%Pattern[1] = 1)
    %Pattern_led[1]  := 1
    wait($step_length)
    end while
```


----------



## Claud9 (Jan 13, 2017)

EvilDragon said:


> You need a while loop that clears all steps of that table to 0 and then set it to 1 for the step that is currently active, gotta do this in your arp loop.


This seems to work but I think the wait statement is wrong? 

```
$count :=0
    while ($count <= 3)
     %Pattern_led[$count]  := 0
     $act_step  := 0
    %Pattern_led[0]  := 1
    wait($step_length)
    inc($count)
    end while

  $count :=0
    while ($count <= 3)
     %Pattern_led[$count]  := 0
     $act_step  := 1
    %Pattern_led[1]  := 1
      wait($step_length)
    inc($count)
    end while

   
     $count :=0
    while ($count <= 3)
     %Pattern_led[$count]  := 0
     $act_step  := 2
    %Pattern_led[2]  := 1
     wait($step_length)
    inc($count)
    end while

  $count :=0
    while ($count <= 3)
     %Pattern_led[$count]  := 0
     $act_step  := 3
    %Pattern_led[3]  := 1
    wait($step_length)
    inc($count)
    end while
```


----------



## EvilDragon (Jan 14, 2017)

You're totally off base. Try again. You need exactly ONE while loop to clear the table then set the current step to 1.


----------



## Claud9 (Jan 14, 2017)

EvilDragon said:


> You're totally off base. Try again. You need exactly ONE while loop to clear the table then set the current step to 1.


Is there a part at least that is correct, like how I clear the table, or is all wrong?


----------



## EvilDragon (Jan 14, 2017)

You have too much going on in the while loop if all you want to do is clear it. Just set all steps to 0 and that's it. Then just set the currently running step of the arp (you have that as a variable for sure) to 1 and that's all. Simple, but it seems that your brain is not wired for programming unfortunately (no hard feelings). :/


----------



## Claud9 (Jan 14, 2017)

I'm a sound designer and my goal is to use my own sounds in my own kontakt engines. My goal is not to become a pro programmer for sure. I'm trying to modify the default Arp script that comes with Kontakt and since It is a script that I have not written from scratch I'm having difficulties in how and where to insert that code.
I have inserted this part of code at the beginning of the "on note" and it successfully clear the table I have created:

```
$count :=0
while ($count < 31)
     %Pattern_led[$count]  := 0
```

But I'm having problems understanding how and where to insert the part of code that set the currently active step to 1. 
I think the variable I have to use is $act_step but I don't know how and where...
Thanks in advance to anyone with a suggestion.


----------



## EvilDragon (Jan 14, 2017)

Yeah, that's the variable you have to use, and you should use it in the while ($NOTE_HELD) part (including the clearing the table part).


----------



## Claud9 (Jan 14, 2017)

EvilDragon said:


> Yeah, that's the variable you have to use, and you should use it in the while ($NOTE_HELD) part (including the clearing the table part).


I can't find a ($NOTE_HELD) while loop. $NOTE_HELD is not present at all in that Arp script...


----------



## EvilDragon (Jan 15, 2017)

Ah, right. Factory script?

Do it before $act_step gets incremented.


----------



## Claud9 (Jan 15, 2017)

EvilDragon said:


> Ah, right. Factory script?
> 
> Do it before $act_step gets incremented.


It works, thanks!


----------

