# LCB is "crazy"



## KSPstudent (Nov 9, 2017)

LCB is "crazy" at 100 & 50 BPM. I have no idea why. It works perfectly on 99, 101, even on 100,1 BPM but starts to jumping on 100.

Some info:
set_listener($NI_SIGNAL_TIMER_BEAT,24)
I do modulo to catch 1/16, 1/8, etc.

Maybe you have any ideas. If I need to add more info, I'll do.


----------



## EvilDragon (Nov 10, 2017)

Usually one counts ticks instead of using modulo for different note divisions. Never had trouble with LCB using that method.


----------



## Lindon (Nov 10, 2017)

I count/modulo beat divisions - as this allows my script to sync with DAW tempos easily - never had this problem.


----------



## EvilDragon (Nov 10, 2017)

Counting ticks also syncs to DAW tempos without fail, at least from my experience...


----------



## KSPstudent (Nov 10, 2017)

Hmm. When I set a listener to BEAT/24 - problems on 80,100,120 BPM. Listener starts to "swing". When I set it to BEAT/16 and declare another dividers as well - works good. Have no idea why.

P.S. I have this problem only when running a sequence in a DAW. If Running = 0, works good. But I don't use any variables like NI_SONG_POSITION.


----------



## EvilDragon (Nov 11, 2017)

This is kinda hard to troubleshoot without the actual code.


----------



## geronimo (Nov 11, 2017)

Out of curiosity, what is the LCB ?


----------



## EvilDragon (Nov 11, 2017)

Listener callback.


----------



## geronimo (Nov 11, 2017)

Merci _


----------



## KSPstudent (Nov 11, 2017)

Look, for example:

Imagine, I have a sample on zero note position. Then, I have 2 listener settings controlled by switch. When I work with first settings (BEAT,24), the sequence starts to "swing" when I play it in the DAW (standalone works good too) with 100, 50 BPM. When I switch second settings (BEAT, 16), it works good. But in this case I need a wait command.

I know that I do not understand something. Please, help.

5.6.8 version

P.S. Looks like it's only in FL-Studio. Yes, when I try it in Reaper - everything is great. In FL-Stuido - described fail.


```
on init
  set_listener($NI_SIGNAL_TIMER_BEAT,24)
  declare $play_seq_flag := 0
  declare ui_knob $divider(0, 3, 1)
  declare %listener_divider[4]
  %listener_divider[0] := 24
  %listener_divider[1] := 12
  %listener_divider[2] := 6
  %listener_divider[3] := 3
  declare ui_switch $settings
  declare $counter := 0
end on

on listener
  if ($play_seq_flag=1)
    if ($counter mod %listener_divider[$divider]=0)
      play_note(0,100,0,10000)
    end if
    inc($counter)
  end if
end on

on note
  if ($EVENT_NOTE>0)
    $play_seq_flag := 1
  else
    ignore_event($EVENT_ID)
  end if
end on

on release
  if ($EVENT_NOTE>0)
    $play_seq_flag := 0
    $counter := 0
  end if
end on

on ui_control($settings)
  if ($settings=0)
    message("SETTINGS 1")
    change_listener_par($NI_SIGNAL_TIMER_BEAT,24)
    %listener_divider[0] := 24
    %listener_divider[1] := 12
    %listener_divider[2] := 6
    %listener_divider[3] := 3
  else
    message("SETTINGS 2")
    change_listener_par($NI_SIGNAL_TIMER_BEAT,16)
    %listener_divider[0] := 16
    %listener_divider[1] := 8
    %listener_divider[2] := 4
    %listener_divider[3] := 2
  end if
end on
```


----------



## Lindon (Nov 14, 2017)

Yeah that code looks like it would work... well like it would work for me(and I use Reaper and Tracktion for basic testing) , so I think its FL-Studio where you are having problems


----------



## EvilDragon (Nov 14, 2017)

Try enabling fixed buffer sizes in FL Wrapper for Kontakt. Some plugins REALLY don't like FL's random buffer sizes default.


----------



## KSPstudent (Nov 14, 2017)

Lindon said:


> Yeah that code looks like it would work... well like it would work for me(and I use Reaper and Tracktion for basic testing) , so I think its FL-Studio where you are having problems



We tried it on a several PC with different FL-Studio settings. It looks like FL-studio divide something wrong maybe. Because everything works great on 100,1 BPM, even 100.001 BPM, but it doesn't on 100,0 BPM, lol.



EvilDragon said:


> Try enabling fixed buffer sizes in FL Wrapper for Kontakt. Some plugins REALLY don't like FL's random buffer sizes default.



I will. Thanks, Mario.


----------

