# maujabur/laser-harp architecture

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

- Interactive diagram: https://gitdiagram.com/maujabur/laser-harp
- Repository: https://github.com/maujabur/laser-harp

## Overview

Harpa Laser is a browser-based laser-harp synthesizer. Players trigger notes by keyboard, touch/mouse, or MIDI; the app maps them to scale notes and voices, then synthesizes audio. Users can shape the sound and select, save, import, or export presets. The graph separates input, synthesis, controls, and preset/state handling. Most behavior lives in app.js; relationships not visible in the excerpts are included only where the README documents them.

Main entry points: [`app.js`](https://github.com/maujabur/laser-harp/blob/main/app.js) (Preset Selector), [`presets`](https://github.com/maujabur/laser-harp/tree/main/presets) (Preset Collection), [`index.html`](https://github.com/maujabur/laser-harp/blob/main/index.html) (Browser UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Note Input"]
  node_keyboard_touch["Keyboard and Touch<br/>[app.js]"]
  node_midi_input["MIDI Input<br/>[app.js]"]
  node_note_mapping["Scale and Note Mapping<br/>[app.js]"]
end

subgraph group_sound["Audio Synthesis"]
  node_harp["Polyphonic Harp<br/>[app.js]"]
  node_voice["Laser Voice<br/>[app.js]"]
  node_tone["Tone.js Audio"]
  node_effects["Chorus and Output<br/>[app.js]"]
end

subgraph group_controls["Sound Controls"]
  node_synth_controls["Synth Controls<br/>[app.js]"]
  node_volume["Volume Control<br/>[app.js]"]
  node_url_config["URL Configuration<br/>[app.js]"]
end

subgraph group_presets["Presets and State"]
  node_preset_ui["Preset Selector<br/>[app.js]"]
  node_factory_presets["Factory Presets<br/>[app.js]"]
  node_collection["Preset Collection"]
  node_user_presets[("Saved Vibes<br/>[app.js]")]
  node_preset_files["Import and Export<br/>[app.js]"]
end

node_player(("Player"))
node_browser_storage[("Browser Storage")]
node_page["Browser UI<br/>[index.html]"]

node_player -->|"plays notes"| node_keyboard_touch
node_keyboard_touch -->|"maps key"| node_note_mapping
node_player -->|"sends MIDI"| node_midi_input
node_midi_input -->|"maps pitch"| node_note_mapping
node_note_mapping -->|"triggers notes"| node_harp
node_harp -->|"allocates voices"| node_voice
node_voice -->|"synthesizes audio"| node_tone
node_voice -->|"routes audio"| node_effects
node_player -->|"adjusts sound"| node_synth_controls
node_synth_controls -->|"updates voices"| node_harp
node_player -->|"adjusts level"| node_volume
node_player -->|"sets limits"| node_url_config
node_url_config -->|"sets polyphony"| node_harp
node_player -->|"selects vibe"| node_preset_ui
node_factory_presets -->|"offers presets"| node_preset_ui
node_collection -->|"loads collection"| node_preset_ui
node_preset_ui -->|"applies settings"| node_harp
node_preset_ui -->|"saves vibes"| node_user_presets
node_user_presets -->|"persists settings"| node_browser_storage
node_player -->|"imports or exports"| node_preset_files
node_preset_files -->|"adds imported vibe"| node_user_presets
node_page -->|"presents controls"| node_synth_controls

click node_keyboard_touch "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_midi_input "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_note_mapping "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_harp "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_voice "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_effects "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_synth_controls "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_volume "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_url_config "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_preset_ui "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_factory_presets "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_collection "https://github.com/maujabur/laser-harp/tree/main/presets"
click node_user_presets "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_preset_files "https://github.com/maujabur/laser-harp/blob/main/app.js"
click node_page "https://github.com/maujabur/laser-harp/blob/main/index.html"

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_keyboard_touch,node_midi_input,node_note_mapping,node_page toneBlue
class node_harp,node_voice,node_tone,node_effects,node_browser_storage toneAmber
class node_synth_controls,node_volume,node_url_config toneMint
class node_preset_ui,node_factory_presets,node_collection,node_user_presets,node_preset_files toneRose
class node_player toneIndigo
```

## Components

### Note Input

- [Keyboard and Touch](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [MIDI Input](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [Scale and Note Mapping](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`

### Audio Synthesis

- [Polyphonic Harp](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [Laser Voice](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- **Tone.js Audio**
- [Chorus and Output](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`

### Sound Controls

- [Synth Controls](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [Volume Control](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [URL Configuration](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`

### Presets and State

- [Preset Selector](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [Factory Presets](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [Preset Collection](https://github.com/maujabur/laser-harp/tree/main/presets): `presets`
- [Saved Vibes](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`
- [Import and Export](https://github.com/maujabur/laser-harp/blob/main/app.js): `app.js`

### Other components

- **Player**
- **Browser Storage**
- [Browser UI](https://github.com/maujabur/laser-harp/blob/main/index.html): `index.html`

## Connections

- Player → Keyboard and Touch: plays notes (evidence: `README.md`)
- Keyboard and Touch → Scale and Note Mapping: maps key (evidence: `README.md`)
- Player → MIDI Input: sends MIDI (evidence: `app.js`)
- MIDI Input → Scale and Note Mapping: maps pitch (evidence: `app.js`)
- Scale and Note Mapping → Polyphonic Harp: triggers notes (evidence: `README.md`)
- Polyphonic Harp → Laser Voice: allocates voices (evidence: `app.js`)
- Laser Voice → Tone.js Audio: synthesizes audio (evidence: `README.md`)
- Laser Voice → Chorus and Output: routes audio (evidence: `app.js`)
- Player → Synth Controls: adjusts sound (evidence: `README.md`)
- Synth Controls → Polyphonic Harp: updates voices (evidence: `app.js`)
- Player → Volume Control: adjusts level (evidence: `README.md`)
- Player → URL Configuration: sets limits (evidence: `README.md`)
- URL Configuration → Polyphonic Harp: sets polyphony (evidence: `README.md`)
- Player → Preset Selector: selects vibe (evidence: `README.md`)
- Factory Presets → Preset Selector: offers presets (evidence: `README.md`)
- Preset Collection → Preset Selector: loads collection (evidence: `README.md`)
- Preset Selector → Polyphonic Harp: applies settings (evidence: `README.md`)
- Preset Selector → Saved Vibes: saves vibes (evidence: `README.md`)
- Saved Vibes → Browser Storage: persists settings (evidence: `README.md`)
- Player → Import and Export: imports or exports (evidence: `README.md`)
- Import and Export → Saved Vibes: adds imported vibe (evidence: `README.md`)
- Browser UI → Synth Controls: presents controls (evidence: `README.md`)
