# zengs7991-a11y/text-to-speech-app architecture

> Architecture diagram of the GitHub repository zengs7991-a11y/text-to-speech-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zengs7991-a11y/text-to-speech-app
- Repository: https://github.com/zengs7991-a11y/text-to-speech-app

## Overview

This repository is a Chinese-English text-to-speech and pinyin tool, with a browser interface and command-line workflows. The main web flow accepts text or a Word document, exposes voice and speech controls, and returns generated audio through Edge TTS. Pinyin display, correction, and export, plus batch conversion, are documented product capabilities; their implementation is not present in the sampled source. The graph distinguishes the local Flask app from the Vercel API variant. Relationships for unsampled interfaces and CLI features rely on README descriptions, not inspected implementation.

Main entry points: [`web-app/server.py`](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py) (Local web server), [`web-app/index.html`](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/index.html) (Web interface), [`scripts`](https://github.com/zengs7991-a11y/text-to-speech-app/tree/main/scripts) (Pinyin generation), [`api/index.py`](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/api/index.py) (Vercel API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webui["Web interface<br/>[index.html]"]
  node_webserver["Local web server<br/>[server.py]"]
  node_word["Word import<br/>[server.py]"]
  node_vercel["Vercel API<br/>[index.py]"]
  node_vercelui["Vercel page<br/>[index.html]"]
end

subgraph group_speech["Speech generation"]
  node_audio["Speech API<br/>[server.py]"]
  node_preprocess["Text enhancement<br/>[server.py]"]
  node_voices["Voice catalogue<br/>[server.py]"]
  node_edge["Edge TTS"]
  node_mp3["MP3 response<br/>[server.py]"]
end

subgraph group_pinyin["Pinyin tools"]
  node_pinyin["Pinyin generation"]
  node_formats["Pinyin formats"]
  node_correction["Polyphone correction<br/>[index.html]"]
  node_export["Pinyin export<br/>[index.html]"]
end

subgraph group_cli["Command line"]
  node_cli["CLI conversion<br/>[text-to-speech.sh]"]
  node_batch["Batch conversion<br/>[batch-convert.sh]"]
end

node_user(("User"))

node_user -->|"uses"| node_webui
node_webserver -->|"serves"| node_webui
node_webui -.->|"requests"| node_webserver
node_webserver -->|"routes upload"| node_word
node_webserver -->|"routes synthesis"| node_audio
node_webserver -->|"routes listing"| node_voices
node_audio -->|"enhances text"| node_preprocess
node_audio -->|"generates speech"| node_edge
node_audio -->|"returns audio"| node_mp3
node_user -.->|"enters text"| node_pinyin
node_pinyin -.->|"shows in"| node_formats
node_webui -.->|"offers editing"| node_correction
node_webui -.->|"offers export"| node_export
node_user -->|"runs conversion"| node_cli
node_user -->|"runs batches"| node_batch
node_vercel -->|"serves"| node_vercelui

click node_webui "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/index.html"
click node_webserver "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py"
click node_word "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py"
click node_audio "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py"
click node_preprocess "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py"
click node_voices "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py"
click node_mp3 "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py"
click node_pinyin "https://github.com/zengs7991-a11y/text-to-speech-app/tree/main/scripts"
click node_formats "https://github.com/zengs7991-a11y/text-to-speech-app/tree/main/scripts"
click node_correction "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/index.html"
click node_export "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/index.html"
click node_cli "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/scripts/text-to-speech.sh"
click node_batch "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/scripts/batch-convert.sh"
click node_vercel "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/api/index.py"
click node_vercelui "https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/api/index.html"

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_webui,node_webserver,node_word,node_vercel,node_vercelui,node_user toneBlue
class node_audio,node_preprocess,node_voices,node_edge,node_mp3 toneAmber
class node_pinyin,node_formats,node_correction,node_export toneMint
class node_cli,node_batch toneRose
```

## Components

### Web experience

- [Web interface](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/index.html): `web-app/index.html`
- [Local web server](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py): `web-app/server.py`
- [Word import](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py): `web-app/server.py`
- [Vercel API](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/api/index.py): `api/index.py`
- [Vercel page](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/api/index.html): `api/index.html`

### Speech generation

- [Speech API](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py): `web-app/server.py`
- [Text enhancement](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py): `web-app/server.py`
- [Voice catalogue](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py): `web-app/server.py`
- **Edge TTS**
- [MP3 response](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/server.py): `web-app/server.py`

### Pinyin tools

- [Pinyin generation](https://github.com/zengs7991-a11y/text-to-speech-app/tree/main/scripts): `scripts`
- [Pinyin formats](https://github.com/zengs7991-a11y/text-to-speech-app/tree/main/scripts): `scripts`
- [Polyphone correction](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/index.html): `web-app/index.html`
- [Pinyin export](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/web-app/index.html): `web-app/index.html`

### Command line

- [CLI conversion](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/scripts/text-to-speech.sh): `scripts/text-to-speech.sh`
- [Batch conversion](https://github.com/zengs7991-a11y/text-to-speech-app/blob/main/scripts/batch-convert.sh): `scripts/batch-convert.sh`

### Other components

- **User**

## Connections

- User → Web interface: uses (evidence: `README.md`)
- Local web server → Web interface: serves (evidence: `web-app/server.py`)
- Web interface → Local web server: requests
- Local web server → Word import: routes upload (evidence: `web-app/server.py`)
- Local web server → Speech API: routes synthesis (evidence: `web-app/server.py`)
- Local web server → Voice catalogue: routes listing (evidence: `web-app/server.py`)
- Speech API → Text enhancement: enhances text (evidence: `web-app/server.py`)
- Speech API → Edge TTS: generates speech (evidence: `web-app/server.py`)
- Speech API → MP3 response: returns audio (evidence: `web-app/server.py`)
- User → Pinyin generation: enters text (evidence: `README.md`)
- Pinyin generation → Pinyin formats: shows in (evidence: `README.md`)
- Web interface → Polyphone correction: offers editing (evidence: `README.md`)
- Web interface → Pinyin export: offers export (evidence: `README.md`)
- User → CLI conversion: runs conversion (evidence: `README.md`)
- User → Batch conversion: runs batches (evidence: `README.md`)
- Vercel API → Vercel page: serves (evidence: `api/index.py`)
