# resemble-ai/resemble-enhance architecture

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

- Interactive diagram: https://gitdiagram.com/resemble-ai/resemble-enhance
- Repository: https://github.com/resemble-ai/resemble-enhance

## Overview

Resemble Enhance is a speech-improvement application: users provide audio and receive denoised or perceptually enhanced audio. The documented workflow offers a denoise-only option or enhancement, which includes denoising; the web demo is another entry point. Training is a separate capability: prepare foreground/background/RIR data, train the denoiser, then train the enhancer’s autoencoder/vocoder and latent CFM stages. The graph preserves those stages and key model and runtime layers. Some CLI, training, and data wiring is unsampled; those relationships are included only where the README or source index supports them.

Main entry points: [`resemble_enhance/enhancer/enhancer.py`](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/enhancer.py) (Enhancer Model), [`resemble_enhance/enhancer/inference.py`](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/inference.py) (Enhance API), [`resemble_enhance/enhancer/train.py`](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/train.py) (Enhancer Training), [`resemble_enhance/denoiser/train.py`](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/train.py) (Denoiser Training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_cli["CLI Workflow<br/>[__main__.py]"]
  node_web["Web Demo<br/>[app.py]"]
end

subgraph group_inference["Audio Inference"]
  node_enhance_api["Enhance API<br/>[inference.py]"]
  node_denoise_api["Denoise API<br/>[inference.py]"]
  node_audio_inference["Chunked Inference<br/>[inference.py]"]
  node_download["Model Download<br/>[download.py]"]
end

subgraph group_training["Data and Training"]
  node_dataset["Audio Dataset<br/>[dataset.py]"]
  node_distortion["Audio Distortion<br/>[base.py]"]
  node_denoise_train["Denoiser Training<br/>[train.py]"]
  node_enhance_train["Enhancer Training<br/>[train.py]"]
  node_train_loop["Training Loop<br/>[train_loop.py]"]
end

subgraph group_runtime["Models and Runtime"]
  node_params["Audio Parameters<br/>[hparams.py]"]
  node_mel["Mel Features<br/>[melspec.py]"]
  node_denoiser["Denoiser Model<br/>[denoiser.py]"]
  node_unet["UNet<br/>[unet.py]"]
  node_enhancer["Enhancer Model<br/>[enhancer.py]"]
  node_irmae["IRMAE Autoencoder<br/>[irmae.py]"]
  node_cfm["Flow Matching<br/>[cfm.py]"]
  node_lcfm["Latent CFM<br/>[lcfm.py]"]
  node_vocoder["UnivNet Vocoder<br/>[univnet.py]"]
  node_discriminator["Audio Discriminator<br/>[discriminator.py]"]
  node_engine["Distributed Engine<br/>[engine.py]"]
  node_distributed["Distributed Runtime<br/>[distributed.py]"]
  node_logging["Logging<br/>[logging.py]"]
end

node_user(("Audio User"))

node_user -->|"provides audio"| node_cli
node_user -->|"provides audio"| node_web
node_cli -.->|"runs enhancement"| node_enhance_api
node_web -->|"invokes"| node_enhance_api
node_enhance_api -->|"loads model"| node_download
node_enhance_api -->|"runs inference"| node_audio_inference
node_denoise_api -->|"runs inference"| node_audio_inference
node_audio_inference -->|"reads settings"| node_params
node_enhance_api -->|"loads model class"| node_enhancer
node_denoise_api -->|"loads model class"| node_denoise_train
node_denoise_train -->|"uses data"| node_dataset
node_enhance_train -->|"uses data"| node_dataset
node_dataset -->|"uses distorters"| node_distortion
node_denoise_train -->|"trains"| node_denoiser
node_enhance_train -->|"trains"| node_enhancer
node_denoise_train -->|"uses loop"| node_train_loop
node_enhance_train -->|"uses loop"| node_train_loop
node_denoiser -->|"extracts features"| node_mel
node_denoiser -->|"predicts with"| node_unet
node_enhancer -->|"denoises input"| node_denoise_api
node_enhancer -->|"extracts features"| node_mel
node_enhancer -->|"generates latent"| node_lcfm
node_enhancer -->|"reconstructs audio"| node_vocoder
node_lcfm -->|"uses autoencoder"| node_irmae
node_lcfm -->|"uses flow model"| node_cfm
node_enhance_train -->|"configures discriminator"| node_discriminator
node_train_loop -->|"uses engine"| node_engine
node_engine -->|"initializes distributed"| node_distributed
node_logging -->|"guards logging"| node_distributed

click node_cli "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/__main__.py"
click node_web "https://github.com/resemble-ai/resemble-enhance/blob/main/app.py"
click node_enhance_api "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/inference.py"
click node_denoise_api "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/inference.py"
click node_audio_inference "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/inference.py"
click node_download "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/download.py"
click node_dataset "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/data/dataset.py"
click node_distortion "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/data/distorter/base.py"
click node_denoise_train "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/train.py"
click node_enhance_train "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/train.py"
click node_train_loop "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/train_loop.py"
click node_params "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/hparams.py"
click node_mel "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/melspec.py"
click node_denoiser "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/denoiser.py"
click node_unet "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/unet.py"
click node_enhancer "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/enhancer.py"
click node_irmae "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/lcfm/irmae.py"
click node_cfm "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/lcfm/cfm.py"
click node_lcfm "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/lcfm/lcfm.py"
click node_vocoder "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/univnet/univnet.py"
click node_discriminator "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/univnet/discriminator.py"
click node_engine "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/engine.py"
click node_distributed "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/distributed.py"
click node_logging "https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/logging.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_cli,node_web,node_user toneBlue
class node_enhance_api,node_denoise_api,node_audio_inference,node_download toneAmber
class node_dataset,node_distortion,node_denoise_train,node_enhance_train,node_train_loop toneMint
class node_params,node_mel,node_denoiser,node_unet,node_enhancer,node_irmae,node_cfm,node_lcfm,node_vocoder,node_discriminator,node_engine,node_distributed,node_logging toneRose
```

## Components

### User Interfaces

- [CLI Workflow](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/__main__.py): `resemble_enhance/enhancer/__main__.py`
- [Web Demo](https://github.com/resemble-ai/resemble-enhance/blob/main/app.py): `app.py`

### Audio Inference

- [Enhance API](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/inference.py): `resemble_enhance/enhancer/inference.py`
- [Denoise API](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/inference.py): `resemble_enhance/denoiser/inference.py`
- [Chunked Inference](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/inference.py): `resemble_enhance/inference.py`
- [Model Download](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/download.py): `resemble_enhance/enhancer/download.py`

### Data and Training

- [Audio Dataset](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/data/dataset.py): `resemble_enhance/data/dataset.py`
- [Audio Distortion](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/data/distorter/base.py): `resemble_enhance/data/distorter/base.py`
- [Denoiser Training](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/train.py): `resemble_enhance/denoiser/train.py`
- [Enhancer Training](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/train.py): `resemble_enhance/enhancer/train.py`
- [Training Loop](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/train_loop.py): `resemble_enhance/utils/train_loop.py`

### Models and Runtime

- [Audio Parameters](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/hparams.py): `resemble_enhance/hparams.py`
- [Mel Features](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/melspec.py): `resemble_enhance/melspec.py`
- [Denoiser Model](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/denoiser.py): `resemble_enhance/denoiser/denoiser.py`
- [UNet](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/denoiser/unet.py): `resemble_enhance/denoiser/unet.py`
- [Enhancer Model](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/enhancer.py): `resemble_enhance/enhancer/enhancer.py`
- [IRMAE Autoencoder](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/lcfm/irmae.py): `resemble_enhance/enhancer/lcfm/irmae.py`
- [Flow Matching](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/lcfm/cfm.py): `resemble_enhance/enhancer/lcfm/cfm.py`
- [Latent CFM](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/lcfm/lcfm.py): `resemble_enhance/enhancer/lcfm/lcfm.py`
- [UnivNet Vocoder](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/univnet/univnet.py): `resemble_enhance/enhancer/univnet/univnet.py`
- [Audio Discriminator](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/enhancer/univnet/discriminator.py): `resemble_enhance/enhancer/univnet/discriminator.py`
- [Distributed Engine](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/engine.py): `resemble_enhance/utils/engine.py`
- [Distributed Runtime](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/distributed.py): `resemble_enhance/utils/distributed.py`
- [Logging](https://github.com/resemble-ai/resemble-enhance/blob/main/resemble_enhance/utils/logging.py): `resemble_enhance/utils/logging.py`

### Other components

- **Audio User**

## Connections

- Audio User → CLI Workflow: provides audio
- Audio User → Web Demo: provides audio
- CLI Workflow → Enhance API: runs enhancement
- Web Demo → Enhance API: invokes (evidence: `app.py`)
- Enhance API → Model Download: loads model (evidence: `resemble_enhance/enhancer/inference.py`)
- Enhance API → Chunked Inference: runs inference (evidence: `resemble_enhance/enhancer/inference.py`)
- Denoise API → Chunked Inference: runs inference (evidence: `resemble_enhance/denoiser/inference.py`)
- Chunked Inference → Audio Parameters: reads settings (evidence: `resemble_enhance/inference.py`)
- Enhance API → Enhancer Model: loads model class (evidence: `resemble_enhance/enhancer/inference.py`)
- Denoise API → Denoiser Training: loads model class (evidence: `resemble_enhance/denoiser/inference.py`)
- Denoiser Training → Audio Dataset: uses data (evidence: `resemble_enhance/denoiser/train.py`)
- Enhancer Training → Audio Dataset: uses data (evidence: `resemble_enhance/enhancer/train.py`)
- Audio Dataset → Audio Distortion: uses distorters (evidence: `resemble_enhance/data/dataset.py`)
- Denoiser Training → Denoiser Model: trains (evidence: `resemble_enhance/denoiser/train.py`)
- Enhancer Training → Enhancer Model: trains (evidence: `resemble_enhance/enhancer/train.py`)
- Denoiser Training → Training Loop: uses loop (evidence: `resemble_enhance/denoiser/train.py`)
- Enhancer Training → Training Loop: uses loop (evidence: `resemble_enhance/enhancer/train.py`)
- Denoiser Model → Mel Features: extracts features (evidence: `resemble_enhance/denoiser/denoiser.py`)
- Denoiser Model → UNet: predicts with (evidence: `resemble_enhance/denoiser/denoiser.py`)
- Enhancer Model → Denoise API: denoises input (evidence: `resemble_enhance/enhancer/enhancer.py`)
- Enhancer Model → Mel Features: extracts features (evidence: `resemble_enhance/enhancer/enhancer.py`)
- Enhancer Model → Latent CFM: generates latent (evidence: `resemble_enhance/enhancer/enhancer.py`)
- Enhancer Model → UnivNet Vocoder: reconstructs audio (evidence: `resemble_enhance/enhancer/enhancer.py`)
- Latent CFM → IRMAE Autoencoder: uses autoencoder (evidence: `resemble_enhance/enhancer/lcfm/lcfm.py`)
- Latent CFM → Flow Matching: uses flow model (evidence: `resemble_enhance/enhancer/lcfm/lcfm.py`)
- Enhancer Training → Audio Discriminator: configures discriminator (evidence: `resemble_enhance/enhancer/train.py`)
- Training Loop → Distributed Engine: uses engine (evidence: `resemble_enhance/utils/train_loop.py`)
- Distributed Engine → Distributed Runtime: initializes distributed (evidence: `resemble_enhance/utils/engine.py`)
- Logging → Distributed Runtime: guards logging (evidence: `resemble_enhance/utils/logging.py`)
