What's new

How to phrase sync loops??

doomx3

New Member
I have started to make a new kontakt library. there is something I can't solve

I play a loop and then play another loop at the same time in the half of the bar. I want the second loop to start playing half of the bar, not from the beginning.

exactly the same as PHRASE SYNC in ACTION STRINGS

If you look at the attached file, it will be better understood.
 

Attachments

  • ezgif-6-322db431c807.gif
    ezgif-6-322db431c807.gif
    2.4 MB · Views: 22
Hi,

Here are two options I've just thought of:
  1. You can use ENGINE_UPTIME to mark the time the hihat sample starts (then save it to a variable, e.g. start_time), and by later using ENGINE_UPTIME-start_time, you're getting the cursor position in milliseconds. In "on note" callback and after the conversion to the sample position, you can ignore the event and use play_note() to retrigger the sample with the correct sample start.
    1. PROS: kick sample would be playing only when the key is pressed
    2. CONS: this method is not simple and 100% reliable (because the difference between two ENGINE_UPTIMEs can be +-1ms) - please note you can use a stopwatch timer using wait(), but I'd suggest first figuring it out with ENGINE_UPTIME before diving into that.
  2. You can make all samples play at the same time, store the ids into an array. In "on note" and "on release" callbacks, use set_event_par_arr() to turn the appropriate samples on and off (using keyword ALL_GROUPS).
    1. PROS: much simpler and reliable
    2. CONS: multiple voices playing at the same time
Best,
Patrik
 
Also, I forgot to mention the options above work in case you want to exactly turn on/off the samples. In case you'd like to sync them with external BPM, you may want to look into "Input Quantize" from Factory Scripts -> Performance.

If you opt for the first solution, you would need to store ($DURATION_BAR - $DISTANCE_BAR_START) into a variable and then use it twice: for an extra wait($DURATION_BAR - $DISTANCE_BAR_START) before the ignore_event() and play_note() commands and inside play_note() command to add to the sample start (after the conversion to sample position). Something in this fashion:

Code:
ignore_event($EVENT_ID)
calculated_sample_start := ($ENGINE_UPTIME-$start_time)*$sample_rate/1000
$wait_time := $DURATION_BAR - $DISTANCE_BAR_START
wait($wait_time)
play_note($EVENT_NOTE,$EVENT_VELOCITY,$calculated_sample_start + $wait_time*sample_rate/1000000,-1)

If you opt for the second solution, you can simply add the wait statement before set_event_par_arr().

Best,
Patrik
 
it is not necessary to script. Time Machine has a button called “Legato” it does exactly what you want. If you want to sync everything use a factory script called “input quantize”
 
it is not necessary to script. Time Machine has a button called “Legato” it does exactly what you want. If you want to sync everything use a factory script called “input quantize”
That is absolutely correct!

This option works perfectly if OP is fine with avoiding DFD mode and having all samples synced with DAW's metronome. However, it is much simpler and nicer.

The solution I suggested makes use of DFD, and the second sample would sync with the first regardless of the transport duration from the start of the bar (which is exactly how Action Strings work - which OP wanted to achieve).
 
Top Bottom