Audio tracks get clipped at the end

It’s very likely a bug in mpv, but without being able to reproduce it, I don’t know what could be done here.

But maybe it’s a similar bug and the same workaround could be applied here. It might be worth to try to create mpv.conf in %APPDATA%\Anki2, add gapless-audio=no and restart Anki, or do it automatically by running the following code in the debug console in Anki.

import os
from aqt import mw
from aqt.sound import mpvManager
with open(os.path.join(mw.pm.base, 'mpv.conf'), 'a') as f:
    f.write('gapless-audio=no\n')
print('[gapless-audio] before:', mpvManager.get_property('gapless-audio'))
# restart mpv to apply new settings
mpvManager.shutdown()
print('[gapless-audio]  after:', mpvManager.get_property('gapless-audio'))

Interesting.
I looked at the add-on’s source code, the add-on uses the same code as Anki, there’re a few options that are different, but they shouldn’t help in this case, but everything is possible or maybe it’s something else.
But one change was overlooked in the past, loadfile ... replace instead of loadfile ... append-play, and it would be nice to have it in Anki too, to keep the internal mpv playlist from growing on if the audio playback was never interruped.

3 Likes