# shreyas-fr/anc_code architecture

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

- Interactive diagram: https://gitdiagram.com/shreyas-fr/anc_code
- Repository: https://github.com/shreyas-fr/anc_code

## Overview

This repository implements audio noise suppression, from preparing mixed training examples and learning enhancement models through offline evaluation and real-time edge streaming. A separate desktop dashboard receives audio and telemetry and presents pipeline status and diagnostics. The tree also contains a noise classifier and multiple deployment generations. No README was provided, so the graph follows the sampled model, training, inference, deployment and dashboard references; some deployment and receiver internals are unsampled, and their unverified connections are omitted.

Main entry points: [`Documents/anc sih/frontend/ui/main_window.py`](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/main_window.py) (Main window), [`src/enhance/train.py`](https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/train.py) (Model training), [`deploy/nlms_postfilter.py`](https://github.com/shreyas-fr/anc_code/blob/main/deploy/nlms_postfilter.py) (NLMS postfilter), [`src/enhance/complex_crn.py`](https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/complex_crn.py) (Complex CRN)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data_ml["Data and modeling"]
  node_clean_noise_data["Mixed audio data<br/>[dynamic_mixer.py]"]
  node_complex_model["Complex CRN<br/>[complex_crn.py]"]
  node_enhancement_loss["Enhancement losses<br/>[losses.py]"]
  node_training["Model training<br/>[train.py]"]
  node_noise_classifier["Noise classifier"]
  node_classifier_training["Classifier training"]
end

subgraph group_evaluation["Evaluation and inference"]
  node_metric_evaluation["Audio metrics<br/>[evaluate.py]"]
  node_offline_evaluation["Enhancement evaluation<br/>[evaluate.py]"]
  node_file_inference["File inference<br/>[inference.py]"]
  node_nlms_filter["NLMS postfilter<br/>[nlms_postfilter.py]"]
end

subgraph group_deployment["Edge streaming"]
  node_rpi_inference["Raspberry Pi inference<br/>[rpi_infer.py]"]
  node_anc_stream["Stateful ANC stream<br/>[anc_stream.py]"]
  node_runtime_monitor["Performance monitor<br/>[monitor.py]"]
  node_live_sender["Live audio sender"]
  node_stream_engine["DFN3 stream<br/>[dfn3_stream.py]"]
end

subgraph group_dashboard["Host dashboard"]
  node_dashboard_entry["Dashboard startup<br/>[main.py]"]
  node_main_window["Main window<br/>[main_window.py]"]
  node_audio_receiver["Audio receiver<br/>[audio_receiver.py]"]
  node_telemetry_receiver["Telemetry receiver"]
  node_jitter_buffer["Jitter buffer<br/>[jitter_buffer.py]"]
  node_audio_playback["Audio playback<br/>[playback.py]"]
  node_ui_components["UI components<br/>[components.py]"]
  node_diagnostics["Diagnostics panel"]
  node_pipeline_widget["Pipeline status<br/>[pipeline_widget.py]"]
  node_spectrum_widget["Spectrum display<br/>[spectrum_widget.py]"]
  node_waveform_widget["Waveform display<br/>[waveform_widget.py]"]
  node_ui_theme["UI theme<br/>[theme.py]"]
end

node_desktop_user(("Dashboard user"))

node_training -->|"loads examples"| node_clean_noise_data
node_training -->|"trains model"| node_complex_model
node_training -->|"scores loss"| node_enhancement_loss
node_training -->|"computes metrics"| node_metric_evaluation
node_classifier_training -->|"trains classifier"| node_noise_classifier
node_offline_evaluation -->|"loads examples"| node_clean_noise_data
node_offline_evaluation -->|"evaluates model"| node_complex_model
node_offline_evaluation -->|"computes metrics"| node_metric_evaluation
node_file_inference -->|"runs model"| node_complex_model
node_nlms_filter -->|"loads examples"| node_clean_noise_data
node_nlms_filter -->|"enhances audio"| node_complex_model
node_nlms_filter -->|"scores output"| node_metric_evaluation
node_rpi_inference -->|"uses filter"| node_nlms_filter
node_anc_stream -->|"records runtime"| node_runtime_monitor
node_live_sender -->|"uses stream"| node_stream_engine
node_desktop_user -->|"opens dashboard"| node_dashboard_entry
node_dashboard_entry -->|"creates window"| node_main_window
node_main_window -->|"uses receiver"| node_audio_receiver
node_main_window -->|"uses receiver"| node_telemetry_receiver
node_main_window -->|"uses buffer"| node_jitter_buffer
node_main_window -->|"uses playback"| node_audio_playback
node_main_window -->|"uses components"| node_ui_components
node_main_window -->|"uses panel"| node_diagnostics
node_main_window -->|"uses display"| node_spectrum_widget
node_main_window -->|"uses display"| node_waveform_widget
node_ui_components -->|"uses theme"| node_ui_theme
node_pipeline_widget -->|"uses theme"| node_ui_theme

click node_clean_noise_data "https://github.com/shreyas-fr/anc_code/blob/main/scripts/dynamic_mixer.py"
click node_complex_model "https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/complex_crn.py"
click node_enhancement_loss "https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/losses.py"
click node_training "https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/train.py"
click node_noise_classifier "https://github.com/shreyas-fr/anc_code/blob/main/src/classify/noise_classifier.py"
click node_classifier_training "https://github.com/shreyas-fr/anc_code/blob/main/src/classify/train_classifier.py"
click node_metric_evaluation "https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/evaluate.py"
click node_offline_evaluation "https://github.com/shreyas-fr/anc_code/blob/main/eval/evaluate.py"
click node_file_inference "https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/inference.py"
click node_nlms_filter "https://github.com/shreyas-fr/anc_code/blob/main/deploy/nlms_postfilter.py"
click node_rpi_inference "https://github.com/shreyas-fr/anc_code/blob/main/deploy/rpi_infer.py"
click node_anc_stream "https://github.com/shreyas-fr/anc_code/blob/main/runs/sih26052_rpi_deployment_audit/app/anc_stream.py"
click node_runtime_monitor "https://github.com/shreyas-fr/anc_code/blob/main/runs/sih26052_rpi_deployment_audit/app/monitor.py"
click node_live_sender "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/runs/final_model/dfn3_live_sender.py"
click node_stream_engine "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/runs/final_model/dfn3_stream.py"
click node_dashboard_entry "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/main.py"
click node_main_window "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/main_window.py"
click node_audio_receiver "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/network/audio_receiver.py"
click node_telemetry_receiver "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/network/telemetry_receiver.py"
click node_jitter_buffer "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/audio/jitter_buffer.py"
click node_audio_playback "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/audio/playback.py"
click node_ui_components "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/components.py"
click node_diagnostics "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/diagnostics_panel.py"
click node_pipeline_widget "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/pipeline_widget.py"
click node_spectrum_widget "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/spectrum_widget.py"
click node_waveform_widget "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/waveform_widget.py"
click node_ui_theme "https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/theme.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_clean_noise_data,node_complex_model,node_enhancement_loss,node_training,node_noise_classifier,node_classifier_training,node_desktop_user toneBlue
class node_metric_evaluation,node_offline_evaluation,node_file_inference,node_nlms_filter toneAmber
class node_rpi_inference,node_anc_stream,node_runtime_monitor,node_live_sender,node_stream_engine toneMint
class node_dashboard_entry,node_main_window,node_audio_receiver,node_telemetry_receiver,node_jitter_buffer,node_audio_playback,node_ui_components,node_diagnostics,node_pipeline_widget,node_spectrum_widget,node_waveform_widget,node_ui_theme toneRose
```

## Components

### Data and modeling

- [Mixed audio data](https://github.com/shreyas-fr/anc_code/blob/main/scripts/dynamic_mixer.py): `scripts/dynamic_mixer.py`
- [Complex CRN](https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/complex_crn.py): `src/enhance/complex_crn.py`
- [Enhancement losses](https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/losses.py): `src/enhance/losses.py`
- [Model training](https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/train.py): `src/enhance/train.py`
- [Noise classifier](https://github.com/shreyas-fr/anc_code/blob/main/src/classify/noise_classifier.py): `src/classify/noise_classifier.py`
- [Classifier training](https://github.com/shreyas-fr/anc_code/blob/main/src/classify/train_classifier.py): `src/classify/train_classifier.py`

### Evaluation and inference

- [Audio metrics](https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/evaluate.py): `src/enhance/evaluate.py`
- [Enhancement evaluation](https://github.com/shreyas-fr/anc_code/blob/main/eval/evaluate.py): `eval/evaluate.py`
- [File inference](https://github.com/shreyas-fr/anc_code/blob/main/src/enhance/inference.py): `src/enhance/inference.py`
- [NLMS postfilter](https://github.com/shreyas-fr/anc_code/blob/main/deploy/nlms_postfilter.py): `deploy/nlms_postfilter.py`

### Edge streaming

- [Raspberry Pi inference](https://github.com/shreyas-fr/anc_code/blob/main/deploy/rpi_infer.py): `deploy/rpi_infer.py`
- [Stateful ANC stream](https://github.com/shreyas-fr/anc_code/blob/main/runs/sih26052_rpi_deployment_audit/app/anc_stream.py): `runs/sih26052_rpi_deployment_audit/app/anc_stream.py`
- [Performance monitor](https://github.com/shreyas-fr/anc_code/blob/main/runs/sih26052_rpi_deployment_audit/app/monitor.py): `runs/sih26052_rpi_deployment_audit/app/monitor.py`
- [Live audio sender](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/runs/final_model/dfn3_live_sender.py): `Documents/anc sih/runs/final_model/dfn3_live_sender.py`
- [DFN3 stream](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/runs/final_model/dfn3_stream.py): `Documents/anc sih/runs/final_model/dfn3_stream.py`

### Host dashboard

- [Dashboard startup](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/main.py): `Documents/anc sih/frontend/main.py`
- [Main window](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/main_window.py): `Documents/anc sih/frontend/ui/main_window.py`
- [Audio receiver](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/network/audio_receiver.py): `Documents/anc sih/frontend/network/audio_receiver.py`
- [Telemetry receiver](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/network/telemetry_receiver.py): `Documents/anc sih/frontend/network/telemetry_receiver.py`
- [Jitter buffer](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/audio/jitter_buffer.py): `Documents/anc sih/frontend/audio/jitter_buffer.py`
- [Audio playback](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/audio/playback.py): `Documents/anc sih/frontend/audio/playback.py`
- [UI components](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/components.py): `Documents/anc sih/frontend/ui/components.py`
- [Diagnostics panel](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/diagnostics_panel.py): `Documents/anc sih/frontend/ui/diagnostics_panel.py`
- [Pipeline status](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/pipeline_widget.py): `Documents/anc sih/frontend/ui/pipeline_widget.py`
- [Spectrum display](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/spectrum_widget.py): `Documents/anc sih/frontend/ui/spectrum_widget.py`
- [Waveform display](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/waveform_widget.py): `Documents/anc sih/frontend/ui/waveform_widget.py`
- [UI theme](https://github.com/shreyas-fr/anc_code/blob/main/Documents/anc%20sih/frontend/ui/theme.py): `Documents/anc sih/frontend/ui/theme.py`

### Other components

- **Dashboard user**

## Connections

- Model training → Mixed audio data: loads examples (evidence: `src/enhance/train.py`)
- Model training → Complex CRN: trains model (evidence: `src/enhance/train.py`)
- Model training → Enhancement losses: scores loss (evidence: `src/enhance/train.py`)
- Model training → Audio metrics: computes metrics (evidence: `src/enhance/train.py`)
- Classifier training → Noise classifier: trains classifier (evidence: `src/classify/train_classifier.py`)
- Enhancement evaluation → Mixed audio data: loads examples (evidence: `eval/evaluate.py`)
- Enhancement evaluation → Complex CRN: evaluates model (evidence: `eval/evaluate.py`)
- Enhancement evaluation → Audio metrics: computes metrics (evidence: `eval/evaluate.py`)
- File inference → Complex CRN: runs model (evidence: `src/enhance/inference.py`)
- NLMS postfilter → Mixed audio data: loads examples (evidence: `deploy/nlms_postfilter.py`)
- NLMS postfilter → Complex CRN: enhances audio (evidence: `deploy/nlms_postfilter.py`)
- NLMS postfilter → Audio metrics: scores output (evidence: `deploy/nlms_postfilter.py`)
- Raspberry Pi inference → NLMS postfilter: uses filter (evidence: `deploy/rpi_infer.py`)
- Stateful ANC stream → Performance monitor: records runtime (evidence: `runs/sih26052_rpi_deployment_audit/app/anc_stream.py`)
- Live audio sender → DFN3 stream: uses stream (evidence: `Documents/anc sih/runs/final_model/dfn3_live_sender.py`)
- Dashboard user → Dashboard startup: opens dashboard (evidence: `Documents/anc sih/frontend/main.py`)
- Dashboard startup → Main window: creates window (evidence: `Documents/anc sih/frontend/main.py`)
- Main window → Audio receiver: uses receiver (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- Main window → Telemetry receiver: uses receiver (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- Main window → Jitter buffer: uses buffer (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- Main window → Audio playback: uses playback (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- Main window → UI components: uses components (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- Main window → Diagnostics panel: uses panel (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- Main window → Spectrum display: uses display (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- Main window → Waveform display: uses display (evidence: `Documents/anc sih/frontend/ui/main_window.py`)
- UI components → UI theme: uses theme (evidence: `Documents/anc sih/frontend/ui/components.py`)
- Pipeline status → UI theme: uses theme (evidence: `Documents/anc sih/frontend/ui/pipeline_widget.py`)
