Anki crashes periodically after clicking record audio button

The crashes occur seemingly randomly when recording audio in both the browser view or when adding audio to a card when I see it in the deck. I’ll click the record icon and then my cursor will indicate it’s loading and then a few seconds later the app closes itself and my progress is not saved. I’ve tried turning off all addons and downgrading to a previous stable version but it has not gone away. It’s incredibly frustrating because sometimes I will feel like the problem is solved and add audio to a bunch of cards but then it will happen out of the blue and all my progress is lost. It is not limited to one deck or card type. I’ve tried disabling hardware acceleration as well. Not sure how to fix. Thanks!

Please try the latest beta - does it fix your problem? https://betas.ankiweb.net/

Still testing but I noticed that the noise reduction on the recordings sounds off. A lot more background noise than before. Also the recording delay is acting weird. I don’t really want to record audio in this quality for my cards becuase it sounds way off in the beta

That’s unexpected. Neither the old nor the new approach apply any noise reduction, so perhaps it’s just a difference in volume - maybe adjusting your mic volume in the system sound settings will make a difference? If not, would it be possible to provide a sample of a recording made on the old version and new version in similar circumstances so I can better understand the issue you’re having?

Ok I’ve recorded a clip in each. The noise persists in the clip from the beta version when playing it in vlc so it’s not exclusive to Anki. I Recorded them right after one another without moving the mic and the noise is consistent with other recordings. As for the crashing issue, is there some kind of crash log I can access that will give any information about why it crashed? It seems like I’ll have to wait until it crashes again because it’s so random and that may take a while. It’s pretty frustrating because I don’t want to have to sync constantly so as not to lose anything I recorded before it crashes. I record a lot of audio so recording 50 tracks only to have them all get deleted is the worst.

this should let you listen to them in browser

Thanks, that level of added noise is not going to cut it. I presume you’re using your laptop’s built in microphone rather than an external one? What model of computer are you using? I’m wondering whether this is something that can be worked around or whether I’ll need to back out these changes for now.

Anki should be saving every 5 minutes, and there’s an add-on available that allows you to increase the auto-save frequency. Also note that the recordings should remain in your media folder even after a crash, but you’d need to reattach them to new cards if the associated cards were not saved.

I’m on a homebuilt Windows 10 desktop and the mic is an external Modmic with a 3.5mm jack not usb. I wasn’t aware of the 5 minute auto save but it’s nice to know that it does that. One problem is that for some reason now the audio files are named a string of random numbers instead of referring to the term on the flashcard so it’s not as easy to search for the term in file explorer and relink it to the card. But I have cards made in older versions of anki which are named based on the flashcard term and not a random string of numbers so I’m a bit confused why that is.
Thanks!

I can’t seem to reproduce the hiss here, so I’m just stabbing in the dark, but if you start 2.1.38, run the following in the debug console, and then record, does it make any difference?


from aqt.sound import RecordDialog

def _start_recording(self):
    from PyQt5.QtMultimedia import QAudioRecorder
    from anki.utils import namedtmp

    # start recording
    self._recorder = QAudioRecorder(self._parent)
    self._output = namedtmp("rec.wav")
    audio = self._recorder.audioSettings()
#    audio.setSampleRate(44100)
#    audio.setChannelCount(1)
    self._recorder.setEncodingSettings(
        audio,
        self._recorder.videoSettings(),
        "audio/x-wav",
    )
    self._recorder.setOutputLocation(QUrl.fromLocalFile(self._output))
#    self._recorder.setMuted(True)
    self._recorder.setVolume(0.7)
    self._recorder.record()

    self._timer = t = QTimer(self._parent)
    t.timeout.connect(self._on_timer)  # type: ignore
    t.setSingleShot(False)
    t.start(100)

RecordDialog._start_recording = _start_recording

If not, if you remove the # at the start of the sampleRate and channelCount lines, and try changing channelCount to 2, or sampleRate to 48000, does that change anything?

If you record your voice in the study screen with shift+v, do you get the same hiss?

The numbers after ‘rec’ are a timestamp, and will increase in the order you’ve recorded the files. Older Anki versions behaved the same way - if you have files with other names, they were likely created outside of Anki.

Messed around with the settings and unfortunately didn’t see any changes. It did crash when i set channels to 2 and sample rate to 48kHz at the same time but otherwise nothing different. Recording in the study screen didn’t change anything either. For the record, my microphone is set to 16bit 44.1kHz in the windows sound settings, not sure if that impacts anything.

oh btw when I uninstalled the beta version mpv.exe was still left in install folder and when I checked the anki-console.exe before that I remembered some message about mpv failing to load or something. Not sure if it means anything but I thought you should know

I’ve made further changes in beta 2 - would you mind giving it a go? Please let me know if it works out of the box. If you get the same audio issues, please switch the recording driver to pyaudio in the preferences screen, then try again - it should sound like older Anki versions, but may avoid the crashes you were getting.

Audio sounds very good! Can’t speak to the crashing issue yet but I’m eager to test it out. Thanks Damien! Anki has been a lifesaver

Actually one small thing, a tiny bit of the audio seems to be clipping off at the end of recordings. I’ll just wait a bit longer before hitting stop record but i thought it was worth mentioning because it does feel a bit different than before.

1 Like

Yeah, I noticed that too - I’ve added a small delay before it stops in beta 3.