Adding a pause between autoplayed sounds on Mac

I have cards with several sounds on them, a word and a couple of example sentences. I’d like the sounds to auto-play, but with a pause of half a second or so between them, to give me a chance to recall the word before I hear the examples.

There is another thread about this issue titled “Interval between audio playbacks during autoplay”. However the solution there doesn’t work for me, possibly because I’m on a Mac.

Is there a way to achieve this in Anki Desktop on a Mac?


For some inexplicable reason I’m not allowed to include links in my quesiton, but the URL of the other thread is https://forums.ankiweb.net/t/interval-between-audio-playbacks-during-autoplay/2308

The script on that page runs and creates a file in ~/Library/Application Support/Anki2, but seems to have no effect on audio playback, even if I restart Anki.

Are you sure you use mpv? If you run anki without mpv you’d get this:

mpv not found, reverting to mplayer

You can check by opening your terminal and typing the command anki into it (or whatever the mac equivalent is for that).

I don’t even know what mpv is (though I could guess it’s an audio player), so if it’s not the default on Mac I almost certainly don’t use it.

There doesn’t seem to be an anki command. I tried running open /Applications/Anki.app but it just opened Anki without printing anything to the terminal.

Correct.

Judging by Anki won't open on MacOS the command is

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

and it should be able to print something. Maybe the command prompt had been changed though. Someone else will surely be able to help in that case.

(if the command works, please show the output if there is any)

2 Likes

Ok, here’s the output:

Anki starting...
Initial setup...
Starting Anki 25.02...
2025-03-27 19:54:10,984:INFO:aqt.mediasrv: Serving on http://127.0.0.1:52204
Starting main loop...
Qt warning: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=758.701,668.925 gbl=758.701,668.925 Released ellipse=(0.909091x0.909091 ∡ 0) vel=0,0 press=-758.701,-668.925 last=-758.701,-668.925 Δ 758.701,668.925) : no target window 
Qt warning: skipping QEventPoint(id=1 ts=0 pos=0,0 scn=611.917,329.833 gbl=611.917,329.833 Released ellipse=(0.909091x0.909091 ∡ 0) vel=0,0 press=-611.917,-329.833 last=-611.917,-329.833 Δ 611.917,329.833) : no target window 
1 Like

Some testing

Since the message isn’t there I’m guessing mpv is installed.

To diagnose whether mpv supports adding a pause between audio playbacks at all, I ran the following in the terminal (on debian linux):

mpv --audio-wait-open=1 ./A.mp3 ./B.mp3

Result? Audio is played just fine, just without the desired pause.

I couldn’t really find anything on the internet regarding possible reasons and fixes and thus asked an ai chat bot. Its answer might be inaccurate but it does seem to make sense to me. The AIs answer:

As of the latest versions of mpv, the option --audio-wait-open is primarily used to control how long to wait for an audio stream to become available before starting playback. It doesn’t create an intentional pause between tracks in the same way you might be expecting.
[…]
While you noted reports from users about audio-wait-open, it’s primarily utilized in scenarios where there’s buffering involved rather than controlling playback timing between multiple files.

Also: The manual (mpv.io) says this:

If this option is given, the player will wait for the given amount of seconds after opening the audio device before sending actual audio data to it. Useful if your expensive hardware discards the first 1 or 2 seconds of audio data sent to it.

So in short: Apparently it worked for the other users because their hardware just happend to behave this way.

Workaround

  1. You can open some audio creating tool (like audacity),
  2. create one minute of silence,
  3. save the file,
  4. include it in your fields.

Not ideal but the best thing I can come up with right now.

(and maybe js can be used to automate this in your template)

Edit: I just remembered I helped a user a while ago to set up a “ding” sound. You can look through the code and discussion and modify the code to create an automated one second pause: Conditional Audio Playback - #5 by Anon_0000.