2 Slots going out of sync

Issue #295 resolved
Matias de Ezcurra created an issue

I automated 2 slots to record at the same time, and then play at the same time, and they go out of sync with each other.

I send you the project. Both slots record from the same mic, so it should be exactly the same. (The marker in the middle is just an action marker to rebuild peaks, so I can use it until that issue is solved).

Thanks!

Comments (7)

  1. Matias de Ezcurra reporter

    I solved this by selecting "next beat" at record and play start settings. so it's not a big issue, but it should work without that setting also, being triggered at the same time by automation, right?

  2. Benjamin Klum repo owner

    If you use "Immediately" as record start or stop setting, there are no timing guarantees. If you use "Next beat" or "Next measure", clips shouldn't go out of sync. The length of the clip should be exactly a multiple of a beat or a measure.

    However, currently there seems to be a bug with "Next beat" and "Next measure" causing non-perfect clip lengths if you trigger the recording very shortly before the start of the measure or bar. I'm working on it.

  3. Benjamin Klum repo owner

    That seems to happen with bad combinations of tempo and sample rate. If the number of samples that fit into a beat/measure is not an integer, the clip length will be very slightly shorter or very slightly longer than a beat/measure - it just doesn't fit perfectly. And that results in a drift-off over time. Consider the following formula:

    lengthOfOneBeatInSeconds = 60 / tempoInBpm
    lengthOfOneBeatInSamples = lengthOfOneBeatInSeconds * sampleRate
    

    For example, with a tempo of 84 bpm and a sample rate of 44100, everything is okay because 31500 is an integer:

    lengthOfOneBeatInSamples = (60 / 84) * 44100 = 31500
    

    However, the same tempo and a sample rate of 48000 doesn't work well:

    lengthOfOneBeatInSamples = (60 / 84) * 48000 = 34285.71428571429
    

    If you record an item purely in REAPER, it suffers exactly the same issues. REAPER itself doesn't do anything to fix this wrong sample alignment. Just glue a clip that has been recorded with a bad combination of tempo and sample rate and you will realize it doesn't end exactly on the end of the bar. However, I agree that for Playtime - which is all about looping - it's essential that clips don't drift off, even when they are recorded with a bad combination of tempo and sample rate.

    I'm most likely going to employ audio sections to automatically fix the timing of such clips.

  4. Benjamin Klum repo owner

    re #295 Record exact amount of samples, remove dead code

    However, this doesn't yet fix the issue related to bad combinations of sample rate and tempo (such as 81 bpm and 44100 kHz).

    → <<cset 1617b3b3c779>>

  5. Log in to comment