# lila507/fumotalk architecture

> Architecture diagram of the GitHub repository lila507/fumotalk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lila507/fumotalk
- Repository: https://github.com/lila507/fumotalk

## Overview

SakuFumo is a command-line mixed-text-to-Yukkuri speech tool: users enter Chinese, romanized English, kana, and digits, choose a voice, and receive synthesized WAV audio that can be played. Its distinct stages are tokenization and pronunciation conversion, voice-configured synthesis (including long-text chunking), and WAV output/playback. The README documents capabilities beyond the sampled excerpts; links to those capabilities are shown only where their wiring is supported.

Main entry points: [`sakufumo.py`](https://github.com/lila507/fumotalk/blob/main/sakufumo.py) (AquesTalk wrapper), [`mapping.tsv`](https://github.com/lila507/fumotalk/blob/main/mapping.tsv) (Pinyin map)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversion["Text conversion"]
  node_mapping["Pinyin map<br/>[mapping.tsv]"]
  node_tokenizer["Mixed tokenizer<br/>[sakufumo.py]"]
  node_pronunciation["Pronunciation conversion<br/>[sakufumo.py]"]
  node_kana["Filtered kana<br/>[sakufumo.py]"]
end

subgraph group_speech["Speech synthesis"]
  node_presets["Voice presets<br/>[sakufumo.py]"]
  node_synth["AquesTalk wrapper<br/>[sakufumo.py]"]
  node_chunking["Long-text chunking<br/>[sakufumo.py]"]
  node_wav["WAV output<br/>[sakufumo.py]"]
end

subgraph group_interaction["User and audio"]
  node_cli["CLI workflow<br/>[sakufumo.py]"]
  node_playback["Audio playback<br/>[sakufumo.py]"]
end

node_user(("User"))
node_pypinyin["pypinyin"]
node_aqtk["AquesTalk engine"]
node_audio["Playback service"]

node_user -->|"enters text and voice"| node_cli
node_cli -->|"loads map"| node_mapping
node_cli -->|"converts input"| node_tokenizer
node_tokenizer -->|"dispatches tokens"| node_pronunciation
node_pronunciation -->|"looks up pinyin"| node_mapping
node_pronunciation -->|"gets pinyin"| node_pypinyin
node_pronunciation -->|"filters output"| node_kana
node_cli -->|"requests synthesis"| node_synth
node_synth -->|"selects voice"| node_presets
node_synth -->|"splits long text"| node_chunking
node_synth -->|"calls synthesis"| node_aqtk
node_synth -->|"writes WAV"| node_wav
node_cli -.->|"requests playback"| node_playback
node_playback -->|"plays WAV"| node_audio

click node_cli "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_mapping "https://github.com/lila507/fumotalk/blob/main/mapping.tsv"
click node_tokenizer "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_pronunciation "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_kana "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_presets "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_synth "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_chunking "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_wav "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"
click node_playback "https://github.com/lila507/fumotalk/blob/main/sakufumo.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_mapping,node_tokenizer,node_pronunciation,node_kana,node_user toneBlue
class node_presets,node_synth,node_chunking,node_wav toneAmber
class node_cli,node_playback toneMint
class node_pypinyin,node_aqtk,node_audio toneIndigo
```

## Components

### Text conversion

- [Pinyin map](https://github.com/lila507/fumotalk/blob/main/mapping.tsv): `mapping.tsv`
- [Mixed tokenizer](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`
- [Pronunciation conversion](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`
- [Filtered kana](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`

### Speech synthesis

- [Voice presets](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`
- [AquesTalk wrapper](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`
- [Long-text chunking](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`
- [WAV output](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`

### User and audio

- [CLI workflow](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`
- [Audio playback](https://github.com/lila507/fumotalk/blob/main/sakufumo.py): `sakufumo.py`

### Other components

- **User**
- **pypinyin**
- **AquesTalk engine**
- **Playback service**

## Connections

- User → CLI workflow: enters text and voice
- CLI workflow → Pinyin map: loads map
- CLI workflow → Mixed tokenizer: converts input
- Mixed tokenizer → Pronunciation conversion: dispatches tokens
- Pronunciation conversion → Pinyin map: looks up pinyin
- Pronunciation conversion → pypinyin: gets pinyin
- Pronunciation conversion → Filtered kana: filters output
- CLI workflow → AquesTalk wrapper: requests synthesis
- AquesTalk wrapper → Voice presets: selects voice
- AquesTalk wrapper → Long-text chunking: splits long text
- AquesTalk wrapper → AquesTalk engine: calls synthesis
- AquesTalk wrapper → WAV output: writes WAV
- CLI workflow → Audio playback: requests playback
- Audio playback → Playback service: plays WAV
