Anki Forums

Unable to play longer audio on cards

I did the exact same thing and get the same error message when I run Check Media.

Missing files: ⁨1⁩
Unused files: ⁨1⁩

The following files are referenced by cards, but were not found in the media folder:
Missing: ⁨pronunciation_fr_tête-à-tête.mp3⁩

The following files were found in the media folder, but do not appear to be used on any cards:
Unused: ⁨pronunciation_fr_tête-à -tête.mp3⁩

This is really strange. It’s the same filename but it’s listed as missing and as unused at the same time.

Take a look at the collection.media folder (in a new Anki profile with just one card). Do you see pronunciation_fr_tête-à -tête.mp3 or pronunciation_fr_tête_à_tête.mp3?

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

This may be irrelevant, but create a new Anki profile, copy-paste the following code in the Debug Console and press Ctrl+Return.

import locale
print('Default:', locale.getdefaultlocale())
print('Current:', locale.getlocale())
locale.setlocale(locale.LC_CTYPE, 'en_US.UTF-8')
print('New:', locale.getlocale())

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

The output should be something like

Default: (‘en_US’, ‘cp65001’)
Current: (‘English_United States’, ‘utf8’)
New: (‘en_US’, ‘UTF-8’)

If the current locale is not utf8, add a new card with pronunciation_fr_tête_à_tête.mp3 and run Check Media. Maybe it’ll be different this time and report no unused or missing files.

1 Like

This is unexpected.

import locale
… print(‘Default:’, locale.getdefaultlocale())
… print(‘Current:’, locale.getlocale())
… locale.setlocale(locale.LC_CTYPE, ‘en_US.UTF-8’)
… print(‘New:’, locale.getlocale())
Default: (None, None)
Current: (None, None)
New: (‘en_US’, ‘UTF-8’)

Great. Maybe this is something relevant to the issue.

Once it’s been changed to UTF-8, try to add a new audio file, i.e.create a new Anki profile, rerun the same code again in the Debug Console to set UTF-8, add a new card, drag-and-drop pronunciation_fr_tête_à_tête.mp3, close the Add window and run Check Media. Maybe it’ll be different this time and report no unused or missing files.

That didn’t do it. I started with shift down, changed input to UTF-8, added a profile, created a card, download a new Forvo file and it didn’t work. Same error message in Media. But there is information.

  1. When I restart the app, it always says “none” for console input the first time I check. Changing “current" to UTF-8 does not stay.
  2. The file names are corrupted on my Mac when I download them. This is the name of the file in the Mac downloads folder.

pronunciation_fr_tête-à -tête-2.mp3

Is my Mac doing the corruption on download before I upload the file to Anki? I have tried both the U.S. keyboard and ABC Extended keyboard. I am in France.

Is my Mac doing the corruption on download before I upload the file to Anki?

Yes, maybe try a different web browser, but if you add it, Anki should still be able to find the audio file and play it.

Try to start Anki this way and run Check Media in a profile that contains one card to see if it makes any difference.

Or maybe this is how Mac saves filenames with accented characters and this is not a problem,

OS X uses Unicode NFD (Normalization Form Canonical Decomposition).

but for some reason it confuses Anki - Check Media and mpv can’t play it too.

I downloaded the same file with Chrome, and the file name looks normal with accents, and the audio plays in Anki. It’s odd, as the other French accents work with accents changed in the file name wisen downloaded using Safari.

I would like to be able to user Safari for Forvo.

Try to start Anki by opening Terminal.app and setting LC_CTYPE=en_US.UTF-8

If it won’t work, maybe create a new Anki profile, open the Debug Console, copy-paste the following code, press Ctrl+Enter, add a new card with the audio file from Safari and run Check Media.

mw.col.conf["normalize_note_text"] = False

If it won’t work, I’m out of ideas and don’t know why Anki reports pronunciation_fr_tête-à -tête.mp3⁩ as missing and as unused at the same time.

While it was right of kelciour to think of ruling out normalization, that setting doesn’t actually alter the way media files are handled, so if you have already tried it, I recommend you run it again after changing False to True, as it may cause other problems down the road.

I’ve dug into the issue, and it turns out to be caused by a non-breaking space in the filename. Forvo is not serving the file in a way that Safari understands, causing the accents to be replaced with a different character and a non-breaking space. Forvo will need to fix this, so please report it to them.

The non-breaking space was not being handled by Anki correctly, causing the file not to be found. The next Anki release should fix this for you when you use Check Media.

2 Likes

Hello,

Thanks for taking the time to look at this. I downloaded 2.1.33 and ran check media. I re-named two files and left the rest. I ran check media again and get the following message. Also, I emailed Forvo and copy/pasted your message.

Regards,
James

Trash folder: ⁨⁨4861⁩ files, ⁨41.77⁩MB⁩
Missing files: ⁨17⁩
Unused files: ⁨0⁩

The following files are referenced by cards, but were not found in the media folder:
Missing: ⁨pronunciation_fr_aiguille_à_tricoter.mp3⁩
Missing: ⁨pronunciation_fr_dorénavant,_il_faudra_veiller_à.mp3⁩
Missing: ⁨pronunciation_fr_d’à_côté.mp3⁩
Missing: ⁨pronunciation_fr_il_venait_d’échouer_à_décrocher_une_médaille_par_équipe…mp3⁩
Missing: ⁨pronunciation_fr_jusqu’à_quelle_heure_tourne_le_bus_⁩
Missing: ⁨pronunciation_fr_j’irai_à_marseille.mp3⁩
Missing: ⁨pronunciation_fr_les_fruits_à_noyau.mp3⁩
Missing: ⁨pronunciation_fr_là-haut.mp3⁩
Missing: ⁨pronunciation_fr_on_dit_«mou»,_par_opposition_à_«dur»…mp3⁩
Missing: ⁨pronunciation_fr_s’atteler_à.mp3⁩
Missing: ⁨pronunciation_fr_tout_à_l’heure-2.mp3⁩
Missing: ⁨pronunciation_fr_tête-à-tête-2.mp3⁩
Missing: ⁨pronunciation_fr_à_l’aune_de.mp3⁩
Missing: ⁨pronunciation_fr_à_mon_avis.mp3⁩
Missing: ⁨pronunciation_fr_à_tout_le_moins.mp3⁩
Missing: ⁨pronunciation_fr_épingle_à_cheveux.mp3⁩
Missing: ⁨pronunciation_fr_étaient_à_faire.mp3⁩

That’s fixed the ‘unused file’ issue. Do the other files exist in your media folder? Maybe you need to add them again?

They do exist in the media file, but they were not repaired. I download the exact same file and add it to the card with the old file that does not work, and the new one works. The same file twice in the same card and the original does not play and the one just added does.

Thanks for all your help. I can easily re-add the files that do not work but thought you would want to know.

Apologies, I thought I replied earlier. Thanks for your help. I haven’t used accents etc. in my file names but I noted that this files specifically had an ampersand in the file title. I removed and renamed the files and it works fine. There are some files which have Arabic/Persian letters and these seem to play ok, but hopefully there won’t be an issue with accents as I have several thousand French language audio files, some of which have accents in the file name. Wouldn’t this be an issue for Anki users whose native language uses the Latin alphabet but with accents? Hopefully if this is a bug, this will be fixed sooner.

Anyway, thanks for your help.

Yes, filenames with accents should work just fine.

Yes, it looks like a bug.


Check Media doesn’t report 1 &lt; 2.mp3 as missing or unused but mpv is looking for 1 < 2.mp3 and there’s no sound.

Check Media reports a & b.mp3 as unused and a &amp; b.mp3 as missing but mpv is looking for a & b.mp3 and plays it just fine.

Strangely, while adding the audio file via drag-and-drop, a & b.mp3 was correctly HTML escaped and saved as a &amp; b.mp3 in the card, but it didn’t happen to 1 &lt; 2.mp3 and it was saved as it is.

2 Likes

Will look into it.

I should add that I have a similar problem.

Learning Hebrew, using the template from Fluent Forever.

Everything worked perfectly, for many moons. Then, some time over the summer, I would add a new card, and add an mp3, but when using the deck, no audio plays, and there is no play button. E.g. even though the Audio was added the normal way (dragging file from Windows Explorer onto the right edit in the card), it is as if the audio is not there at all.

Just now, I browsed the deck and went to a card that had audio that was not playing, I cleared the file name from the card, moved off the card, moved back on, and dragged an mp3 onto the card. Annnnnddddd, it still does not work.

Older cards, that I made before the problem started, play audio fine.

I am running 2.1.33 on Windows (where I just did sequence above), and whatever the current Android version.

The problem is visible on both windows and phone.

Please give me steps to chase. (I am technical, fwiw)

Thanks!

And another symptom of the problem I have observed:

Historically, when I would drag an mp3 into an Anki field, the audio is played back.

I notice that this is not happening (and I see this on two different systems where I author cards, both running Windows 10).

Again, 2.1.33 on Windows

This is probably unrelated:

Ahhhh, thank you. An intended (but, imo, undesirable) change that smells like a real problem.

Thanks for pointing this out!