Building an n8n System That Auto-Generates English Shadowing Material and Stocks It in Anki: Stuck Three Times on TTS [PART 2]

This post contains a referral link.

What you’ll learn in this post: why KOKORO didn’t work on my Synology, how I switched to Edge TTS, the pitfalls of connecting to AnkiConnect, the final flow I solved with Obsidian_to_Anki, and the truth about the bug that added “?” to my mp3 files

In the last post, I wrote about the design of my shadowing material generator: “a system where an Anki card with audio is generated automatically just by sending what I want to stock (a URL or pasted text).”

Building an n8n System That Auto-Generates English Shadowing Material and Stocks It in Anki [PART 1]

Design alone is full of dreams, but building it is never that easy lol. This post is the record of actually building it.

In a word, it’s the story of “nothing went according to the original plan.” I got stuck on TTS (generating the audio), hit a wall with AnkiConnect, and in the end, the punchline was that “the systems I already had solved everything.” I wrote down every place I got stuck, so I’d be happy if it helps anyone trying to build this in the same environment (Synology + n8n + Anki).

Sponsored links

Trying KOKORO on the Synology (until I gave up)

At first, I planned to run an open-source TTS called KOKORO on my Synology, as I wrote in PART 1.

Building an n8n System That Auto-Generates English Shadowing Material and Stocks It in Anki [PART 1]

I searched for hwdsl2/kokoro-server in Container Manager’s registry and installed it. It started up without any problems.

Snag ①: the port mapping was assigned automatically

When I checked Container Manager’s Port Settings, a five-digit number had been assigned instead of the default 8880. I checked the actual port in Port Settings and accessed /docs (Swagger UI). Once I matched the port in n8n’s HTTP Request, I could connect.

Snag ②: an NNPACK error pushed the CPU to 100%

Requests from n8n took more than 15 minutes and timed out. The container log said:

NNPACK: Unsupported hardware

My home NAS server, a DS220+, has a Celeron J4025. It doesn’t support PyTorch’s CPU acceleration (NNPACK), and KOKORO used up the whole CPU, with the side effect of taking n8n itself offline.

Snag ③: ffmpeg timed out too

I tried just the audio conversion, but got ffmpeg timed out after 60 seconds. Maybe the DS220+ just can’t handle it hardware-wise… I decided there must be other ways and gave up without spending more time. I deleted the KOKORO TTS container and image (1.8GB).

The KOKORO image was 1.8GB, so watch your free disk space when you try it. On a NAS, though, I don’t think your storage is usually packed that full.

Choosing another TTS

I gave up on KOKORO and looked into other TTS options.

Running Gemma locally was rejected right away. The DS220+ has at most 6GB of RAM, so even Gemma 2B would be tough.

Google Cloud TTS was a good option, but needing to register a credit card bothered me. It’s free up to 4 million characters a month, so it’s practically free, but calling it through an API? I don’t really understand it, and I kept seeing articles about huge bills showing up without people knowing after they registered a card, so that small psychological hurdle made me put it off. I’d like to try it someday once I study properly and can set it up right ^^

So I had Claude search around, and what we found was Edge TTS (travisvn/openai-edge-tts).

Completely free, no API key needed (optional). Processing runs on Microsoft’s servers, so it barely uses the Synology’s CPU. It uses the same API format as KOKORO (/v1/audio/speech), so the changes to the n8n settings are minimal. It’s unofficial, so there’s a risk it could suddenly stop, but for personal use that’s acceptable.

It’s for personal use, so I found a more than good enough option. Let’s try it ♪( ´θ`)ノ

Setting up Edge TTS

I installed travisvn/openai-edge-tts in Container Manager. The settings are simple:

  • Port: fixed at 5050:5050
  • Environment variable: set API_KEY to any string (optional)

I added Authorization: Bearer <API key> to the Header in n8n’s HTTP Request and sent this in the Body:

{
  "input": "Hello, this is a test.",
  "voice": "en-US-AriaNeural"
}

I got the audio file (mpga format) 🎉 After all the trouble with KOKORO, it worked so easily that it was almost an anticlimax lol. The fun part is that you can change the accent, and by changing this sentence, it speaks as if different people were talking. Amazing~…

Half a day stuck connecting to AnkiConnect

Getting the audio seemed to work for now, so the next hurdle was connecting to AnkiConnect.

I wanted to add cards directly to Anki on my Mac, so I talked it over with Claude a lot. Here’s everything I tried:

  • Changed webBindAddress: 0.0.0.0 in the AnkiConnect settings, among other attempts to add Anki cards directly from n8n on the NAS to the Mac
  • Turned on “Allow incoming connections” in Tailscale
  • Turned off the macOS firewall

I tried all sorts of things, but every one of them timed out. When I checked with tcpdump, it looked like no packets were reaching the Mac at all. When I checked the Synology with ip link show, there was no Tailscale interface (tailscale0).

Root cause: Tailscale on Synology runs in userspace mode. Tailscale’s own protocol (tailscale ping) gets through, but TCP traffic like n8n’s HTTP Request isn’t routed. I think a lot of people with the same setup get stuck here.

The fact that tailscale ping worked but HTTP Request didn’t really bugged me. I kept at it for about half a day lol

Note (November 2026): I’ve since set AnkiConnect’s webBindAddress back to 127.0.0.1, so only the Mac itself can reach it.

The solution: just use Obsidian_to_Anki

While I was at a loss, it hit me. Why not just use the system I already have?

The Obsidian_to_Anki plugin. It’s really handy, and I use it a lot, and it looked like it could solve every problem with the n8n → Anki connection. No direct TCP connection to AnkiConnect needed: as long as things get into Obsidian, they can be synced to Anki in one click! That was the plan.

My history of automating Anki

Always-running Python script → gave up because I didn’t want it hogging a terminal
  ↓
Mac Folder Actions → didn’t work with a Google Drive folder
  ↓
rsync + launchd → the setup was too complicated
  ↓
Obsidian_to_Anki plugin ← running now

When the Obsidian_to_Anki plugin scans card text that contains ![[file name.mp3]], it finds the mp3 file in the vault and copies it to Anki’s media folder automatically. The text and the MP3 go into Anki at the same time, which is really handy…

The final flow (confirmed)

n8n
  ├─ card.md → written to the Obsidian vault (English/Shadowing materials/)
  └─ audio.mp3 → written to the same folder
         ↓
Synology Drive → syncs to the Mac automatically
         ↓
Click the Anki icon in Obsidian (manual trigger)
         ↓
Obsidian_to_Anki plugin
  ├─ MP3 → copied to Anki’s media folder
  └─ Card text → added to the Anki deck

Connecting the systems that already work often goes better than connecting things directly with the latest tech. I feel this happens a lot when you use n8n lol. It depends on your own setup, though.

My n8n docker run command already included -v /volume1/homes/●●●/Obsidian-Vaults:/obsidian, so no extra Container Manager settings were needed at all. n8n could already reach the vault at /obsidian/My brain/ from inside the container. If I’d used that from the start, I wouldn’t have taken the long way around.

Connecting the full n8n flow

Here’s the n8n flow I built first:

Form Trigger
  → Prompt Code (builds the prompt)
  → Basic LLM Chain (Gemini 2.5 Flash)
  → Card Code (generates the card .md)
  → Convert to Text File
  → Write File (.md)
  → Edge TTS HTTP Request (generates the audio)
  → Write File (.mp3)

The Gemini prompt asked it to “compress to 100–120 words at B2→C1 level, with 5 key expressions, 5–8 related words, a Japanese translation, a category and a title, all returned as JSON.”

But a few errors came up along the way:

  • $('Form Trigger') node reference error → replaced the URL and Title fields with empty strings
  • expressions came out as undefined: undefined → the field names in the prompt didn’t match the variable names in the code (fixed to e.en / e.jp)
  • Write File wanted binary data → solved by adding a Convert to Text File node in between
  • The path was missing /My brain

I knocked them out one by one while having Claude look into them lol.

The last two big bugs

① The Translation field wasn’t filled in correctly

The cards arrived, but the Anki card’s Translation field, for the Japanese translation of the English text, was empty. The English and the Japanese translation were both going into the same Text field.

Digging into the cause, the root was Obsidian_to_Anki’s fields_dict (a cache of field names). After I added a Translation field in Anki, pressing the plugin’s “Regenerate Note Type Table” didn’t update the cache.

No matter how many times I tried, it didn’t work, so I decided to look at the plugin’s settings file in the vault directly. When I opened .obsidian/plugins/obsidian-to-anki-plugin/data.json, I confirmed Translation wasn’t there. With Obsidian closed, I edited data.json directly to add Translation, restarted, and it was fixed.

The lesson this time: when Regenerate doesn’t work, look at data.json directly. I’ll probably have forgotten by the next time I hit the same problem, though lol

② The audio files didn’t reach Anki’s media folder

The cards arrive. They sync to Anki just fine, but the mp3 audio doesn’t. Still, the mp3 is properly created in Obsidian. When I checked collection.media directly, the mp3 file wasn’t there. I see, I must have gotten Obsidian’s audio link syntax wrong.

// ❌ With this, Obsidian_to_Anki can’t find the file
Audio: [sound:shadowing_xxx.mp3]

// ✅ With Obsidian’s embed syntax, it works correctly
Audio: ![[shadowing_xxx.mp3]]

Why do you need ![[…]]? Obsidian_to_Anki searches the vault with an internal function called getFirstLinkpathDest(). Apparently, using the ![[…]] syntax makes this function work correctly. Writing [sound:…] directly skips the search. There was a similar report in GitHub Issue #217.

Trying to make the file names readable

After the flow worked, I made some small improvements. At first the file names were timestamps like shadowing_1778298797953.md, so I couldn’t tell which article they were from. I had Gemini also generate a category and a shortTitle and put them in the file name (in Japanese):

Before: shadowing_1778298565403.md
After:  20260509【政治・外交】AI声優権保護の新ガイドライン.md

It looked great on my computer. I added to the node that Gemini picks the category from “health and medicine, environment and climate, politics and diplomacy, economy and business, technology, society and culture, education, sports, science.” I could tell right away, “Oh, this is from that article,” and it was starting to feel like I could manage it like a real shadowing generator app specialized for the Eiken.

But I couldn’t hear the audio on my phone (iPhone).

It played in Anki on my computer, but on my phone, only the audio didn’t arrive. When I looked into it, I found that AnkiWeb, the sync service for phones, doesn’t support uploading file names that contain kanji or hiragana.

It had finally become easy to read, but if I couldn’t use it on my phone, there was no point. With tears in my eyes, I went back to file names with only letters and numbers.

The truth about the bug that added “?” to my mp3 files

When I tried to separate the audio into a subfolder (audio/), a bug appeared where ? got mixed into the mp3 file names. Ugh, give me a break… But difficulties you can overcome are fun 🎵

A static path, an expression, rebuilding the binary in a Code node: whatever I did, it wouldn’t go away. This one really had me stuck.

  • Completely rebuilt the binary with prepareBinaryData → still ?
  • A completely fixed path, test.mp3 → test.mp3????? (it went up to five)
  • Specifying a directory path → EISDIR error

The culprit wasn’t an n8n bug. It seems it was a Code node I had added along the way.

Oops (๑╹ω╹๑ )

Because I had put a “Code node that rebuilds the binary” between HTTP Request and Write File to Disk,

the ? was being added.

HTTP Request → [Code node removed] → Write File to Disk (connected directly)

Just this made the ? disappear. Writing to the subfolder and the letters-and-numbers file names worked without problems, the mp3 played, and the text was properly linked!!

English/Shadowing materials/
  ├─ 20260509_culture_rv0l.md
  └─ audio/
       └─ 20260509_culture_rv0l.mp3

It reminded me again that “suspect what you added yourself” is a golden rule of debugging lol.

Summary: every place I got stuck

SnagCauseFix
KOKORO timed outThe DS220+ doesn’t support NNPACK (CPU limit)Switched to Edge TTS
Couldn’t connect to AnkiConnectTailscale on Synology runs in userspace modeWorked around it with Obsidian_to_Anki
Translation wasn’t filled inThe fields_dict cache was out of dateEdited data.json directly
Audio didn’t reach AnkiNeeded ![[…]] instead of [sound:…]Changed to Obsidian’s embed syntax
“?” added to the mp3A Code node between HTTP Request and Write FileRemoved the Code node and connected them directly again

It was one “it won’t go as designed” after another, but that made figuring out solutions fun. The moment I realized, “Wait, I already had Obsidian_to_Anki!” made me a little happy lol.

In the next post, PART 3, I’ll introduce the automatic shadowing-and-reading card creation that finally worked, plus the improvements and thoughts after actually using it for a week.

Adding Three Accent Buttons: Hearing US, UK and AU English on One Anki Card [PART 3]

Later: When I used it again after about half a year, this Edge TTS couldn’t create audio anymore because of a 403 error. The cause was a change on Microsoft’s side, and updating the image of the Synology container didn’t fix it, so I wrote up the fix in a separate post.

Edge TTS 403 Error Fix: When openai-edge-tts on Synology Stops Making Audio

🃏 I’ve also put all my Anki posts together on one page, sorted by what you need: getting started, settings, keeping it up, automation, audio and troubleshooting.

NO IMAGE

Referral link: if you sign up through it, I may receive free lesson minutes.

🎧 Once your materials are ready, it’s time to say the English you copied

Once your audio system is ready, the next step is to actually speak the English you copied. On Cambly, you can listen to a native tutor’s real English and try speaking right on the spot. You can start a lesson any time, 24 hours a day, without booking. Through my referral link, you get 10 extra minutes when you buy a trial. I’ve been taking lessons on Cambly since July 2021.

Try Cambly with my referral link →

The referral program isn’t available in every region.

English expressions I learned (B2–C1)

I’m aiming for Eiken Grade 1, so I had AI pick out some useful phrases from this topic. These come up often when reading English articles about n8n, Anki and TTS.

① user space

Tailscale on Synology runs in user space, which means standard TCP traffic won’t route through the interface.

When processing runs on the application side instead of in the OS kernel. Used in contrast with “kernel space.” It comes up often in technical articles about networking and security.

② fallback (an alternative, a backup plan)

When the primary method failed, we needed a reliable fallback to keep the pipeline running.

A backup option for when the original method can’t be used. It often appears as “fallback option” or “fall back to X.” Edge TTS was exactly in this position this time.

③ parse (to analyze)

The plugin parses the card format and extracts each field name from the cached configuration.

To read text or data and turn it into a form that can be processed. There are many related forms like “parser” and “parsing error.” It shows up in almost every article about n8n, programming and APIs.

☕ Enjoyed this post?

I'm a Japanese blogger who spent 8 years relearning English from scratch.
If this post helped you, a coffee would mean a lot — thank you for reading!

Leave a Reply

Your email address will not be published. Required fields are marked *

ABOUT US
Suitman
An office worker in Japan who has worked in three fields: education, manufacturing and sales. I started learning English at 35 and, after 8 years of keeping at it, passed Eiken Grade Pre-1. VERSANT score: 59. I write about work tips, Excel, AI, English and cameras, all based on my own experience.