WaniKani Context Sentence Google TTS (Text-To-Speech)

I threw together a userscript that adds text-to-speech buttons to Japanese context sentences in WaniKani. Click the :speaker_high_volume: button next to any Japanese sentence to hear it spoken aloud using Google’s Neural2 Japanese voices at 80% speed.

You must update the script with a valid API key from Google Cloud Console.

  1. Create a new project or select an existing one

  2. Enable the “Cloud Text-to-Speech API” for your project

  3. Go to “APIs & Services” > “Credentials”

  4. Click “Create Credentials” > “API Key”

  5. Copy the API key and replace the value for ttsApiKey in the userscript.

The playback speed is also configurable by changing the value of the speakingRate variable, where 1 is 100% speed. The default value is 0.8 setting it to 80% speed.

Additionally, you can use one of three voices and can configure this with the voice variable. The default value is “ja-JP-Neural2-C”, but “ja-JP-Neural2-B” and “ja-JP-Neural2-D” are also valid voices.

It looks like this

And sounds like this (click the link for an audio sample).

Install it from Greasy Fork.

I really like hearing audio for example sentences, and Google’s TTS is fairly natural, so I’m really excited about this, personally. If only I end up using it I’ll certainly be happy, but I hope if there was anyone else out there that wanted audio for context sentences that this is helpful for them as well.

Reading your post, I realised this feature should be added to Mina the android app for WK. This feature will be part of the next round of features and changes to the app.

Since I was inspired by you, I followed your model. Thank you!

That’s awesome! If it weren’t for the fact that I’m on iOS I’d go check it out :sweat_smile: