# sashreekkumar/adaptive-noise-cancellation architecture

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

- Interactive diagram: https://gitdiagram.com/sashreekkumar/adaptive-noise-cancellation
- Repository: https://github.com/sashreekkumar/adaptive-noise-cancellation

## Overview

This monorepo’s two active products are a reproducible paired clean/noisy speech dataset generator and an audio-cleaning application. The primary cleaning workflow accepts an audio file through the CLI or web UI, loads and preprocesses it, enhances it with DeepFilterNet3 (optionally using the dual-expert fusion and residual NLMS path), then postprocesses and exports cleaned audio. Dataset generation is a separate capability with selection, synthesis, metadata, recovery, summaries, and reconstruction. Edges into unsampled dataset internals are omitted or marked unverified; the older model and dataset versions are excluded.

Main entry points: [`model_v2_nlms/audio_cleaner/pipeline.py`](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/pipeline.py) (Cleaning pipeline), [`dataset_v2/noisygen/runner.py`](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/runner.py) (Generation runner), [`model_v2_nlms/sih_model/pipeline.py`](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/sih_model/pipeline.py) (Expert pipeline), [`dataset_v2/noisygen/cli.py`](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/cli.py) (Noisygen CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cleaner["Audio cleaning"]
  node_cli["CLI<br/>[cli.py]"]
  node_web["Web UI<br/>[server.py]"]
  node_pipeline["Cleaning pipeline<br/>[pipeline.py]"]
  node_loader["Audio loader<br/>[loader.py]"]
  node_preprocess["Preprocessing<br/>[preprocessing.py]"]
  node_postprocess["Postprocessing<br/>[postprocessing.py]"]
  node_exporter["MP3 export<br/>[exporter.py]"]
end

subgraph group_enhancement["Enhancement core"]
  node_model["Model loader<br/>[model.py]"]
  node_experts["Expert enhancement"]
  node_model_pipeline["Expert pipeline<br/>[pipeline.py]"]
  node_expert_bank["Expert bank<br/>[experts.py]"]
  node_fusion["Fusion gate<br/>[fusion_gate.py]"]
  node_canceller["Residual NLMS"]
end

subgraph group_dataset["Dataset generation"]
  node_dataset_cli["Noisygen CLI<br/>[cli.py]"]
  node_runner["Generation runner<br/>[runner.py]"]
  node_sources["Source discovery<br/>[sources.py]"]
  node_selection["Sample selection<br/>[selection.py]"]
  node_sample["Sample synthesis<br/>[sample.py]"]
  node_audio["Audio processing<br/>[audio.py]"]
  node_worker["Sample worker<br/>[worker.py]"]
end

subgraph group_dataset_state["Dataset state"]
  node_storage[("Metadata storage<br/>[storage.py]")]
  node_summary["Dataset summary<br/>[summary.py]"]
  node_reconstruct["Reconstruction<br/>[reconstruct.py]"]
end

node_operator(("User"))
node_dataset_user(("Dataset user"))

node_operator -->|"runs"| node_cli
node_operator -->|"uploads audio"| node_web
node_cli -->|"invokes"| node_pipeline
node_web -->|"processes upload"| node_pipeline
node_pipeline -->|"loads audio"| node_loader
node_pipeline -->|"preprocesses"| node_preprocess
node_pipeline -->|"loads model"| node_model
node_pipeline -->|"enhances optionally"| node_experts
node_pipeline -->|"postprocesses"| node_postprocess
node_pipeline -->|"exports audio"| node_exporter
node_experts -.->|"dispatches"| node_model_pipeline
node_model_pipeline -->|"runs experts"| node_expert_bank
node_model_pipeline -->|"fuses outputs"| node_fusion
node_model_pipeline -.->|"cancels residual"| node_canceller
node_dataset_user -->|"runs"| node_dataset_cli
node_dataset_cli -.->|"starts generation"| node_runner
node_runner -.->|"discovers inputs"| node_sources
node_runner -.->|"selects samples"| node_selection
node_runner -.->|"dispatches work"| node_worker
node_worker -->|"builds sample"| node_sample
node_sample -->|"mixes audio"| node_audio
node_runner -.->|"commits metadata"| node_storage
node_dataset_cli -.->|"summarizes"| node_summary
node_dataset_cli -.->|"reconstructs sample"| node_reconstruct

click node_cli "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/cli.py"
click node_web "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/server.py"
click node_pipeline "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/pipeline.py"
click node_loader "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/loader.py"
click node_preprocess "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/preprocessing.py"
click node_postprocess "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/postprocessing.py"
click node_exporter "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/exporter.py"
click node_model "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/model.py"
click node_experts "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/expert_enhancement.py"
click node_model_pipeline "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/sih_model/pipeline.py"
click node_expert_bank "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2/sih_model/experts.py"
click node_fusion "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2/sih_model/fusion_gate.py"
click node_canceller "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/sih_model/residual_canceller.py"
click node_dataset_cli "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/cli.py"
click node_runner "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/runner.py"
click node_sources "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/sources.py"
click node_selection "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/selection.py"
click node_sample "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/sample.py"
click node_audio "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/audio.py"
click node_worker "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/worker.py"
click node_storage "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/storage.py"
click node_summary "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/summary.py"
click node_reconstruct "https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/reconstruct.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_pipeline,node_loader,node_preprocess,node_postprocess,node_exporter,node_operator,node_dataset_user toneBlue
class node_model,node_experts,node_model_pipeline,node_expert_bank,node_fusion,node_canceller toneAmber
class node_dataset_cli,node_runner,node_sources,node_selection,node_sample,node_audio,node_worker toneMint
class node_storage,node_summary,node_reconstruct toneRose
```

## Components

### Audio cleaning

- [CLI](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/cli.py): `model_v2_nlms/audio_cleaner/cli.py`
- [Web UI](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/server.py): `model_v2_nlms/audio_cleaner/server.py`
- [Cleaning pipeline](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/pipeline.py): `model_v2_nlms/audio_cleaner/pipeline.py`
- [Audio loader](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/loader.py): `model_v2_nlms/audio_cleaner/loader.py`
- [Preprocessing](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/preprocessing.py): `model_v2_nlms/audio_cleaner/preprocessing.py`
- [Postprocessing](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/postprocessing.py): `model_v2_nlms/audio_cleaner/postprocessing.py`
- [MP3 export](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/exporter.py): `model_v2_nlms/audio_cleaner/exporter.py`

### Enhancement core

- [Model loader](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/model.py): `model_v2_nlms/audio_cleaner/model.py`
- [Expert enhancement](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/audio_cleaner/expert_enhancement.py): `model_v2_nlms/audio_cleaner/expert_enhancement.py`
- [Expert pipeline](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/sih_model/pipeline.py): `model_v2_nlms/sih_model/pipeline.py`
- [Expert bank](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2/sih_model/experts.py): `model_v2/sih_model/experts.py`
- [Fusion gate](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2/sih_model/fusion_gate.py): `model_v2/sih_model/fusion_gate.py`
- [Residual NLMS](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/model_v2_nlms/sih_model/residual_canceller.py): `model_v2_nlms/sih_model/residual_canceller.py`

### Dataset generation

- [Noisygen CLI](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/cli.py): `dataset_v2/noisygen/cli.py`
- [Generation runner](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/runner.py): `dataset_v2/noisygen/runner.py`
- [Source discovery](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/sources.py): `dataset_v2/noisygen/sources.py`
- [Sample selection](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/selection.py): `dataset_v2/noisygen/selection.py`
- [Sample synthesis](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/sample.py): `dataset_v2/noisygen/sample.py`
- [Audio processing](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/audio.py): `dataset_v2/noisygen/audio.py`
- [Sample worker](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/worker.py): `dataset_v2/noisygen/worker.py`

### Dataset state

- [Metadata storage](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/storage.py): `dataset_v2/noisygen/storage.py`
- [Dataset summary](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/summary.py): `dataset_v2/noisygen/summary.py`
- [Reconstruction](https://github.com/sashreekkumar/adaptive-noise-cancellation/blob/main/dataset_v2/noisygen/reconstruct.py): `dataset_v2/noisygen/reconstruct.py`

### Other components

- **User**
- **Dataset user**

## Connections

- User → CLI: runs (evidence: `README.md`)
- User → Web UI: uploads audio (evidence: `README.md`)
- CLI → Cleaning pipeline: invokes (evidence: `model_v2_nlms/audio_cleaner/cli.py`)
- Web UI → Cleaning pipeline: processes upload (evidence: `model_v2_nlms/audio_cleaner/server.py`)
- Cleaning pipeline → Audio loader: loads audio (evidence: `model_v2_nlms/audio_cleaner/pipeline.py`)
- Cleaning pipeline → Preprocessing: preprocesses (evidence: `model_v2_nlms/audio_cleaner/pipeline.py`)
- Cleaning pipeline → Model loader: loads model (evidence: `model_v2_nlms/audio_cleaner/pipeline.py`)
- Cleaning pipeline → Expert enhancement: enhances optionally (evidence: `model_v2_nlms/audio_cleaner/pipeline.py`)
- Cleaning pipeline → Postprocessing: postprocesses (evidence: `model_v2_nlms/audio_cleaner/pipeline.py`)
- Cleaning pipeline → MP3 export: exports audio (evidence: `model_v2_nlms/audio_cleaner/pipeline.py`)
- Expert enhancement → Expert pipeline: dispatches
- Expert pipeline → Expert bank: runs experts (evidence: `model_v2_nlms/sih_model/pipeline.py`)
- Expert pipeline → Fusion gate: fuses outputs (evidence: `model_v2_nlms/sih_model/pipeline.py`)
- Expert pipeline → Residual NLMS: cancels residual
- Dataset user → Noisygen CLI: runs (evidence: `README.md`)
- Noisygen CLI → Generation runner: starts generation
- Generation runner → Source discovery: discovers inputs
- Generation runner → Sample selection: selects samples
- Generation runner → Sample worker: dispatches work
- Sample worker → Sample synthesis: builds sample (evidence: `dataset_v2/noisygen/worker.py`)
- Sample synthesis → Audio processing: mixes audio (evidence: `dataset_v2/noisygen/sample.py`)
- Generation runner → Metadata storage: commits metadata
- Noisygen CLI → Dataset summary: summarizes
- Noisygen CLI → Reconstruction: reconstructs sample
