I've seen this before in various forms. I decided to try and pin it down and report it as a bug. In broad strokes, if an audio track is muted and play is started, followed by unmuting the track, then audio segments experience delays in starting to play, which can be extremely long. It's best to follow the steps to reproduce in order to see and hear this:
Steps to reproduce:
- Open a session
- On a MIDI track, create an 8 measure segment at starting measure 3 as a click track e.g. snare, kick etc to keep rhythm once at the start of each measure
- On an audio track, create an 8 measure segment playing any instrument also starting at measure 3, and also at the start of each measure after that, preferably with sustain less than a measure
- With both segments at measure 3, unmute both tracks and play from measure 1
- Under normal circumstances, one gets the expected results, the audio matches the MIDI hits at the start of each measure
- Now mute both tracks
- Hit play, and when the playback pointer is half a measure before the segments (i.e. between measure 2 and 3) unmute the MIDI track only
- The MIDI hits appear as expected i.e. at the start of each measure
- Hit stop, and mute both tracks again and return playback pointer to to measure 1
- Hit play, and when the playback pointer is half a measure before the segments (i.e. between measure 2 and 3) unmute the audio track only
- The audio, in my case, no longer plays at the start of any measure. It's delayed by one measure
- Now repeat again, but this time, place both segments 6 measures further along the time line
- Hit play, and when the playback pointer is half a measure before the segments (i.e. between measure 8 and 9) unmute the audio track only
- The audio is now delayed by seven measures
The delay appears to be following the point at which the unmute was clicked.
And of course, this is far more complicated when trying it with multiple audio tracks, and staring at various points in the timeline. And it does occur when muting an audio track dynamically and then trying to unmute it, although MIDI tracks seem immune to the problem.
I tried to reproduce this and couldn't. For me the audio and midi were always in sync.
Is the description missing something ?
Can you provide an example rg file + audio which demonstrates this ?
I knew this was going to be trouble. There are far too many steps to reproduce. I think the issue is in the steps because if not correct, then the behavior is not seen. The session is old containing audio I cannot upload, so I would have to try and create a similar session, which would at least rule out the possibility that this is session specific.
In the mean time, as a precis of the steps to reproduce, the final picture is: two segments, both of multiple measures and neither of which is a repeated segment. Both start at the same place, multiple measures from measure 1. Start play at measure 1 with both muted, and the only thing you do is hit unmute on the audio track half a measure before the start of the audio segment. That supposedly creates the equivalent gap from measure 1 up to that point which is the same delay before the audio is heard, even though you see the playback pointer moving over the waveform in the audio.
The original bug report was supposed to produce a session like the one attached. I've created the session for you:
You are now at step 13 in the bug report, except this time:
On opening the session:
That's it...I don't see what can go wrong. You should hear no audio from the audio segment until quite a few measures further on (measure 14 or 15), when you should have heard it at measure 8. If you repeat the above by first unmuting the audio before hitting play, the audio plays from measure 8.
Please verify that you get the same result with this session, and if not, then obviously it's a local issue here. Just in case, I am using master [3e9794].
Related
Commit: [3e9794]
Another just in case occurred to me: The test was carried out with an external keyboard. It shouldn't matter, but who knows.
Yes - with your example I can reproduce the error.
I can also now reproduce it with my home grown test.
It seems that if there is an unmuted midi track the problem does not occur
I have a potential fix for this. Maybe there is a better way - if someone has a good idea.
See Codeberg pull request
The delay was also there for midi tracks with a synth plugin
I thought this might be obvious but should have explicitly mentioned that the issue is accompanied by over 1600 of the following lines in the log just after the audio is finally heard:
However, if you're using ALSA and not JACK, then the warning might not show up in this way. I guess the fix has to include ensuring they don't occur either.
Yes I saw those warnings too. They should be gone with the fix.