Question on custom binaryNLegato() function

Okay, this is a bit more advanced (at least for me) but anyway…

This is a working code that does what you’d expect from a binaryNLegato().

const binaryNLegato = (n, nBits = 16) => {
  const binPat = binaryN(n, nBits);
  const bits = binPat.firstCycleValues;
  if (!bits || bits.length === 0) return silence;
  const joined = bits.join('');
  const segments = joined.split('1').slice(1)
    .map((s) => [s.length + 1, true]);
  return timeCat(...segments).setSteps(binPat._steps);
};

$:stack(

  s("sine").n(run(8)).scale("C4:major").color("white")
  .struct(binaryNLegato(slider(112,0,0xFF,1),8))

  , s("sine").n(run(8)).scale("C2:major").color("green")
  .struct(binaryN(slider(112,0,0xFF,1),8))

  
)._pianoroll({labels:1,playhead:0,vertical:0})

image

But unlike binaryN() my lovely binaryNLegato() doesn’t react to the slider() change during playback. What am I missing?

Now, that I have my glasses, I have a side question. Why is the white start at “C4” but the green at “D2”? Why is the green 1/8 late!?!