HI, i decided to participate to community and share my research.
well known midi jittering on ksmps more then 16 is not acceptable for tight midi operations,
it happening when midi signal comes during cycle, and synth starting to react only on next cycle.
but same time big synthesizer consume allot CPU on small ksmps numbers.
My synth works well on ksmps 64, on 16 it gets bit too heavy specially for polyphonic sounds.
i found that midi jittering is periodical and correlated to BPM, and come up with compensation algorithm.
if ksmps 64 then in form caption(synth) … latency(128) ; double ksmps number
instr 1 ;always run
giSaw ftgen 13, 0, 4096, -7, -1, 0, -1, 4096, 1, 0, 1 ; saw waveform as i found that fluctuations goes same way.
kcotrig trigger chnget:k("IS_PLAYING"),0.5,0 ;
if kcotrig == 1 then
reinit COMPS1
endif
kbpm = chnget:k("HOST_BPM")
kamp = 1/(2*kbpm)
COMPS1:
kcompens oscil kamp, kbpm,13,0 ; producing anti fluctuation
rireturn
kcompas = 1/(2*bpm)-kcompens+0.000001 ;calculating delay
chnset kcompas,"compas"
endin
instr 2 ; midi playing instrument
xtratim ,chnget:i("compas") ; compensating sustain time , not sure xtratim work this way but seems ok.
aoutfin delay aout ,chnget:i("compas") ; compensating audio by delay it with anti jitter signal
that is it. i have synth with ksmps 64 and it plays midi super tight.