The beginning of audio tracks isn't audible

Hello everybody,

I’ve been using Anki desktop for years on Ubuntu, Debian and AnkiDroid without encountering any problem (many many thanks to the developers).

I recently installed Fedora 32 and encounter an audio problem. For some cards - but not all - the beginning of the audio track is inaudible, then the sound comes normally (I can ear only the last half of the sentence). These audio tracks come mainly from Google translate using Awesome TTS. The same audio tracks are playing normally on AnkiDroid and Anki Desktop on Debian 10. If I press on the “R” touch, I can ear the entire sound track from the beginning, but if I make and error and the same card is presented a few minutes later, the beginning of the audio track isn’t audible anymore.

I tried several versions of Anki (2.1.29, 2.1.30, 2.1.31 and 2.1.32), Gnome with Wayland or X11, installed Anki versus uninstalled (simply run from the unzipped archive) without improvement. I can’t remember if I had the problem with the live Fedora session before the install (but I guess no). I’ve not seen such a problem in this forum. If I start Anki from a terminal, I see “stripSounds() deprecated” when the cards are presented.

What can I do to solve the issue ?

This is very strange. Maybe try to create mpv.conf in Anki2 with audio-stream-silence=yes and restart Anki.

https://docs.ankiweb.net/#/files?id=file-locations

https://mpv.io/manual/master/#options-audio-stream-silence

As an alternative and without restarting Anki, open the Debug Console in Anki, copy-paste the following lines and press Ctrl+Return.

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('{}\n'.format("audio-stream-silence=yes"))
mpvManager.shutdown()
print('audio-stream-silence:', mpvManager.get_property('audio-stream-silence'))

Then just close the Debug Console and review cards as usual.

https://docs.ankiweb.net/#/misc?id=debug-console

If it won’t work, maybe add audio-wait-open=0.3 to mpv.conf and restart Anki.

1 Like

Thank you very much Nickolay,

Adding a mpv.conf file in the appropriate folder (~/.local/share/Anki2) containing audio-stream-silence=yes andaudio-wait-open=1.5``solved the problem. With audio-wait-open=0.3 as you first suggested, the beginning of the audio track was still not audible. This parameter adds a delay (1.5 sec) before playing the sound track, which is slightly unpleasant, but anyway functional.

Maybe using a different audio output driver on Linux in mpv.conf will make a difference. By default, it’s probably set to pulse. This can be checked by playing any audio file from the console with mpv 123.mp3 or enabling log-file in mpv.conf.

ao=alsa

https://mpv.io/manual/master/#audio-output-drivers

https://mpv.io/manual/master/#options-log-file

As another option, maybe temporarily uninstall mpv and install mplayer.

1 Like

I tried alsa and mplayer as you proposed, but it didn’t work. So I reversed to mpv and pulse, with the 1.5 sec delay.

Someone on Reddit suggested a while ago to play the silence audio file in the background for a few hours as a way to hear the beginning of the audio file while using the bluetooth headphones, if I remember correctly, as an alternative to audio-stream-silence, but I’m not sure it’ll help here.

Otherwise, I don’t have any new ideas.

1 Like

Your last idea was the good one. If I play this file in the background, everything works fine with Anki.

Thanks again,