Syncing with an external MIDI Clock

I never imagined I’d have to do this, but I had to use R and develop a linear regression model in order to fix the timing difference.

          /(Intercept)    midi$ppm    midi$lap
            1.87219822  0.48883835 -0.00175442/
          pps = (1000/lap)
          ppm = pps*60
          tempo = 1.87219822 + (0.48883835 * ppm) + (-0.00175442*lap)

Those coefficients constants were calculated on R using a linear regression model, with all the logged data in Sonic Pi. Hopefully, this is giving me a temporary solution, but of course… this is not ideal, and probably, not widely supported.