# aigc-audio/audiogpt architecture

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

- Interactive diagram: https://gitdiagram.com/aigc-audio/audiogpt
- Repository: https://github.com/aigc-audio/audiogpt

## Overview

1. **Repository shape**
   This is a multi-project audio AI monorepo, not a single application. Each top-level folder implements a distinct task family, while the main repo ties them together under the AudioGPT umbrella. The architecture is mostly “shared research framework + task-specific subprojects.”

2. **Top-level orchestration**
   `audio-chatgpt.py` is the visible entry point for the umbrella experience. The repo README positions AudioGPT as a system that can route user requests across speech, audio, music, singing, separation, enhancement, detection, and talking-head-related capabilities, but the code tree shows those capabilities are implemented as separate modules rather than one unified runtime.

3. **NeuralSeq: core speech/singing framework**
   `NeuralSeq` is the largest reusable subsystem and is organized like a training/inference framework for TTS and singing voice synthesis. It contains:
   - `configs/` for model and dataset YAMLs
   - `data_gen/` for preprocessing, text normalization, binarization, and alignment
   - `egs/` for dataset-specific experiment recipes
   - `modules/` for model implementations
   - `tasks/` for training loops and task logic
   - `inference/` for model-specific inference entrypoints
   - `vocoders/` and `modules/hifigan`, `modules/parallel_wavegan` for waveform generation

4. **NeuralSeq data pipeline boundary**
   The speech pipeline is clearly staged:
   raw audio/text enters `data_gen/tts` and `egs/datasets/audio/*` preprocessors, passes through text processors and wav processors, then becomes indexed/binarized training data. The binarizer/pre-align scripts indicate the repo depends heavily on offline feature extraction and alignment before training.

5. **NeuralSeq model boundary**
   `NeuralSeq/modules` holds the actual neural architectures, while `NeuralSeq/tasks` wraps them for training. Important model families include:
   - `fastspeech/` and `tasks/tts/fs2*` for FastSpeech-style TTS
   - `modules/GenerSpeech` and `tasks/tts/ps*` for style/prosody-driven speech generation
   - `modules/diff` and `tasks/svs/diffsinger_task.py` for diffusion-based generation
   - `modules/syntaspeech` and `tasks/tts/synta.py` for syntactic/prosody-aware TTS
   This separation means model code is not the same layer as training orchestration.

6. **NeuralSeq output generation**
   Vocoding is a distinct boundary from acoustic modeling. `vocoders/`, `modules/hifigan`, and `modules/parallel_wavegan` convert predicted acoustic features such as mel spectrograms into waveform audio. The repo supports both HiFi-GAN and Parallel WaveGAN variants, so acoustic model output is typically not final audio until it passes through a vocoder.

7. **Text-to-audio / Make-An-Audio stack**
   `text_to_audio/Make_An_Audio` is a self-contained diffusion-based generation system. Its architecture is split into:
   - `ldm/` for latent diffusion models, denoising, and conditioning
   - `ldm/modules/encoders/CLAP` and `open_clap` for audio/text conditioning embeddings
   - `vocoder/` for waveform synthesis
   - `wav_evaluation/` for evaluation models and scoring
   This subsystem is centered on generative conditioning rather than sequence-to-sequence speech synthesis.

8. **Audio classification and detection**
   `audio_detection` contains two related detection stacks:
   - `audio_infer/pytorch/` for training, inference, evaluation, and dataset utilities around sound classification
   - `target_sound_detection/src/` for target sound localization/detection
   The inclusion of metadata, blacklists, and evaluation scripts suggests this subsystem is optimized around dataset-driven supervised detection workflows.

9. **Audio captioning / audio-to-text**
   `audio_to_text/captioning` is a separate encoder-decoder Transformer stack for generating text from audio. It has:
   - model definitions in `models/`
   - vocabulary and embedding tooling in `utils/`
   - word/sentence embedding generation via BERT, FastText, and word2vec helpers
   This subsystem is more NLP-oriented than the speech synthesis stacks and uses its own training utilities.

10. **Spatial audio and source separation**
   `mono2binaural` and `sound_extraction` address transformation and separation tasks:
   - `mono2binaural/src/` implements warping and model logic for spatial audio conversion
   - `sound_extraction/model/` includes LASSNet, ResUNet, and FiLM-based components
   - `sound_extraction/utils/` handles STFT, mixtures, and WAV I/O
   These projects are independent pipelines around audio transformation and extraction rather than generative speech.

11. **Shared utilities and conventions**
   Across the repo, the recurring pattern is: YAML config → dataset preprocessing → task wrapper → model module → inference wrapper → audio output. Shared helpers live in places like `NeuralSeq/utils`, while each subproject also carries its own local utilities. This makes the repo modular but loosely coupled: each task family can usually be trained and inferred independently, with only high-level consistency shared across them.

12. **Practical architecture boundary for diagramming**
   For an architecture diagram, draw the repo as a hub-and-spoke system:
   - a top-level AudioGPT layer
   - separate task-specific subsystems for speech synthesis, singing, text-to-audio, detection, captioning, separation, and binauralization
   - within each subsystem, a repeated internal split between data preparation, model code, training/task logic, inference, and output/audio rendering
   The strongest boundaries are between task families, and the strongest internal dependency is from preprocessing into model training and then into vocoder or evaluator components.

Main entry points: [`audio-chatgpt.py`](https://github.com/aigc-audio/audiogpt/blob/main/audio-chatgpt.py) (AudioGPT entry), [`NeuralSeq/tasks`](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/tasks) (Task logic), [`NeuralSeq/modules`](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/modules) (Model modules), [`text_to_audio/Make_An_Audio/ldm`](https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/ldm) (LDM core)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_umbrella["AudioGPT"]
  node_audio_chatgpt["AudioGPT entry<br/>entrypoint<br/>[audio-chatgpt.py]"]
end

subgraph group_neuralseq["NeuralSeq"]
  node_neuralseq_entry["NeuralSeq core<br/>framework hub"]
  node_neuralseq_configs["Configs<br/>yaml config"]
  node_neuralseq_data["Data prep<br/>offline pipeline"]
  node_neuralseq_tasks["Task logic<br/>training orchestration"]
  node_neuralseq_models["Model modules<br/>architectures"]
  node_neuralseq_infer["Inference"]
  node_neuralseq_vocoder["Vocoder<br/>waveform synthesis"]
end

subgraph group_generative_audio["Generative audio"]
  node_make_audio["Make-An-Audio<br/>diffusion system"]
  node_ldm["LDM core<br/>latent diffusion"]
  node_clap_encoders["CLAP encoders<br/>conditioning encoders"]
  node_make_audio_vocoder["Audio vocoder<br/>waveform synthesis"]
  node_wav_eval["Wave eval<br/>evaluation"]
end

subgraph group_analysis["Audio understanding"]
  node_audio_detection["Detection stack<br/>supervised detection"]
  node_captioning["Audio captioning<br/>audio-to-text"]
  node_mono2binaural["Mono to binaural<br/>spatial audio"]
  node_sound_extraction["Sound extraction<br/>separation"]
end

node_audio_chatgpt -->|"routes to"| node_neuralseq_entry
node_audio_chatgpt -->|"routes to"| node_make_audio
node_audio_chatgpt -->|"routes to"| node_audio_detection
node_audio_chatgpt -->|"routes to"| node_captioning
node_audio_chatgpt -->|"routes to"| node_mono2binaural
node_audio_chatgpt -->|"routes to"| node_sound_extraction
node_neuralseq_entry -->|"organized by"| node_neuralseq_configs
node_neuralseq_configs -->|"drives"| node_neuralseq_data
node_neuralseq_data -->|"feeds"| node_neuralseq_tasks
node_neuralseq_tasks -->|"trains"| node_neuralseq_models
node_neuralseq_models -->|"served by"| node_neuralseq_infer
node_neuralseq_models -->|"requires"| node_neuralseq_vocoder
node_neuralseq_tasks -.->|"supports"| node_neuralseq_vocoder
node_make_audio -->|"contains"| node_ldm
node_ldm -->|"conditions on"| node_clap_encoders
node_ldm -->|"renders via"| node_make_audio_vocoder
node_make_audio_vocoder -.->|"validated by"| node_wav_eval
node_audio_detection -.->|"shares audio IO"| node_captioning
node_mono2binaural -.->|"adjacent pipeline"| node_sound_extraction
node_neuralseq_vocoder -.->|"surfaces output to"| node_audio_chatgpt
node_make_audio_vocoder -.->|"surfaces output to"| node_audio_chatgpt

click node_audio_chatgpt "https://github.com/aigc-audio/audiogpt/blob/main/audio-chatgpt.py"
click node_neuralseq_entry "https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq"
click node_neuralseq_configs "https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/configs"
click node_neuralseq_data "https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/data_gen"
click node_neuralseq_tasks "https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/tasks"
click node_neuralseq_models "https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/modules"
click node_neuralseq_infer "https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/inference"
click node_neuralseq_vocoder "https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/vocoders"
click node_make_audio "https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio"
click node_ldm "https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/ldm"
click node_clap_encoders "https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/ldm/modules/encoders"
click node_make_audio_vocoder "https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/vocoder"
click node_wav_eval "https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/wav_evaluation"
click node_audio_detection "https://github.com/aigc-audio/audiogpt/tree/main/audio_detection"
click node_captioning "https://github.com/aigc-audio/audiogpt/tree/main/audio_to_text/captioning"
click node_mono2binaural "https://github.com/aigc-audio/audiogpt/tree/main/mono2binaural/src"
click node_sound_extraction "https://github.com/aigc-audio/audiogpt/tree/main/sound_extraction"

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_audio_chatgpt toneBlue
class node_neuralseq_entry,node_neuralseq_configs,node_neuralseq_data,node_neuralseq_tasks,node_neuralseq_models,node_neuralseq_infer,node_neuralseq_vocoder toneAmber
class node_make_audio,node_ldm,node_clap_encoders,node_make_audio_vocoder,node_wav_eval toneMint
class node_audio_detection,node_captioning,node_mono2binaural,node_sound_extraction toneRose
```

## Components

### AudioGPT

Top-level orchestration and multi-task entrypoint.

- [AudioGPT entry](https://github.com/aigc-audio/audiogpt/blob/main/audio-chatgpt.py): entrypoint · Umbrella script for the multi-task AudioGPT experience. · `audio-chatgpt.py`

### NeuralSeq

Reusable speech and singing synthesis framework.

- [NeuralSeq core](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq): framework hub · Shared research framework for TTS and singing voice synthesis. · `NeuralSeq`
- [Configs](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/configs): yaml config · Model, dataset, and experiment configuration layer. · `NeuralSeq/configs`
- [Data prep](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/data_gen): offline pipeline · Text normalization, preprocessing, alignment, and binarization. · `NeuralSeq/data_gen`
- [Task logic](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/tasks): training orchestration · Training loops and task wrappers for TTS and SVS. · `NeuralSeq/tasks`
- [Model modules](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/modules): architectures · Core acoustic, diffusion, and syntactic model implementations. · `NeuralSeq/modules`
- [Inference](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/inference): inference wrappers · Speech and singing inference entrypoints. · `NeuralSeq/inference`
- [Vocoder](https://github.com/aigc-audio/audiogpt/tree/main/NeuralSeq/vocoders): waveform synthesis · HiFi-GAN and Parallel WaveGAN waveform rendering layer. · `NeuralSeq/vocoders`

### Generative audio

Text-to-audio diffusion and waveform rendering stack.

- [Make-An-Audio](https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio): diffusion system · Self-contained text-to-audio and related generative audio subsystem. · `text_to_audio/Make_An_Audio`
- [LDM core](https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/ldm): latent diffusion · Latent diffusion models, denoising, and conditioning flow. · `text_to_audio/Make_An_Audio/ldm`
- [CLAP encoders](https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/ldm/modules/encoders): conditioning encoders · Audio/text embedding encoders used for diffusion conditioning. · `text_to_audio/Make_An_Audio/ldm/modules/encoders`
- [Audio vocoder](https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/vocoder): waveform synthesis · BigVGAN and HiFi-GAN waveform synthesis for generated audio. · `text_to_audio/Make_An_Audio/vocoder`
- [Wave eval](https://github.com/aigc-audio/audiogpt/tree/main/text_to_audio/Make_An_Audio/wav_evaluation): evaluation · Waveform evaluation models and scoring utilities. · `text_to_audio/Make_An_Audio/wav_evaluation`

### Audio understanding

Detection, captioning, spatial conversion, and separation subsystems.

- [Detection stack](https://github.com/aigc-audio/audiogpt/tree/main/audio_detection): supervised detection · Sound classification and target sound detection workflows. · `audio_detection`
- [Audio captioning](https://github.com/aigc-audio/audiogpt/tree/main/audio_to_text/captioning): audio-to-text · Transformer-based audio captioning and text generation stack. · `audio_to_text/captioning`
- [Mono to binaural](https://github.com/aigc-audio/audiogpt/tree/main/mono2binaural/src): spatial audio · Spatial conversion and warping pipeline for binaural output. · `mono2binaural/src`
- [Sound extraction](https://github.com/aigc-audio/audiogpt/tree/main/sound_extraction): separation · Source separation and audio extraction models and utilities. · `sound_extraction`

## Connections

- AudioGPT entry → NeuralSeq core: routes to · Umbrella experience delegates to speech and singing capabilities.
- AudioGPT entry → Make-An-Audio: routes to · Umbrella experience delegates to generative audio capabilities.
- AudioGPT entry → Detection stack: routes to · Umbrella experience delegates to detection capabilities.
- AudioGPT entry → Audio captioning: routes to · Umbrella experience delegates to audio-to-text capabilities.
- AudioGPT entry → Mono to binaural: routes to · Umbrella experience delegates to spatial audio conversion.
- AudioGPT entry → Sound extraction: routes to · Umbrella experience delegates to separation workflows.
- NeuralSeq core → Configs: organized by · Framework is driven by YAML configuration.
- Configs → Data prep: drives · Configs define preprocessing and dataset preparation behavior.
- Data prep → Task logic: feeds · Prepared datasets are consumed by task wrappers.
- Task logic → Model modules: trains · Task layer orchestrates model optimization and losses.
- Model modules → Inference: served by · Trained models are exposed through inference entrypoints.
- Model modules → Vocoder: requires · Acoustic predictions are rendered to waveform audio.
- Task logic → Vocoder: supports · Vocoder tasks provide training and dataset wiring.
- Make-An-Audio → LDM core: contains · Main generative stack is centered on latent diffusion.
- LDM core → CLAP encoders: conditions on · Diffusion generation is guided by CLAP-style embeddings.
- LDM core → Audio vocoder: renders via · Generated representations are converted to waveform audio.
- Audio vocoder → Wave eval: validated by · Generated audio is scored and evaluated by waveform models.
- Detection stack → Audio captioning: shares audio IO · Both subsystems consume dataset-driven audio representations.
- Mono to binaural → Sound extraction: adjacent pipeline · Both are audio transformation and extraction-oriented subsystems.
- Vocoder → AudioGPT entry: surfaces output to · Speech synthesis output is surfaced through the umbrella experience.
- Audio vocoder → AudioGPT entry: surfaces output to · Generative audio output is surfaced through the umbrella experience.
