# kanebos9/riffsheet architecture

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

- Interactive diagram: https://gitdiagram.com/kanebos9/riffsheet
- Repository: https://github.com/kanebos9/riffsheet

## Overview

Riffsheet is a local-first score editor and audio transcription application, available standalone or as a DAW plugin. The main workflow is recording or opening music, optionally transcribing audio, turning performed notes into readable notation, and editing synchronized notation, note-name, and tablature views before playback or export. The graph preserves documented import formats, optional image recognition, engine choices, beat tracking, and MIDI, MusicXML, and PDF export. Some subsystem links are documented capabilities rather than sampled calls; unsampled implementation details are not inferred.

Main entry points: [`webcore/src/score/fromPipeline.ts`](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/score/fromPipeline.ts) (Score model), [`webcore/src/audio/engineHost.ts`](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/engineHost.ts) (Engine worker host), [`shell/Source/engines/EngineCatalog.cpp`](https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/engines/EngineCatalog.cpp) (Transcription engines), [`webcore/src/ui/app.ts`](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/ui/app.ts) (App interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_appui["App interface<br/>[app.ts]"]
  node_state["App state<br/>[state.ts]"]
  node_persist[("Documents<br/>[persist.ts]")]
end

subgraph group_audio["Audio processing"]
  node_enginehost["Engine worker host<br/>[engineHost.ts]"]
  node_onsets["Onset detection<br/>[onsets.ts]"]
  node_transcription["Audio transcription<br/>[riffsheetEngine.ts]"]
  node_engineworker["Worker dispatch<br/>[engineWorker.ts]"]
  node_playback["Playback<br/>[transport.ts]"]
end

subgraph group_score["Score workflow"]
  node_imports["Music imports<br/>[scoreFile.ts]"]
  node_midiimport["MIDI import<br/>[midiFile.ts]"]
  node_imageimport["Score-image import<br/>[scoreImage.ts]"]
  node_pipeline["Notation pipeline<br/>[buildScore.ts]"]
  node_scoremodel["Score model<br/>[fromPipeline.ts]"]
  node_views["Synchronized views<br/>[triview.ts]"]
  node_pianoroll["Piano roll<br/>[pianoroll.ts]"]
  node_editing["Score editing<br/>[editBrain.ts]"]
  node_midiout["MIDI export<br/>[index.ts]"]
  node_musicxmlout["MusicXML export<br/>[musicxml.ts]"]
  node_pdfout["PDF export<br/>[pdf.ts]"]
end

subgraph group_native["Native integration"]
  node_capture["Audio capture<br/>[TrackCapture.cpp]"]
  node_engines["Transcription engines<br/>[EngineCatalog.cpp]"]
  node_preprocess["Audio preparation"]
  node_beat["Beat tracking<br/>[BeatTracker.cpp]"]
  node_plugin["DAW plugin"]
  node_bridge["Native bridge<br/>[NativeBridge.cpp]"]
end

node_user(("Musician"))
node_audiveris["Audiveris"]

node_user -->|"uses"| node_appui
node_user -->|"records track"| node_capture
node_user -->|"opens music"| node_imports
node_imports -.->|"loads score"| node_scoremodel
node_midiimport -->|"imports MIDI"| node_scoremodel
node_imageimport -->|"recognizes score"| node_audiveris
node_capture -.->|"supplies audio"| node_enginehost
node_enginehost -->|"dispatches jobs"| node_engineworker
node_enginehost -->|"detects attacks"| node_onsets
node_enginehost -->|"transcribes audio"| node_transcription
node_engines -.->|"prepares audio"| node_preprocess
node_engines -->|"tracks beats"| node_beat
node_transcription -->|"produces notes"| node_pipeline
node_pipeline -->|"builds score"| node_scoremodel
node_scoremodel -->|"feeds views"| node_views
node_scoremodel -->|"feeds roll"| node_pianoroll
node_user -->|"edits score"| node_editing
node_editing -->|"updates views"| node_views
node_user -->|"plays recording"| node_playback
node_user -->|"exports MIDI"| node_midiout
node_user -->|"exports MusicXML"| node_musicxmlout
node_user -->|"exports PDF"| node_pdfout
node_appui -.->|"works with"| node_state
node_state -.->|"saves documents"| node_persist
node_plugin -.->|"integrates native"| node_bridge

click node_appui "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/ui/app.ts"
click node_state "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/app/state.ts"
click node_persist "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/app/persist.ts"
click node_imports "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/import/scoreFile.ts"
click node_midiimport "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/import/midiFile.ts"
click node_imageimport "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/import/scoreImage.ts"
click node_capture "https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/plugin/TrackCapture.cpp"
click node_enginehost "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/engineHost.ts"
click node_onsets "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/onsets.ts"
click node_transcription "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/riffsheetEngine.ts"
click node_engineworker "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/engineWorker.ts"
click node_engines "https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/engines/EngineCatalog.cpp"
click node_preprocess "https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/engines/EnginePreprocess.cpp"
click node_beat "https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/engines/beats/BeatTracker.cpp"
click node_pipeline "https://github.com/kanebos9/riffsheet/blob/public-main/pipeline/src/buildScore.ts"
click node_scoremodel "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/score/fromPipeline.ts"
click node_views "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/view/triview.ts"
click node_pianoroll "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/view/pianoroll.ts"
click node_editing "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/edit/editBrain.ts"
click node_playback "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/transport.ts"
click node_midiout "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/pipeline/index.ts"
click node_musicxmlout "https://github.com/kanebos9/riffsheet/blob/public-main/pipeline/src/musicxml.ts"
click node_pdfout "https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/export/pdf.ts"
click node_plugin "https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/plugin/PluginProcessor.cpp"
click node_bridge "https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/bridge/NativeBridge.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_appui,node_state,node_persist toneBlue
class node_enginehost,node_onsets,node_transcription,node_engineworker,node_playback toneAmber
class node_imports,node_midiimport,node_imageimport,node_pipeline,node_scoremodel,node_views,node_pianoroll,node_editing,node_midiout,node_musicxmlout,node_pdfout toneMint
class node_capture,node_engines,node_preprocess,node_beat,node_plugin,node_bridge toneRose
class node_user,node_audiveris toneIndigo
```

## Components

### Application

- [App interface](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/ui/app.ts): `webcore/src/ui/app.ts`
- [App state](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/app/state.ts): `webcore/src/app/state.ts`
- [Documents](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/app/persist.ts): `webcore/src/app/persist.ts`

### Audio processing

- [Engine worker host](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/engineHost.ts): `webcore/src/audio/engineHost.ts`
- [Onset detection](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/onsets.ts): `webcore/src/audio/onsets.ts`
- [Audio transcription](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/riffsheetEngine.ts): `webcore/src/audio/riffsheetEngine.ts`
- [Worker dispatch](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/engineWorker.ts): `webcore/src/audio/engineWorker.ts`
- [Playback](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/audio/transport.ts): `webcore/src/audio/transport.ts`

### Score workflow

- [Music imports](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/import/scoreFile.ts): `webcore/src/import/scoreFile.ts`
- [MIDI import](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/import/midiFile.ts): `webcore/src/import/midiFile.ts`
- [Score-image import](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/import/scoreImage.ts): `webcore/src/import/scoreImage.ts`
- [Notation pipeline](https://github.com/kanebos9/riffsheet/blob/public-main/pipeline/src/buildScore.ts): `pipeline/src/buildScore.ts`
- [Score model](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/score/fromPipeline.ts): `webcore/src/score/fromPipeline.ts`
- [Synchronized views](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/view/triview.ts): `webcore/src/view/triview.ts`
- [Piano roll](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/view/pianoroll.ts): `webcore/src/view/pianoroll.ts`
- [Score editing](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/edit/editBrain.ts): `webcore/src/edit/editBrain.ts`
- [MIDI export](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/pipeline/index.ts): `webcore/src/pipeline/index.ts`
- [MusicXML export](https://github.com/kanebos9/riffsheet/blob/public-main/pipeline/src/musicxml.ts): `pipeline/src/musicxml.ts`
- [PDF export](https://github.com/kanebos9/riffsheet/blob/public-main/webcore/src/export/pdf.ts): `webcore/src/export/pdf.ts`

### Native integration

- [Audio capture](https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/plugin/TrackCapture.cpp): `shell/Source/plugin/TrackCapture.cpp`
- [Transcription engines](https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/engines/EngineCatalog.cpp): `shell/Source/engines/EngineCatalog.cpp`
- [Audio preparation](https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/engines/EnginePreprocess.cpp): `shell/Source/engines/EnginePreprocess.cpp`
- [Beat tracking](https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/engines/beats/BeatTracker.cpp): `shell/Source/engines/beats/BeatTracker.cpp`
- [DAW plugin](https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/plugin/PluginProcessor.cpp): `shell/Source/plugin/PluginProcessor.cpp`
- [Native bridge](https://github.com/kanebos9/riffsheet/blob/public-main/shell/Source/bridge/NativeBridge.cpp): `shell/Source/bridge/NativeBridge.cpp`

### Other components

- **Musician**
- **Audiveris**

## Connections

- Musician → App interface: uses
- Musician → Audio capture: records track
- Musician → Music imports: opens music
- Music imports → Score model: loads score
- MIDI import → Score model: imports MIDI
- Score-image import → Audiveris: recognizes score
- Audio capture → Engine worker host: supplies audio
- Engine worker host → Worker dispatch: dispatches jobs (evidence: `webcore/src/audio/engineHost.ts`)
- Engine worker host → Onset detection: detects attacks (evidence: `webcore/src/audio/engineHost.ts`)
- Engine worker host → Audio transcription: transcribes audio (evidence: `webcore/src/audio/engineHost.ts`)
- Transcription engines → Audio preparation: prepares audio
- Transcription engines → Beat tracking: tracks beats
- Audio transcription → Notation pipeline: produces notes
- Notation pipeline → Score model: builds score
- Score model → Synchronized views: feeds views
- Score model → Piano roll: feeds roll
- Musician → Score editing: edits score
- Score editing → Synchronized views: updates views
- Musician → Playback: plays recording
- Musician → MIDI export: exports MIDI
- Musician → MusicXML export: exports MusicXML
- Musician → PDF export: exports PDF
- App interface → App state: works with
- App state → Documents: saves documents
- DAW plugin → Native bridge: integrates native
