# yrotak/live-tune architecture

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

- Interactive diagram: https://gitdiagram.com/yrotak/live-tune
- Repository: https://github.com/yrotak/live-tune

## Overview

Live Tune is a real-time vocal-tuning audio plugin. An audio host supplies audio to the processor, which analyzes pitch, snaps it to the selected key and scale, computes correction, and shifts the audio; the editor exposes controls and pitch feedback. The graph separates the major audio-processing stages and the editor. Processor excerpts are partial, so internal call relationships not visible there are omitted; source-index references support only the stated module relationships.

Main entry points: [`src/PluginProcessor.cpp`](https://github.com/yrotak/live-tune/blob/master/src/PluginProcessor.cpp) (Audio processor), [`src/PluginEditor.cpp`](https://github.com/yrotak/live-tune/blob/master/src/PluginEditor.cpp) (Plugin editor), [`src/PitchShifter.cpp`](https://github.com/yrotak/live-tune/blob/master/src/PitchShifter.cpp) (PSOLA shifter), [`src/Scale.h`](https://github.com/yrotak/live-tune/blob/master/src/Scale.h) (Scale snapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_audio["Audio processing"]
  node_processor["Audio processor"]
  node_pitch["Pitch analysis"]
  node_shifter["PSOLA shifter<br/>[PitchShifter.cpp]"]
end

subgraph group_tuning["Pitch correction"]
  node_scale["Scale snapping<br/>[Scale.h]"]
  node_corrector["Correction calculation<br/>[Corrector.h]"]
end

subgraph group_interface["Plugin interface"]
  node_editor["Plugin editor<br/>[PluginEditor.cpp]"]
  node_controls["Tuning controls<br/>[PluginEditor.cpp]"]
  node_feedback["Pitch display<br/>[PluginEditor.cpp]"]
  node_state["Plugin state"]
end

subgraph group_detection["Epoch detection"]
  node_epochs["Epoch detection<br/>[EpochDetector.cpp]"]
end

node_host(("Audio host"))

node_host -->|"sends audio"| node_processor
node_processor -->|"queues analysis"| node_pitch
node_processor -->|"uses snapping"| node_scale
node_processor -->|"uses correction"| node_corrector
node_processor -->|"uses shifting"| node_shifter
node_shifter -->|"detects epochs"| node_epochs
node_processor -->|"creates editor"| node_editor
node_editor -->|"configures"| node_controls
node_editor -->|"reads pitch"| node_processor
node_processor -->|"saves state"| node_state
node_editor -->|"displays pitch"| node_feedback

click node_processor "https://github.com/yrotak/live-tune/blob/master/src/PluginProcessor.cpp"
click node_pitch "https://github.com/yrotak/live-tune/blob/master/src/PluginProcessor.cpp"
click node_scale "https://github.com/yrotak/live-tune/blob/master/src/Scale.h"
click node_corrector "https://github.com/yrotak/live-tune/blob/master/src/Corrector.h"
click node_shifter "https://github.com/yrotak/live-tune/blob/master/src/PitchShifter.cpp"
click node_epochs "https://github.com/yrotak/live-tune/blob/master/src/EpochDetector.cpp"
click node_editor "https://github.com/yrotak/live-tune/blob/master/src/PluginEditor.cpp"
click node_controls "https://github.com/yrotak/live-tune/blob/master/src/PluginEditor.cpp"
click node_feedback "https://github.com/yrotak/live-tune/blob/master/src/PluginEditor.cpp"
click node_state "https://github.com/yrotak/live-tune/blob/master/src/PluginProcessor.cpp"

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_processor,node_pitch,node_shifter toneBlue
class node_scale,node_corrector toneAmber
class node_editor,node_controls,node_feedback,node_state toneMint
class node_epochs toneRose
class node_host toneIndigo
```

## Components

### Audio processing

- [Audio processor](https://github.com/yrotak/live-tune/blob/master/src/PluginProcessor.cpp): `src/PluginProcessor.cpp`
- [Pitch analysis](https://github.com/yrotak/live-tune/blob/master/src/PluginProcessor.cpp): `src/PluginProcessor.cpp`
- [PSOLA shifter](https://github.com/yrotak/live-tune/blob/master/src/PitchShifter.cpp): `src/PitchShifter.cpp`

### Pitch correction

- [Scale snapping](https://github.com/yrotak/live-tune/blob/master/src/Scale.h): `src/Scale.h`
- [Correction calculation](https://github.com/yrotak/live-tune/blob/master/src/Corrector.h): `src/Corrector.h`

### Plugin interface

- [Plugin editor](https://github.com/yrotak/live-tune/blob/master/src/PluginEditor.cpp): `src/PluginEditor.cpp`
- [Tuning controls](https://github.com/yrotak/live-tune/blob/master/src/PluginEditor.cpp): `src/PluginEditor.cpp`
- [Pitch display](https://github.com/yrotak/live-tune/blob/master/src/PluginEditor.cpp): `src/PluginEditor.cpp`
- [Plugin state](https://github.com/yrotak/live-tune/blob/master/src/PluginProcessor.cpp): `src/PluginProcessor.cpp`

### Epoch detection

- [Epoch detection](https://github.com/yrotak/live-tune/blob/master/src/EpochDetector.cpp): `src/EpochDetector.cpp`

### Other components

- **Audio host**

## Connections

- Audio host → Audio processor: sends audio (evidence: `src/PluginProcessor.cpp`)
- Audio processor → Pitch analysis: queues analysis (evidence: `src/PluginProcessor.cpp`)
- Audio processor → Scale snapping: uses snapping
- Audio processor → Correction calculation: uses correction
- Audio processor → PSOLA shifter: uses shifting
- PSOLA shifter → Epoch detection: detects epochs
- Audio processor → Plugin editor: creates editor (evidence: `src/PluginProcessor.cpp`)
- Plugin editor → Tuning controls: configures (evidence: `src/PluginEditor.cpp`)
- Plugin editor → Audio processor: reads pitch (evidence: `src/PluginEditor.cpp`)
- Audio processor → Plugin state: saves state (evidence: `src/PluginProcessor.cpp`)
- Plugin editor → Pitch display: displays pitch (evidence: `src/PluginEditor.cpp`)
