Creating Audio Cards on MacOS

Introduction

Hi everyone, I'm writing this because most of the resources for immersion-based language learning are targeted at Windows (or occasionally Linux) users.

The two main methods for making Audio Cards (ShareX and MPV scripts) don't work on Mac (Update: seems like it's possible but clunky to get MPV to work - but I haven't done it personally so I can't help with that)

, and there are some other minor issues as well, so I wanted to write a guide so that other people don't have to go through all the trial and error that I did.

This guide is intended as a supplement to the Animecards guide which you can find at https://sites.google.com/view/audio-cards-guide/ (or some other guide that deals with initial Anki setup etc)

One disclaimer: This method requires that you buy a Mac app called Keyboard Maestro. It costs $36+tax, but there is a free trial. I have no connection to the developer of this app. If anyone knows how to replicate this functionality without using any paid apps, please let me know and I'll update the guide.

Also please note that this guide is specifically about how to make Audio Cards with Anki/Yomichan, and should not be taken as general learning methodology advice. What's the best methodolgy for learning Japanese? Who knows... well certainly not me! I'm not yet at a level that qualifies me to give meaningful advice about any of that.

I have used this setup on both an Intel Mac running Yosemite and Big Sur, and an Apple Silicon Mac running Big Sur, so everything should work regardless of your architecture/OS.

If you have any suggestions or questions about this guide, feel free to contact me on Discord, cje#1138.

Anki and Yomichan Setup

  • (use the Animecards guide mentioned above...

  • In Anki's main preferences menu, make sure "Paste without Shift Key strips formatting" is checked

  • Here's a link to my handlebars file: https://pastebin.pl/view/raw/f2e2b9ea

Audio Recording Setup

  • This setup records Audio in a similar manner to ShareX: Press a hotkey or shortcut once to start it, a second time to stop it. The audio is then put in your clipboard so you can paste it into Anki

  • Piezo Setup

    • Download and install Piezo from https://rogueamoeba.com/piezo/

      • The only limit of the free version is that each recording can only be 10 minutes maximum in length. We're only recording a few seconds at a time here so this is not a problem.

    • Select Microsoft Edge (or whatever you're recording from) as your Source.

    • In the settings (the small gear in the application window), select "For Internet distribution, Music (low quality)"

      • This makes 128kbps mp3 files

      • There's a "spoken word" setting that makes 64kbps AAC files. If you want to use this, you need to change the text in "Set System Clipboard to File Reference" (see keyboard Maestro Setup) to end with ".aac" instead of ".mp3". But I'd recommend sticking with mp3 for compatibility reasons.

  • Keyboard Maestro Setup

    • Download and install Keyboard Maestro from https://www.keyboardmaestro.com/main/

      • Please note that this is a paid application so after the trial is over you will need to purchase it.

    • Delete or Disable all the Macros that come with the application by default

    • Add this script to Keyboard Maestro: https://mega.nz/file/9gAXFa5A#ztOOLXUSW9RImkLHh9ZVzDbaItMKLx-XJB39IfwSwWI

    • In the "Set System Clipboard to File Reference" section of the script, change it to match your username

      • /Users/[YOUR USERNAME HERE]/Music/Piezo/%Variable%AudioOut%.mp3

    • I have the hotkey set to CMD+Tilde, but you can obviously change it to anything else

      • If the audio gets recorded, but doesn't get put in your clipboard, try a different shortcut. Specifically CMD+R did not work for someone.

    • Once the macro is set up, Keyboard Maestro doesn't need to be open for the macro to work.

    • Piezo, however, does need to be running.

    • In case the mega.nz link above stops working, here are screenshots of the script so you can recreate it yourself:

Using this Audio Recording Setup

It takes a bit to trigger (less than a second). You'll see Piezo jump to the front of the screen, and then go back behind the active window. As soon as Piezo stops being the frontmost window, you're recording. Therefore what I like to do is pause the video at the place I want to start recording, press the hotkey to start recording, and as soon as Piezo disappears, resume the video.

The recordings you create with Piezo don't just end up in your clipboard, it also stores a file of each of them at [Your User Name]/Music/Piezo. It doesn't take up a meaningful amount of space, but you can clear that folder occasionally if you want.

Creating Cards from Online Video

  1. The video service needs to have subtitles that appear on the page as plain text, ie you can select them and use Yomichan on them.

  2. You need an easy way to take screenshots.

YouTube

  • For screenshots, install this addon: https://chrome.google.com/webstore/detail/screenshot-youtube/gjoijpfmdhbjkkgnmahganhoinjjpohk

    • Once the addon is installed, open the extension options, make sure that a hotkey is set (default is P), and select "Copy to clipboard"

  • For subtitles, click on the three dots below the video, then on "文字起こしを開く" / "close captions". However beware that the majority of close captions on YouTube are generated by AI so they range from nearly perfect to almost every line having mistakes in it depending on which video you're watching.

Netflix

Other Services (Prime Video, etc)

I don't really use anything else so I'm not sure. But this should be exactly the same as on Windows, so you don't neeed a Mac-specific guide. If the service you're using doesn't have some way to get the subtitles as selectable text, you'll probably have to transcribe them yourself.

Creating Cards from Local Files

  • Use this player: https://animebook.github.io

    • Drag a video file onto it, and then the corresponding subtitle file

    • If you don't have Japanese subtitles, check here: https://kitsunekko.net/dirlist.php?dir=subtitles%2Fjapanese%2F

    • If the subtitles are not synchronized to the video, use the "Offset Subtitles" feature in the bottom right of the player. For example if the subtitles show up 1 second later than they should, type "-1" into the Offset Subtitles field.

    • If you install the Animebook browser extension (you can find a link on the animebook page), you don't even need to manually record audio, take screenshots, or copy subs - it's all done with one click.

  • For a bunch of other features and hotkeys, press the "?" button in the bottom right of the player.

What to do about files that are not compatible with the AnimeBooks player

Transcoding with Handbrake

If you try to play a video file in the AnimeBooks player and you get a black screen and/or no sound, your file is in a format that the player or your browser can't read, most likely HEVC of some sort. In that case, you need to transcode it.

Download Handbrake from https://handbrake.fr

Once you've applied all of the settings below for the first time, you can select "Save New Preset" so you don't need to do it again in the future.

Also note that Handbrake has a queue. I usually just queue up the transcodes for an entire season of a show before going to bed, and then it's done in the morning.

Here are the setting I use:

  • Summary tab:

    • Format: MP4 file

    • Check "Web Optimized"

    • Check "Align A/V Start"

  • Dimensions

    • this makes no difference for compatibility, but you probably want 1920x1080 or 1280x720 for 16:9 content. Things that are a different aspect ratio are automatically resized correctly.

  • Filters

    • Leave everything here on the default settings

  • Video

    • Video Encoder: H.264 (x264)

    • None of the other stuff matters for compatibility, but I have Framerate at 30 with "Peak Framerate (VFR) checked, and Quality set to Constant, RF 21. This produces files that are about 1GB per hour in size, and strikes a good compromise between quality, file size, and encoding speed for me. But feel free to use any other settings here.

  • Audio

    • The important thing here is to select "AAC (CoreAudio)" for Codec. For video files with multiple audio tracks, make sure you select the Japanese track

  • Subtitles

    • I leave this set to "none", because the AnimeCards player can't recognize baked-in subs. Instead I extract the subtitles, as shown in the next section.

Extracting Subtitles

The AnimeBooks player doesn't understand subtitles that are baked into the video file, so we need to extract them. For this, I use Inviska MKV Extract.

Download the latest Mac version from here: https://www.videohelp.com/software/Inviska-MKV-Extract

Drag one or multiple video files onto the app. On the right side of the window, in "Batch Extract" select the subtitles. Then click "Begin". Wait a moment and that's it, you now have .srt subtitle files.

What About Sentence Cards?

This guide makes Vocab Cards (the word is on the front of the card, and the definition and sentence are on the back along with supplemental things like audio and screenshots).

Some people prefer Sentence Cards (a full sentence is on the front, and then the back adds information to that sentence such as furigana, pitch, definitions, etc. along with the same supplemental things).

The most basic way to change the cards from this template to sentence cards would be to move the Sentence field to the front of the card. However that still doesn't give you readings and pitch for the full sentence. So look for guides from MIA/Refold/Migaku on how to make sentence cards, and replace whatever they use for audio with the Piezo/Keyboard Maestro setup from this guide.