Anki not playing audio but plays movies...says I need lame

Hello,
I can record and play videos but not audio on my Anki cards.

  • when i try to record, it says “have you downloaded ‘lame’?”
  • a few days ago it let me record, and would insert a [.mp3] file into the card, but then would not play it. - it does still play old mp3 file cards. = so odd!

I have searched this forum and found similar topics,
so tried:

  • turning off all other media using devices - skype, discord, zoom etc.
  • checking mic is connected in settings
  • restarted anki and the computer
  • uninstalling then redownloading and reinstalled anki, and updated it to Version ⁨2.1.54 (b6a7760c)⁩
    Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
  • signed out of all other anki accounts on mobile phone and ipad
  • checked media under tools
  • found collections → did not find the newest mp3s there.
  • googled ‘lame’ and found a few sites. Found one from a youtuber with many reviews, but am cautious as to which is malware - my mac wouldn’t let me open the one I downloaded due to suspiciousness. Found one from cnet - same thing.
  • updated my computer to Monterey 12.5

For the error I had a few days ago where it at least said it recorded and inserted an …[m3] file into the card (but then wouldn’t play) - Perhaps I deleted the files on accident (I never touch the code parts or media files as I am too afraid).

For not being able to record at all - I’m at a loss.

I have a 2020 M1 macbook air. I downloaded the latest Anki updated version for M1. Any help appreciated.

Thank you

Do you have a package manager such as homebrew of macports installed? If so, installing it would be as easy as sudo brew install lame. If you are interested, you can read more about brew for example, which is relatively easy to install. Having a package manager means you never have to worry about downloading legit software (if you download it through package managers).

Unfortunately, I don’t know if there is an other easy way to install lame, as for license issues they are not allowed to distribute precompiled versions of their software, they can only provide the source code and you’d have to compile it by yourself (which is considerably harder).

Anki comes with lame, and you shouldn’t need to install it separately. Recording works correctly on an M1 machine here, so it’s odd it’s not working for you. Maybe reinstalling the app will help?

I’m having a similar issue, I cannot record audio, it just gives the error message:
“Couldn’t record audio. Have you installed ‘lame’?”

I tried installing lame separately with brew, but it didn’t work either.

What did work was downgrading to the Qt5 version, then the recording was working again.
But I need the Qt6 for the fixed uncommon language support, so that’s not really an option.

Any thoughts?

I’m on Big Sur on an old macbook air from 2013 or something, so I’m using the Intel version.

Please open Terminal.app and run Anki from there:

/Applications/Anki.app/Contents/MacOS/anki

When recording fails, what is printed to the console?

Can’t init infile ‘/var/folders/v1/s_z0krfn69d2_q8yrfm38jn40000gn/T/anki_temp/rec.wav’

Error running ⁨/Applications/Anki.app/Contents/MacOS/…/Resources/lame /var/folders/v1/s_z0krfn69d2_q8yrfm38jn40000gn/T/anki_temp/rec.wav /var/folders/v1/s_z0krfn69d2_q8yrfm38jn40000gn/T/anki_temp/rec1662748933.mp3 --noreplaygain --quiet⁩

That seems to imply the recording isn’t created before lame is called. In system preferences>security & privacy, does Anki have permission to access the microphone? Are you able to record in other apps?

I have the same issue on
macOS 12.5.1
Anki ⁨2.1.54 (b6a7760c)⁩
Python 3.9.7 Qt 6.3.1 PyQt 6.3.1

Anki does have permission to access the microphone.

Screen Shot 2022-09-13 at 11.50.14 AM

Error message in GUI is:

Couldn’t record audio. Have you installed ‘lame’?

Full error message in terminal is:

Can’t init infile ‘/var/folders/vs/ytbn9scj1ks_yq34nzpjh2l80000gn/T/anki_temp/rec.wav’
Error running /Applications/Anki.app/Contents/MacOS/…/Resources/lame /var/folders/vs/ytbn9scj1ks_yq34nzpjh2l80000gn/T/anki_temp/rec.wav /var/folders/vs/ytbn9scj1ks_yq34nzpjh2l80000gn/T/anki_temp/rec1663083244.mp3 --noreplaygain --quiet

I tried replacing the lame executable with a bash script that lists out the content of anki_temp, and as you suspected the rec.wav file is not created.

I can successfully record audio using the macOS Voice Memo app.

My audio input devices are configured as follows:
Screen Shot 2022-09-13 at 11.54.44 AM

Switching to the Qt5 version does seem to solve the problem.

I can also confirm that Anki does have microphone permissions for me and that I can record in other apps (tried in Quicktime).

If you select the built-in Mic as the default input before starting Anki, does that make a difference?

Does the USB mic you are using support recording with 1 channel at 44.1khz?

I reinstalled the Qt6 version this morning to test this and something strange happened. Everything seems to be working now, but I’ll describe the sequence of events as I remember it in case it can help avoid this problem in the future.

  1. I uninstalled the Qt5 version (installed yesterday to circumvent this problem) and reinstalled the Qt6 version.
  2. With my Scarlett 2i4 USB audio interface still selected, I tried recording sound on a new Anki card: failed with the “lame” error message.
  3. Closed Anki, changed audio input device to built-in mic, restarted Anki and tried recording again: no error message, the file was created, but I couldn’t hear anything, most likely because the lid of my laptop was closed and the mic couldn’t pick up any sound.
  4. Closed Anki, changed audio input device to my C922 webcam, restarted Anki and tried recording again: no error message, the file was created, and I could hear the sound properly.
  5. Closed Anki, changed audio input device back to my Scarlett 2i4, restarted Anki and tried recording again: still didn’t work.

Then I started trying to figure out channel/sampling rate/bit depth support for the 3 devices

  1. In System Preferences > Sound, I noticed that my USB audio interface is the only input device with no input controls. See screenshot:
    Screen Shot 2022-09-15 at 8.59.22 AM

  2. Opened Audio MIDI Setup to see the recording format. This is what I got for the Scarlett 2i4:

The built-in mic is 1 ch 32-bit Float and supports similar sampling rates (but only up to 96,000 Hz).
The C922 is 2 ch 16-bit Integer and only supports 16, 24 and 32 kHz (not 44.1 kHz), although it did work with Anki.

  1. Opened Logic Pro to see if I could get more information, but I didn’t find anything.

  2. With Audio MIDI Setup and Logic Pro still open, and the Scarlett 2i4 selected, restarted Anki. I don’t know what I was trying to do, but I tried recording again and it worked, to my surprise.

  3. Closed Audio MIDI Setup, closed Logic Pro, closed and reinstalled Anki Qt6 version, restarted Anki, and tested again: it still worked.

I can’t explain it. It looks like some weird observer effect where opening these two apps and using them to look at the properties of the input device somehow affected the input device’s configuration and made it work for Anki. Out of curiosity, I’ll restart my computer and see if I can reset it to a state where it doesn’t work.

Edit: It still works after restarting my computer. I can’t explain it, but I hope it helps.

Hi!

This did help! (Strangely enough)

I only have the built in Microphone, but I went into the Audio MIDI Setup and saw that the format was set to 48.0kHz 2ch 24-Bit Integer, so I changed it to 44.1kHz 2ch 24-Bit Integer and then it started working!

Screenshot 2022-09-18 at 17.34.53

If I change it back to 48.0kHz the same error appears again.

Hope this helps to find the bug somehow!

Thanks for all the work! <3

Thanks for the extra details, I’ve logged this on Recording on Qt6 Mac build fails if audio interface is not set to 44.1khz · Issue #2077 · ankitects/anki · GitHub