Anki Forums

Audio tracks get clipped at the end

Hello Everyone,
I’ve been using Anki for quite some time on my devices without any issues. However, now that I got a new pc, it seems the audio tracks for my cards end ever so slightly prematurely. I don’t think it’s an issue with the deck I’m using, as it works fine on my other pc and my phone as well. I’ve seen plenty of topics about beginnings of audio tracks being cut off, but nothing about the other side, so thank you for any help.

My new pc is quite a powerful one and had issues with some other programs already, so I’m posting the specs below, perhaps they’re relevant.

HP OMEN 15
Processor: Intel Core i15-10300H
Hard drive: 512GB SSD
RAM: 16GB DDR4
Graphics card: NVIDIA GeForce GTX 1660 Ti 6GB
Windows 10; Anki 2.1.44

Aand the very next time I use it, it’s in working fashion. Well, the issue’s solved, but if anyone has any idea what might have caused it, I’ll be happy to hear it!

A bit of an update, turns out the issue is still present, albeit not always. Trying to figure out what’s the deciding factor in whether it’s there or not.

I have the same problem. To solve it you need to install the older, alternate version. The issue seems to be connected with the MPV player and the alternate version doesn’t use it. However, it would be great to be able to use the newest version without audio getting clipped, so if somebody knows a better fix, please share.

EDIT: It seems that this addon helps.

1 Like

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

Thank you both for your insight!

I’ve tried the addon that andrzej recommended, but I’m not exactly sure if it really helped and it had an annoying side effect of removing the gap between the word audio track and the example sentence audio track in my deck. I’m not all that tech-savvy, so I don’t think I want to play around with it too much either.

Next I tried kelciour’s fix, which I’m not sure as of yet if it really works or not, I think I’ll have to give it a couple more days to really notice any difference, as it’s highly unpredictable when I get my tracks clipped. If that ends up not working, then I’ll try switching to the older version.

Big update, the issue is fixed. Turns out it wasn’t a problem with Anki in the first place, rather an nvidia/realtek/windows thing. I noticed that I’ve had the same issue when listening to the audio clips at forvo.com, which led me to believe something was amiss on my side and after a quick search and some reading I have found a comment on this article.

Guys, if you all have nvidia and realtek,
Open Device manager, then click on sound, video and game controllers, then find realtek hd audio or realtek audio. Click on update driver. Then click on browse my computer for drivers, then on let me pick from a list of drivers available on my computer, then uncheck ‘Show compatible hardware’. There chose the manufacturer as Microsoft, at last choose any of the High Definition Audio Device version 10.0.16299.15 or any other version installed on your computer. Then click on next. Let it install the driver. If needed do a restart.(It didn’t for me) Done! This works for me.

Following those instructions instantly fixed the problem. I have no idea how or why is this the fix, but I’m not complaining. Hope this will save someone else with the same problem the trouble!

3 Likes