HIRO GEAR
AI GPU 音声認識

Tuning kotoba-Whisper for My Own Speech Patterns

Tuning kotoba-Whisper for My Own Speech Patterns

title: Building a Blazing-Fast Local GPU Japanese Voice Input System categories: AI, Custom PC

tags: Voice Input, Whisper, kotoba-whisper, Rust, GPU, DIY


Building a Blazing-Fast Local GPU Japanese Voice Input System

Motivation: I Wanted an OS Where I Could Use Voice Input with “Windows Key + H”

Windows comes with a built-in feature that launches voice typing when you press “Windows Key + H”. That feature is super convenient, isn’t it?

Ever since switching to Linux (Ubuntu), I had been bothered by not being able to do something equivalent.

So what I built is the custom voice input daemon I’m introducing here.


System Overview

The architecture is simple.

Press [Windows Key + H]
        ↓
Start mic recording with arecord (while the key is held down)
        ↓
Release key → Stop recording
        ↓
Run kotoba-whisper inference on RTX 3060 (local GPU)
        ↓
Copy recognized text to clipboard
        ↓
Auto-paste with Ctrl+V (into any app)

Instead of typing on a keyboard, it feels like you just speak and text gets entered directly.


Key Technical Choices

Language: Rust

Because it runs 24/7 as a resident daemon, I chose Rust with a focus on memory efficiency and performance. It captures keyboard events directly via evdev and creates a virtual keyboard with uinput to reproduce Ctrl+V.

Speech Recognition Model: kotoba-whisper-v2.0

At first, I used OpenAI’s Whisper large model (ggml-large-v3-turbo.bin), but I switched to kotoba-whisper.

kotoba-whisper is a model further trained on Japanese data based on Whisper large-v3, and in particular:

  • Improved recognition accuracy for colloquial and spoken Japanese

  • Fewer misrecognitions of proper nouns (place names, personal names)

  • Virtually the same speed

If you already use Whisper, you can try it simply by swapping the model file.

GPU Selection: Reliably Using the RTX 3060 via UUID

My PC has a dual-GPU setup with a GTX 1650 (dedicated to display output) and an RTX 3060 (dedicated to AI processing) (introduced in another article).

With an index-based setting like CUDA_VISIBLE_DEVICES=1, the environment variable wasn’t always inherited under sudo, which sometimes caused the smaller GPU to be used instead.

So I switched to specifying the GPU UUID directly:

unsafe {
    std::env::set_var(
        "CUDA_VISIBLE_DEVICES",
        "GPU-5e9ee7b1-5492-7b5f-3397-d82eceb2293b" // RTX 3060 UUID
    );
}

You can check the UUID with nvidia-smi -L. With this, the RTX 3060 is now reliably selected every time.


Personal Touch: Customizing Whisper with an Obsidian Vocabulary List

Whisper has a feature called initial_prompt. By passing contextual hints in advance saying “words like these are likely to appear,” you can dramatically improve recognition accuracy for proper nouns.

At first I thought, “Why not just pass the previously recognized text?” However, that has a drawback: any misrecognized content gets passed as context for the next recognition.

So the approach I adopted was managing a proper-noun list as a dedicated file in my Obsidian vault.

I created a file called voice-typer-vocab.md in my notebook and maintain frequently used words myself. Here is an example:

## Personal Names
(Names of acquaintances or colleagues that often come up in conversation, etc.)

## Place Names
(Places I visit often or local place names, etc.)

## Projects
Gonras
Obsidian
Raspberry Pi

## Technical Terms
kotoba-whisper
VOICEVOX
RAG
MCP

Because voice-typer automatically reloads this file every 60 seconds, simply adding a word in Obsidian applies it starting from the very next recognition.


Impressions After Using It

To be honest, the accuracy is higher than I expected.

Even compared to Windows’ built-in voice typing (Win+H), there are fewer wrong conversions and contextual misunderstandings, and I felt the accuracy is dramatically higher. I had also tried Whisper’s Medium model previously, and compared to that, kotoba-whisper-v2.0 has incomparably higher accuracy — usability has improved to a noticeably practical level.

Everyday Japanese is recognized accurately over 90% of the time, and as long as proper nouns are registered in the vocab file, it picks them up quite reliably.

Overwhelming Response Speed

Not only is the accuracy great, the speed is impeccable too. When I embedded a high-precision timer in the program and measured it, inference on the RTX 3060 converted even a relatively long audio clip of about 13 seconds of speech into text and pasted it in just “0.6 seconds” after releasing the key. Because it doesn’t go through any cloud API, there is zero network latency — it is truly “blazing fast.”

Above all, being able to enter text without touching the keyboard is extremely helpful when writing long passages or when both hands are occupied.

Since everything is completed locally, API cost is zero. Anyone with an RTX 3060 can build a similar environment.


Summary

ItemDetails
KeybindingWindows Key (Meta) + H
Speech Recognition Modelkotoba-whisper-v2.0 (Japanese-specialized)
Inference DeviceRTX 3060 (12GB VRAM)
Programming LanguageRust
Dictionary Managementvoice-typer-vocab.md in Obsidian vault
API CostZero (100% local)

If you’re struggling with voice input on Linux, definitely give this a try.