[AnkiMobile] Auto-advance vs. html audio element?

Hey, I have shared a Glossika deck for vietnamese on AnkiWeb. This looks intersting so if you could have everything in a single place like GitHub (or just make a clean post in the forums), I could link people to that from the shared deck’s info page.

Hi

Do you mean this one? https://ankiweb.net/shared/info/1525856330
Just by curiosity, is those the real Glossika sentences or similar ones, like Chinese Spoonfed?

Hm I’m not sure I can commit to have those gathered somewhere since I’m not even sure in which form to share them.
Since Damien’s reply I already have two different decks based on that trick :
one for my own sentences (I didn’t start collecting yet, from movies, Tv shows etc.) and the other for ChineseSpoonfed.

I bought these years ago for a $3 but never got to use them for real practice in Anki, having to push buttons to answer didn’t make much sense — I thought I was supposed to remember all those sentences by heart to become fluent…
Then I subscribed to Glossika for the last two years and I really enjoyed they way of presenting sentences and building fluency without noticing.
Only thing is I got to hate their app a little in the last 6 months, their server is quite sluggish from where I am, their player is a little buggy and hardly customizable, etc.

So anyway for me it’s more of a method for everyone to adapt to their own needs.

What I would recommend is :

————

  1. create a note type with the following fields :

————

Note 1 : Audiotag and Audio are almost identical but the first (with [sound:….mp3]) allows to keep track of soundfiles in the media database — for instance if I need to get rid of a lot of cards. The other one without tag is the actual filename I’m using in the script.
(If anyone has a better solution, I’m interested ! But it seems pure filenames cannot be recovered from Anki audio tags)

Note 2 : Repeat and speed are empty by default. I set those values to 2 and 1 by default respectively, directly in the JS code. So you can decide to have certain sentences repeated more than twice, and change the speed, otherwise will get default values. Of course you’re always free to change those default values in the code, or batch edit a lot of cards that you decide are very easy or very hard accordingly.

————

  1. Copy this code to your Front template

————

<div style='font-family: Hoefler Text; font-size: 27px;'>{{Hanzi}}</div>
<div style='font-family: Hoefler Text; font-size: 17px;'>{{Pinyin}}</div>
<div style='font-family: Hoefler Text; font-size: 17px;'>{{English}}</div>
<audio controls id="player">

<script>
    // flipToBack reference to https://github.com/git9527/anki-awesome-select
    function flipToBack() {
        if (typeof pycmd !== "undefined") {
            pycmd("ans")
        } else if (typeof study !== "undefined") {
            study.drawAnswer()
        } else if (typeof AnkiDroidJS !== "undefined") {
            showAnswer()
        } else {
            webkit.messageHandlers.cb.postMessage(JSON.stringify({scheme:"ankitap", msg:"midCenter"}));
        }
    }
</script>

<script>

    {

        let playbackSpeed = '{{Speed}}' || 1;
        let repeatTimes = '{{Repeat}}' || 2;

        const audios = Array(repeatTimes * 2).fill(`{{Audio}}`);
        const player = document.getElementById("player");
        let index = 0;

        player.addEventListener("ended", () => {
            if (++index < audios.length) {
                player.src = audios[index];
              player.muted = index % 2;
              player.playbackRate = playbackSpeed;
                      /// player.display = "none";
              player.play();
            } else {
               // All audio played, automatically advance by answering "Good"
               flipToBack()
            }
        });
        // play the first audio file

        player.src = audios[index];
        player.playbackRate = playbackSpeed;
        player.play();

    }

</script>

Note : so again the pattern here is Audio → Audio-muted → Audio → Audio-muted… where you will actually hear Audio twice or more depending on the value of Repeat (default 2)
If the mute is too long for you, you’ll need to adjust the code a little, but it’s quite easy I think to decouple the playback speed from unmuted and muted versions :slight_smile:

————

  1. then this code to your Back template :

————

<audio controls id="player">

<script>
    {
        const audios = Array(1).fill(`{{Audio}}`);
        const player = document.getElementById("player");
        let index = 0;

        let playbackSpeed = '{{Speed}}' || 1;

        player.addEventListener("ended", () => {
            if (++index < audios.length) {
                player.src = audios[index];
              player.muted = index % 2;
              player.playbackRate = playbackSpeed;
              player.play();
            } else {
               flipToBack()
            }
        });
        player.src = audios[index];
           player.muted = 1;
        player.playbackRate = playbackSpeed * 2;
        player.play();
    }
</script>

Note : Pay attention that on back side, after the I have a silence that is half the duration of the last audio played (playbackSpeed * 2 ). I just experimented with the actual speed but it seemed a bit too slow to me. Anyhoo you can send a different value or just add a field to your card to specify this more precisely.

————

Finale notes : the deck options

————

There’s nothing special about those, but two things to be aware of :

a) I disabled the Auto-advance completely (0,0 everywhere), and make sure you didn’t tick “Don’t play audio automatically” under Audio (this needs to be off)

b) I created some Options preset specific for those “Glossika-style” playback decks, mostly to be able to isolate the FSRS settings.
I still need to experiment with those, but I assume that, since it’s hands-free, and my mind can wander a little during long practice sessions, it cannot really hurt to review more than normal Anki cards.
For now I set a 0.98 retention which is a lot but might get closer to how often Glossika presents a sentence before it practically disappears. I also need to think a little about maximum interval.

Anyway, I will probably give myself half a year to refine those, keep doing Glossika (I’m only half way and I really want to finish it !) and play around with Spoonfed in parallel.
Then when I’m ready and happy with my settings I’ll just move away from Glossika completely and start sentence-mining seriously.

Thanks again to everyone for their help on this ! :pray: :pray: :pray: