# kuri-san-jp/speechsplice architecture

> Architecture diagram of the GitHub repository kuri-san-jp/speechsplice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kuri-san-jp/speechsplice
- Repository: https://github.com/kuri-san-jp/speechsplice

## Overview

SpeechSplice is a research and evaluation repository for pronunciation control in encoder–decoder text-to-speech. Its main workflow uses benchmark text pairs to evaluate baseline and encoder-hidden-state replacement synthesis, then scores generated audio and aggregates results. The repository also covers multiple TTS systems, model-layer and multi-entity experiments, benchmark resources, and listening-test analysis. The README documents reproducible generation and shipped outputs; sampled code confirms the T5Gemma injection and shared audio utilities. Many experiment runners are unsampled, so their internal calls and result-writing links are omitted.

Main entry points: [`scripts/encoder_injection_t5gemma.py`](https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/encoder_injection_t5gemma.py) (T5Gemma injection), [`scripts`](https://github.com/kuri-san-jp/speechsplice/tree/main/scripts) (Other TTS splicing), [`src/_vendor/t5gemma_tts/inference_tts_utils.py`](https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/inference_tts_utils.py) (T5Gemma inference), [`data/en_cross_culture_names.py`](https://github.com/kuri-san-jp/speechsplice/blob/main/data/en_cross_culture_names.py) (Name pairs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bench["Benchmarks"]
  node_name_data["Name pairs"]
  node_heteronym_data["Heteronym pairs"]
  node_other_benchmarks["Language benchmarks"]
end

subgraph group_synthesis["Synthesis Experiments"]
  node_t5_injection["T5Gemma injection"]
  node_t5_inference["T5Gemma inference"]
  node_audio_tokenizer["Audio tokenizer<br/>[tokenizer.py]"]
  node_duration["Duration estimate"]
  node_t5_model["T5Gemma model<br/>[t5gemma.py]"]
  node_system_splicing["Other TTS splicing"]
  node_multi_entity["Multi-entity runs<br/>[tgt_only.py]"]
end

subgraph group_evaluation["Scoring and Analysis"]
  node_alignment["Whisper alignment"]
  node_phoneme_score["Phoneme scoring<br/>[phoneme_per.py]"]
  node_mcd_score["MCD scoring<br/>[mcd_pysptk.py]"]
  node_trm_score["TRM G2P-CER"]
  node_table_aggregation["Table aggregation"]
end

subgraph group_human["Listening Study"]
  node_human_results["Listening results"]
  node_human_aggregate["Human aggregation"]
end

node_researcher(("Experiment user"))

node_researcher -->|"selects pairs"| node_name_data
node_researcher -->|"selects pairs"| node_heteronym_data
node_researcher -->|"runs experiment"| node_t5_injection
node_name_data -.->|"supplies cases"| node_t5_injection
node_heteronym_data -.->|"supplies cases"| node_t5_injection
node_other_benchmarks -.->|"benchmark systems"| node_system_splicing
node_t5_injection -->|"uses inference"| node_t5_inference
node_t5_injection -->|"uses tokenizer"| node_audio_tokenizer
node_t5_injection -->|"estimates duration"| node_duration
node_t5_inference -->|"tokenizes audio"| node_audio_tokenizer
node_t5_inference -->|"estimates duration"| node_duration
node_researcher -->|"runs comparisons"| node_system_splicing
node_researcher -->|"runs tests"| node_multi_entity
node_system_splicing -.->|"uses alignment"| node_alignment
node_multi_entity -->|"shares splice logic"| node_system_splicing
node_researcher -->|"scores audio"| node_phoneme_score
node_researcher -->|"scores audio"| node_mcd_score
node_researcher -->|"scores outputs"| node_trm_score
node_researcher -->|"recomputes tables"| node_table_aggregation
node_researcher -->|"reviews judgments"| node_human_results
node_human_results -.->|"aggregates counts"| node_human_aggregate

click node_name_data "https://github.com/kuri-san-jp/speechsplice/blob/main/data/en_cross_culture_names.py"
click node_heteronym_data "https://github.com/kuri-san-jp/speechsplice/blob/main/data/en_heteronyms_500.py"
click node_other_benchmarks "https://github.com/kuri-san-jp/speechsplice/tree/main/data"
click node_t5_injection "https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/encoder_injection_t5gemma.py"
click node_t5_inference "https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/inference_tts_utils.py"
click node_audio_tokenizer "https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/data/tokenizer.py"
click node_duration "https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/duration_estimator.py"
click node_t5_model "https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/models/t5gemma.py"
click node_system_splicing "https://github.com/kuri-san-jp/speechsplice/tree/main/scripts"
click node_multi_entity "https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/multientity/tgt_only.py"
click node_alignment "https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/projection/forced_alignment_utils.py"
click node_phoneme_score "https://github.com/kuri-san-jp/speechsplice/blob/main/src/phoneme_per.py"
click node_mcd_score "https://github.com/kuri-san-jp/speechsplice/blob/main/src/mcd_pysptk.py"
click node_trm_score "https://github.com/kuri-san-jp/speechsplice/blob/main/src/score_trm_g2pcer_nopyojt.py"
click node_table_aggregation "https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/aggregate_table1.py"
click node_human_results "https://github.com/kuri-san-jp/speechsplice/blob/main/human_eval/analysis/analyze_preference_primary.py"
click node_human_aggregate "https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/aggregate_human_eval.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_name_data,node_heteronym_data,node_other_benchmarks,node_researcher toneBlue
class node_t5_injection,node_t5_inference,node_audio_tokenizer,node_duration,node_t5_model,node_system_splicing,node_multi_entity toneAmber
class node_alignment,node_phoneme_score,node_mcd_score,node_trm_score,node_table_aggregation toneMint
class node_human_results,node_human_aggregate toneRose
```

## Components

### Benchmarks

- [Name pairs](https://github.com/kuri-san-jp/speechsplice/blob/main/data/en_cross_culture_names.py): `data/en_cross_culture_names.py`
- [Heteronym pairs](https://github.com/kuri-san-jp/speechsplice/blob/main/data/en_heteronyms_500.py): `data/en_heteronyms_500.py`
- [Language benchmarks](https://github.com/kuri-san-jp/speechsplice/tree/main/data): `data`

### Synthesis Experiments

- [T5Gemma injection](https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/encoder_injection_t5gemma.py): `scripts/encoder_injection_t5gemma.py`
- [T5Gemma inference](https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/inference_tts_utils.py): `src/_vendor/t5gemma_tts/inference_tts_utils.py`
- [Audio tokenizer](https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/data/tokenizer.py): `src/_vendor/t5gemma_tts/data/tokenizer.py`
- [Duration estimate](https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/duration_estimator.py): `src/_vendor/t5gemma_tts/duration_estimator.py`
- [T5Gemma model](https://github.com/kuri-san-jp/speechsplice/blob/main/src/_vendor/t5gemma_tts/models/t5gemma.py): `src/_vendor/t5gemma_tts/models/t5gemma.py`
- [Other TTS splicing](https://github.com/kuri-san-jp/speechsplice/tree/main/scripts): `scripts`
- [Multi-entity runs](https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/multientity/tgt_only.py): `scripts/multientity/tgt_only.py`

### Scoring and Analysis

- [Whisper alignment](https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/projection/forced_alignment_utils.py): `scripts/projection/forced_alignment_utils.py`
- [Phoneme scoring](https://github.com/kuri-san-jp/speechsplice/blob/main/src/phoneme_per.py): `src/phoneme_per.py`
- [MCD scoring](https://github.com/kuri-san-jp/speechsplice/blob/main/src/mcd_pysptk.py): `src/mcd_pysptk.py`
- [TRM G2P-CER](https://github.com/kuri-san-jp/speechsplice/blob/main/src/score_trm_g2pcer_nopyojt.py): `src/score_trm_g2pcer_nopyojt.py`
- [Table aggregation](https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/aggregate_table1.py): `scripts/aggregate_table1.py`

### Listening Study

- [Listening results](https://github.com/kuri-san-jp/speechsplice/blob/main/human_eval/analysis/analyze_preference_primary.py): `human_eval/analysis/analyze_preference_primary.py`
- [Human aggregation](https://github.com/kuri-san-jp/speechsplice/blob/main/scripts/aggregate_human_eval.py): `scripts/aggregate_human_eval.py`

### Other components

- **Experiment user**

## Connections

- Experiment user → Name pairs: selects pairs (evidence: `README.md`)
- Experiment user → Heteronym pairs: selects pairs (evidence: `README.md`)
- Experiment user → T5Gemma injection: runs experiment (evidence: `README.md`)
- Name pairs → T5Gemma injection: supplies cases
- Heteronym pairs → T5Gemma injection: supplies cases
- Language benchmarks → Other TTS splicing: benchmark systems (evidence: `scripts/csm/run_csm_eval.py`)
- T5Gemma injection → T5Gemma inference: uses inference (evidence: `scripts/encoder_injection_t5gemma.py`)
- T5Gemma injection → Audio tokenizer: uses tokenizer (evidence: `scripts/encoder_injection_t5gemma.py`)
- T5Gemma injection → Duration estimate: estimates duration (evidence: `scripts/encoder_injection_t5gemma.py`)
- T5Gemma inference → Audio tokenizer: tokenizes audio (evidence: `src/_vendor/t5gemma_tts/inference_tts_utils.py`)
- T5Gemma inference → Duration estimate: estimates duration (evidence: `src/_vendor/t5gemma_tts/inference_tts_utils.py`)
- Experiment user → Other TTS splicing: runs comparisons (evidence: `README.md`)
- Experiment user → Multi-entity runs: runs tests (evidence: `README.md`)
- Other TTS splicing → Whisper alignment: uses alignment (evidence: `scripts/csm/run_csm_eval.py`)
- Multi-entity runs → Other TTS splicing: shares splice logic (evidence: `scripts/irodori/run_multientity_irodori.py`)
- Experiment user → Phoneme scoring: scores audio (evidence: `README.md`)
- Experiment user → MCD scoring: scores audio (evidence: `README.md`)
- Experiment user → TRM G2P-CER: scores outputs (evidence: `README.md`)
- Experiment user → Table aggregation: recomputes tables (evidence: `README.md`)
- Experiment user → Listening results: reviews judgments (evidence: `README.md`)
- Listening results → Human aggregation: aggregates counts
