Sound file clipped

I am finding that my audio files are clipped on play back. Is there a fix to this other than inserting a pause at the end of every sound file please?

  1. Maybe try to turn off ‘audio enhancements’ if they’re enable.

    Audio tracks get clipped at the end - #8 by vvvpellit

  2. Maybe try to set gapless-audio=no for mpv or install the latest Anki version with the same change. It could be installed in a separate folder.

    Audio tracks get clipped at the end - #5 by kelciour

    2.1.45 Release Candidate

  3. Maybe tell mpv to dynamically add a bit of silence at the end, the same way as gapless-audio=no.

    mpv.conf

    af=lavfi=[apad=pad_dur=5]

    debug console

    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('af=lavfi=[apad=pad_dur=5]\n')
    print('[af] before:', mpvManager.get_property('af'))
    # restart mpv to apply new settings
    mpvManager.shutdown()
    print('[af]  after:', mpvManager.get_property('af'))
    
3 Likes

I’m running Anki 2.1.44 on Ubuntu 20. I have the same problem as the OP (although it’s the beginning not the end that’s clipped).

The difference is that for me it’s an intermittent problem rather than a constant one, seeming to be largely random, so the solution offered above would not be helpful. What is necessary is to discover the underlying cause of these fluctuations in functionality.

I also have Ankidroid, and the problem does not affect my decks there.

In fact, I have just checked, and my mp3 files are behaving in this way on all the apps I have installed to run them, with the exception of Rhythymbox. And it only affects short mp3s (pronunciation clips for individual foreign words), not music. It would be interesting to know if the OP is also running Ubuntu or another Linux distro.

If my theory is correct, and this is an Ubuntu problem, then this is the solution:

It is an internal problem with the Pulseaudio package, which is built into recent Ubuntu versions. Dr_Evil’s solution worked fine for me. On Ubuntu 20, you will need to run default.pa as sudo (sudo gedit /etc/pulse/default.pa) and then restart your machine.

3 Likes