# Using KSP to change delay sync



## Andrew Aversa (May 30, 2013)

In my current project, I'm automating the delay sync of send delays simply by having multiple delay sends which are bypassed / un-bypassed as the user changes sync. The problem with this method is that I am limited in sync possibilities to my # of slots. 

I've heard there are issues with delay sync and KSP but I'm curious what the best known method is. It does not need to necessarily work in real-time as it would only happen when the user changes their sync option.


----------



## Luca Capozzi (May 31, 2013)

Since you don't need it in real time, you can keep that thing simple by setting delay time knob with set_engine_par. To get the right values you need for your UI (don't know if you'll be using a dropdown menu or a knob) just assign a knob on delay time and set a message on its callback. In this way you can then set an array with all correct values you need.

Cheers,
Luca


----------



## Andrew Aversa (May 31, 2013)

I was thinking that, but the time is different for every possible Bpm, right? Talking to other devs, it does seem like a gigantic lookup array for every possible (reasonable) value is the only way to go, but it seems like an enormous amount of work if I want, say, 9 different sync values across 100+ different tempos. 

I admit, I was playing around with a nonlinear regression earlier and I could not come anywhere close to the right formula.


----------



## Luca Capozzi (May 31, 2013)

it's not so huge... on delay you have just to click on "ms" label and switch it to tempo synced values. since it's synced, it would fit on every host bpm change.


----------



## mk282 (May 31, 2013)

The engine parameter values change for each .01 change in BPM, it's impossible to cover all values with a lookup array unfortunately. I have devised a quite complicated workaround involving empty groups to make it work to an extent... Quite tricky to explain. But it's possible.


----------



## Raptor4 (May 31, 2013)

zircon_st @ Thu May 30 said:


> In my current project, I'm automating the delay sync of send delays shorter by having multiple delay sends which are bypassed / un-bypassed as the user changes sync.


You can try next for the synced Delay Send:
1. You can set the Sync to say 16th or smaller (32th etc) note as shown in the image below.
2. In this scenario you will need two arrays for the UI control:
* One array which will use fixed values to recall a given 1.0, 2.0, 3.0 etc of the Delay Time synced parameter. In our example using the 16th (500000 will recall 1.0 and set the sync to 16th note), (600000 will recall 2.0 and set the sync to 8th note) etc.
* Regarding your 1st array design you can create an Array with Names like 1/2, 1/4, 1/8, etc for the Sync time UI.

Doing that you will need one send for the Synced Delay and one send for the "Free" one, so your original trick with the Del Sync On/Off will toggle two delays only via the Sync On/Off UI button or what else. The Sync On/Off button can Hide/Show two different UIs (one for the Sync and one for the Free) for example or you can create one combo etc.

____________________
www.audiogrocery.com


----------



## paoling (May 31, 2013)

I'm working with LFO's,but I think it's very similar situation (although the knob is inverted).

What I see is that if we change the BPM, and we set the frequency of the LFO to the same ep number, the real LFO frequency remains the same (even if the Knob position is the same) . It's like when the knob is set to "sync", it only changes the way the information is displayed, and often it's a ratio between the HZ and the musical figure selected.

So if we want to use EP numbers, there's no advantage in setting the knob to "sync". 

Apart from... comparing strings?

:-/

The only way I suppose is using a kind of interpolation between the different found values...


Paolo


----------



## Luca Capozzi (May 31, 2013)

never noticed that before.. when you set a knob to sync, the value of the parameter will be different from bpm to bpm even if the signature remains the same. Anyway, i figured out a cheap workaround that seems to work. Here's an example


```
on init
 declare $curr_tempo
 declare $tempo

 declare ui_knob $test(0, 1000000, 1)
 $test := get_engine_par($ENGINE_PAR_DL_TIME, -1, 0, 1)

 $curr_tempo := ms_to_ticks(60000000)/960
 set_listener($NI_SIGNAL_TIMER_MS, 1000)
end on

on listener
 $tempo := ms_to_ticks(60000000)/960
 if($tempo # $curr_tempo)
  $test := get_engine_par($ENGINE_PAR_DL_TIME, -1, 0, 1)
  $curr_tempo := $tempo
  message("Tempo changed")
 end if
end on
```


----------



## Andrew Aversa (May 31, 2013)

Raptor4 @ Fri May 31 said:


> zircon_st @ Thu May 30 said:
> 
> 
> > In my current project, I'm automating the delay sync of send delays shorter by having multiple delay sends which are bypassed / un-bypassed as the user changes sync.
> ...



I'm afraid I don't follow. Can you explain this a little more? I don't understand how the 0-1000000 value corresponds to sync delay values or why you are using two delays here.


----------



## Raptor4 (May 31, 2013)

zircon_st @ Fri May 31 said:


> I'm afraid I don't follow. Can you explain this a little more? I don't understand how the 0-1000000 value corresponds to sync delay values or why you are using two delays here.


Hi Andrew,
I have created a NKI monolith (get it from below) where I have packed a click sample so you can try that. My KSP prototype uses two Delay FX instances inserted as sends. Try to tweak the Sync button and the Delay Time Knob to see how it woks. As I pointed in my 1st post the 16th note can be replaces with shorter ones so you can have more Sync type combinations. The only thing I have not made in my example is to create a "Name Label" array for the Sync durations such as 1/8, 1/4 etc so they will be shown as 2.0, 4.0 etc. I do similar dynamic labeling in my *ORPHEUS* LFO & PXF sync/rate faders (I show that in OPRHEUS Video 2). To my opinion the sends "Bypass" idea is not OK, though I did this way in the prototype. It will be better if you toggle the current "send" dB value with "Inf" for the given send to prevent any delay bleeding during the Sync button switching.
___________________
www.audiogrocery.com


----------

