Cloze back side conditional on cloze entry

Is there a way that content can be displayed on the back side of a cloze card dependent on which of the cloze entries was queried on the front side?

The use case for this is that I have some cloze cards for learning linked words and when the answer is displayed I want to be able to play an audio file of the word that was replaced by the cloze on the front side.

If you place the audio file directly in the cloze, doesn’t it work?

But that would always play it - I only want to play the sound file for the word that was hidden in the cloze on the front side.

It is possible to generate specific HTML, which can include field(s), for each of cloze’s numbers. See the last part of Card Generation - Anki Manual for more information.

An example of a Back Template:

{{cloze:Text}}<br>
{{Back Extra}}<br>
{{#c1}}{{Audio1}}{{/c1}}
{{#c2}}{{Audio2}}{{/c2}}
{{#c3}}{{Audio3}}{{/c3}}

4 Likes

My solution is to have a separate field called “AudioFileClozes”. In that field I keep audios for specific clozes. For instance a recording of my own voice would be inserted in the field like {{c3::[sound:rec16544493.mp3]}} for the third cloze. On the back template put {{cloze-only:AudioFileClozes}}. Of course Anki complains if you don’t have a reference on the front template to a field containing clozes. So on the front enter a hidden span:
style= “display:none” {{cloze:AudioFileClozes}}{{cloze:ClozeOnlyExtra}}
As you can see I have cloze-specific extra comments as well. They actually could be in the same field but I like to be neat.

Perhaps your complaint about the audio always playing was because you didn’t use “cloze-only”