add-language

add-language is a command for Claude Code from ayutaz/piper-plus. It costs 0 tokens per session (2,514 once invoked), scanned A, original, MIT.

A step-by-step guide for adding a new spoken language to piper-plus, including its pronunciation rules and text-to-speech processing. You provide a language code such as de, it, or da.

In plain words
What is it for?
Use it to add phoneme definitions, pronunciation processing, prosody support, tests, and matching implementations for a new language in piper-plus.
Why use it?
It gives developers a defined path through the many files and language-specific rules involved in supporting a new language. It also helps keep the Python implementation and its copies in other programming languages aligned.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/ayutaz/piper-plus/add-language
Clone the repo
git clone --depth 1 https://github.com/ayutaz/piper-plus

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-language

README.md
[![agentmods](https://agentmods.dev/badge/commands/ayutaz/piper-plus/add-language.svg)](https://agentmods.dev/commands/ayutaz/piper-plus/add-language)
Your own site
<a href="https://agentmods.dev/commands/ayutaz/piper-plus/add-language"><img src="https://agentmods.dev/badge/commands/ayutaz/piper-plus/add-language.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,514 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02514
Opus 5 $0.00000 $0.01257
Sonnet 5 $0.00000 $0.00503
Haiku 4.5 $0.00000 $0.00251

Measured 4d ago against content hash 75485312e402, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

add-language scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/add-language.md · 239 lines

How it starts

The opening of the file, as written. The whole thing — 239 lines — stays where its author put it; the contents beside it link to each section on GitHub.

新言語追加ガイド

新しい言語を piper-plus に追加するためのガイドです。引数 $ARGUMENTS に言語コード (例: de, it, da) を指定してください。

前提条件

  • Python テストは uv run python -m pytest で実行
  • 各タスク完了ごとにコミット
  • Python が参照実装、他言語は 1:1 ミラー
  • eSpeak-ng 不使用 (MIT ライセンス維持)

Phase 1: Python 音素定義 + G2P エンジン

1.1 音素インベントリ + PUA 割り当て

新規作成: src/python/piper_train/phonemize/$ARGUMENTS_id_map.py

from .token_mapper import register
[LANG]_PHONEMES: list[str] = [
    # 単一コードポイント (PUA不要)
    # 多文字トークン (PUA必要) — register() で登録
]
for _token in [LANG]_PHONEMES:
    register(_token)

修正: src/python/piper_train/phonemize/token_mapper.py

  • FIXED_PUA_MAPPING に PUA エントリ追加
  • 現在の最終 PUA: SV = 0xE061、予約 = 0xE062-0xE063
  • 新言語は 0xE064 以降 に割り当て
  • _PUA_START を新言語の最終 PUA + 3 に更新 (将来拡張用)

衝突チェック:

JA: 0xE000-0xE01C (29), ZH: 0xE020-0xE04A (43), KO: 0xE04B-0xE052 (8)
ES/PT: 0xE054-0xE055 (2), FR: 0xE056-0xE058 (3), SV: 0xE059-0xE061 (9)

1.2 G2P エンジン作成

新規作成: src/python/piper_train/phonemize/$ARGUMENTS.py

必須クラス:

class [Lang]Phonemizer(Phonemizer):
    def phonemize(self, text: str) -> list[str]: ...
    def phonemize_with_prosody(self, text: str) -> tuple[list[str], list[ProsodyInfo | None]]: ...
    def get_phoneme_id_map(self) -> dict[str, list[int]] | None:
        return None  # multilingual id_map を使用

G2P パイプライン (言語に応じて調整):

  1. テキスト正規化 (NFC + lowercase)
  2. トークン化 (単語/句読点分離)
  3. 辞書ルックアップ (オプション)
  4. 借用語ルール (接尾辞検出)
  5. ネイティブ音素変換 (子音 + 母音)
  6. 後処理 (同化、ストレスマーカー)

Prosody: a1=0, a2=stress(0/1/2), a3=word_phoneme_count

1.3 レジストリ + 多言語統合

修正: src/python/piper_train/phonemize/registry.py

try:
    from .$ARGUMENTS import [Lang]Phonemizer
    register_language("$ARGUMENTS", [Lang]Phonemizer())
except ImportError:
    pass
  • ラテン文字言語なら latin_langs にも追加

修正: src/python/piper_train/phonemize/multilingual_id_map.py

try:
    from .$ARGUMENTS_id_map import [LANG]_PHONEMES
    LANGUAGE_PHONEMES["$ARGUMENTS"] = [LANG]_PHONEMES
except ImportError:
    pass

Read the full file on GitHub · 239 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 239 lines · 0 tokens per session scan A 75485312e402

Subscribe to this mod's changes

add-language is a command published in the GitHub repository ayutaz/piper-plus (202 stars, last pushed 6d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,514 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.