# yt2nj/learn-sing architecture

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

- Interactive diagram: https://gitdiagram.com/yt2nj/learn-sing
- Repository: https://github.com/yt2nj/learn-sing

## Overview

This is an offline singing-pitch practice page. A user opens the standalone HTML, then practices with microphone input or a local audio file and sees pitch feedback; the on-page piano provides reference tones. Transpose changes the solfège-to-note mapping, not the input audio. The interface, analysis, and controls are implemented in the app.js monolith. README documents the product capabilities and embedding; the sampled source excerpts do not expose all runtime wiring, so those relationships are attributed to README rather than inferred between subsystems.

Main entry points: [`app.js`](https://github.com/yt2nj/learn-sing/blob/main/app.js) (Piano keyboard), [`learn-sing.html`](https://github.com/yt2nj/learn-sing/blob/main/learn-sing.html) (Practice page), [`pitch-data.js`](https://github.com/yt2nj/learn-sing/blob/main/pitch-data.js) (Pitch data), [`assets/piano`](https://github.com/yt2nj/learn-sing/tree/main/assets/piano) (Piano samples)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Offline entry"]
  node_page["Practice page<br/>[learn-sing.html]"]
  node_main["App startup<br/>[app.js]"]
end

subgraph group_practice["Pitch practice"]
  node_controls["Practice controls<br/>[app.js]"]
  node_mic["Microphone pitch<br/>[app.js]"]
  node_audio["Audio-file practice<br/>[app.js]"]
  node_feedback["Pitch visualization<br/>[app.js]"]
  node_transpose["Solfege transpose<br/>[app.js]"]
end

subgraph group_reference["Pitch references"]
  node_keyboard["Piano keyboard<br/>[app.js]"]
  node_pitchdata["Pitch data<br/>[pitch-data.js]"]
  node_samples["Piano samples"]
end

node_user(("Learner"))

node_user -->|"opens"| node_page
node_page -->|"starts"| node_main
node_main -->|"creates"| node_controls
node_user -->|"sings into"| node_mic
node_user -->|"selects file"| node_audio
node_mic -->|"shows pitch"| node_feedback
node_audio -->|"shows pitch"| node_feedback
node_user -->|"plays keys"| node_keyboard
node_keyboard -->|"plays tones"| node_samples
node_user -->|"sets reference key"| node_transpose
node_transpose -->|"labels notes"| node_feedback
node_pitchdata -.->|"defines pitches"| node_keyboard

click node_page "https://github.com/yt2nj/learn-sing/blob/main/learn-sing.html"
click node_main "https://github.com/yt2nj/learn-sing/blob/main/app.js"
click node_controls "https://github.com/yt2nj/learn-sing/blob/main/app.js"
click node_mic "https://github.com/yt2nj/learn-sing/blob/main/app.js"
click node_audio "https://github.com/yt2nj/learn-sing/blob/main/app.js"
click node_feedback "https://github.com/yt2nj/learn-sing/blob/main/app.js"
click node_transpose "https://github.com/yt2nj/learn-sing/blob/main/app.js"
click node_keyboard "https://github.com/yt2nj/learn-sing/blob/main/app.js"
click node_pitchdata "https://github.com/yt2nj/learn-sing/blob/main/pitch-data.js"
click node_samples "https://github.com/yt2nj/learn-sing/tree/main/assets/piano"

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_page,node_main toneBlue
class node_controls,node_mic,node_audio,node_feedback,node_transpose toneAmber
class node_keyboard,node_pitchdata,node_samples toneMint
class node_user toneIndigo
```

## Components

### Offline entry

- [Practice page](https://github.com/yt2nj/learn-sing/blob/main/learn-sing.html): `learn-sing.html`
- [App startup](https://github.com/yt2nj/learn-sing/blob/main/app.js): `app.js`

### Pitch practice

- [Practice controls](https://github.com/yt2nj/learn-sing/blob/main/app.js): `app.js`
- [Microphone pitch](https://github.com/yt2nj/learn-sing/blob/main/app.js): `app.js`
- [Audio-file practice](https://github.com/yt2nj/learn-sing/blob/main/app.js): `app.js`
- [Pitch visualization](https://github.com/yt2nj/learn-sing/blob/main/app.js): `app.js`
- [Solfege transpose](https://github.com/yt2nj/learn-sing/blob/main/app.js): `app.js`

### Pitch references

- [Piano keyboard](https://github.com/yt2nj/learn-sing/blob/main/app.js): `app.js`
- [Pitch data](https://github.com/yt2nj/learn-sing/blob/main/pitch-data.js): `pitch-data.js`
- [Piano samples](https://github.com/yt2nj/learn-sing/tree/main/assets/piano): `assets/piano`

### Other components

- **Learner**

## Connections

- Learner → Practice page: opens (evidence: `README.md`)
- Practice page → App startup: starts (evidence: `README.md`)
- App startup → Practice controls: creates (evidence: `app.js`)
- Learner → Microphone pitch: sings into (evidence: `README.md`)
- Learner → Audio-file practice: selects file (evidence: `README.md`)
- Microphone pitch → Pitch visualization: shows pitch (evidence: `README.md`)
- Audio-file practice → Pitch visualization: shows pitch (evidence: `README.md`)
- Learner → Piano keyboard: plays keys (evidence: `README.md`)
- Piano keyboard → Piano samples: plays tones (evidence: `app.js`)
- Learner → Solfege transpose: sets reference key (evidence: `README.md`)
- Solfege transpose → Pitch visualization: labels notes (evidence: `README.md`)
- Pitch data → Piano keyboard: defines pitches
