I think Anki could be used very effectively to practice foreign language pronunciation by chorusing (repeating and imitating a sentence in a foreign language at the same time you listen to it for severeal times) and even shadowing.
In order to do that, a simple way to loop audio files could be implemented, so that when the user presses a button in the card the audio is played in a loop indefinitely until the user stops it (maybe some kind of {audio-loop} tag? Not sure if that’d be hard to implement, but I think users might appreciate it).
That’d be especially useful with the growing number of sentence-mined decks.
Or maybe there’s already a way to do this that I dont know of?
Thanks in any case. You’re doing a great job and making a great tool!
Yep, thanks, but I know. I use Anki on mobile though, so I don’t have R to repeat, and when chorusing, the idea is to focus on repeating and imitating the pronunciation several times (dozens usually), so having to press a button everytime is not very convenient… Having this feature would help.
I’ll keep an eye on demand for this, but in the mean time, I’d recommend you assign the replay audio action to one of the tap zones, then you can just tap on one part of the screen to replay the sound
I was also looking for something like this. For language learning, looping audio is very helpful when you are trying to get the pronunciation right by speaking along with the audio, especially when practicing the pronunciation of words and sentences of tonal languages.
A “loop audio” option with a keyboard shortcut (maybe “L”) would be very helpful for me.
In addition to a loop audio button, a way to slow down or speed up audio files would be very helpful for language learning.
The Control Audio add-on does both of these things but it cannot be added to Anki in Anki version 2.1.49
I’ll admit to you that I’ve always missed this feature. I liked ANKI when I had this tool, because when I clicked on the audio several times this effect existed, but over time, updates removed this feature. If by chance the resource exists again, please contact us, as it will not be too late.
Ok, in case anybody is interested (@milad, @Ribeiro, @Jord, @Shiori), I found a way to do this with a script (thanks to ChatGPT!). Just add this code to the template where you want to have the button.
Version with images for starting/pausing the looping (you can use any image you want, just add it to your collection.media folder with an underscore at the beginning of the filename and change it here in the src="_FILENAME.EXT" sections, theres the _loop.svg to start it and the _pause.svg to stop it).
There is also a loop counter to know how many times you’ve listened to it.
<div id="audio-container">
<audio id="audio-player">
<source src="{{Loop}}" type="audio/mpeg" />
</audio>
<button id="loop-button" class="loop-button">
<img id="loop-image" src="_loop.svg" alt="Loop">
</button>
<div>Loop Count:<span id="loop-count" class="loop-count">0</span></div>
</div>
<script>
var audio = document.getElementById('audio-player');
var loopButton = document.getElementById('loop-button');
var loopImage = document.getElementById('loop-image');
var loopCount = document.getElementById('loop-count');
var count = 0;
var isLooping = false;
loopButton.addEventListener('click', function() {
isLooping = !isLooping;
if (isLooping) {
loopImage.src = '_pause.svg';
loopImage.alt = 'Pause';
audio.loop = false; // Disable native loop to handle it manually
audio.play();
} else {
loopImage.src = '_loop.svg';
loopImage.alt = 'Loop';
audio.loop = false;
audio.pause(); // Pause the audio immediately
audio.currentTime = 0; // Reset the audio to the beginning
}
console.log('Loop button clicked, isLooping:', isLooping);
});
audio.addEventListener('ended', function() {
console.log('Audio ended, isLooping:', isLooping);
if (isLooping) {
count++;
loopCount.textContent = count;
console.log('Loop count incremented:', count);
audio.currentTime = 0;
audio.play(); // Manually restart the audio
}
});
</script>
Note that the audio file should not have [sound:] tag, it should be just the filename (I used the Advanced Copy addon to duplicate my {{Audio}} field into a {{Loop}} field and then removed the tags with Find and Replace in the Browser).