# th3paypal/real_time_note_decoder architecture

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

- Interactive diagram: https://gitdiagram.com/th3paypal/real_time_note_decoder
- Repository: https://github.com/th3paypal/real_time_note_decoder

## Overview

This is a single-file polyphonic audio-to-sheet-music application. Its main workflow trains a note detector from audio/MIDI datasets, captures live audio, converts detected pitches into MIDI notes, and invokes external tools to generate sheet music. The graph separates data preparation, model and processing, and output stages; several internal calls are visible in the excerpt, while omitted code limits claims about training orchestration and visualization wiring.

Main entry points: [`note_detector.py`](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py) (Audio Processor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Training Data"]
  node_dataset["Audio Dataset<br/>[note_detector.py]"]
  node_features["Audio Features<br/>[note_detector.py]"]
  node_metrics["Model Evaluation<br/>[note_detector.py]"]
end

subgraph group_detection["Detection and Recording"]
  node_main["Application Entry<br/>[note_detector.py]"]
  node_model["Note Detector<br/>[note_detector.py]"]
  node_processor["Audio Processor<br/>[note_detector.py]"]
end

subgraph group_output["Music Output"]
  node_notes["Detected Notes<br/>[note_detector.py]"]
  node_visualization["Note Visualization<br/>[note_detector.py]"]
  node_midi["MIDI Export<br/>[note_detector.py]"]
  node_conversion["Sheet Conversion<br/>[note_detector.py]"]
  node_pdf["Sheet Music PDF"]
end

node_user(("User"))
node_microphone(("Audio Input"))
node_midi2ly["midi2ly and LilyPond"]

node_user -->|"starts"| node_main
node_main -->|"creates"| node_processor
node_main -->|"trains"| node_processor
node_main -->|"starts recording"| node_processor
node_dataset -->|"extracts"| node_features
node_processor -->|"runs inference"| node_model
node_processor -->|"converts predictions"| node_notes
node_microphone -->|"streams audio"| node_processor
node_processor -->|"visualizes"| node_visualization
node_processor -->|"writes"| node_midi
node_processor -->|"invokes"| node_conversion
node_conversion -->|"converts"| node_midi2ly
node_midi2ly -->|"generates"| node_pdf

click node_main "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_dataset "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_features "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_model "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_processor "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_metrics "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_notes "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_visualization "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_midi "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py"
click node_conversion "https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.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_dataset,node_features,node_metrics,node_user toneBlue
class node_main,node_model,node_processor toneAmber
class node_notes,node_visualization,node_midi,node_conversion,node_pdf toneMint
class node_microphone,node_midi2ly toneIndigo
```

## Components

### Training Data

- [Audio Dataset](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- [Audio Features](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- [Model Evaluation](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`

### Detection and Recording

- [Application Entry](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- [Note Detector](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- [Audio Processor](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`

### Music Output

- [Detected Notes](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- [Note Visualization](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- [MIDI Export](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- [Sheet Conversion](https://github.com/th3paypal/real_time_note_decoder/blob/main/note_detector.py): `note_detector.py`
- **Sheet Music PDF**

### Other components

- **User**
- **Audio Input**
- **midi2ly and LilyPond**

## Connections

- User → Application Entry: starts (evidence: `note_detector.py`)
- Application Entry → Audio Processor: creates (evidence: `note_detector.py`)
- Application Entry → Audio Processor: trains (evidence: `note_detector.py`)
- Application Entry → Audio Processor: starts recording (evidence: `note_detector.py`)
- Audio Dataset → Audio Features: extracts (evidence: `note_detector.py`)
- Audio Processor → Note Detector: runs inference (evidence: `note_detector.py`)
- Audio Processor → Detected Notes: converts predictions (evidence: `note_detector.py`)
- Audio Input → Audio Processor: streams audio (evidence: `note_detector.py`)
- Audio Processor → Note Visualization: visualizes (evidence: `note_detector.py`)
- Audio Processor → MIDI Export: writes (evidence: `note_detector.py`)
- Audio Processor → Sheet Conversion: invokes (evidence: `note_detector.py`)
- Sheet Conversion → midi2ly and LilyPond: converts (evidence: `note_detector.py`)
- midi2ly and LilyPond → Sheet Music PDF: generates
