Skip to content

Latest commit

 

History

History
1547 lines (1161 loc) · 53.2 KB

glossary.md

File metadata and controls

1547 lines (1161 loc) · 53.2 KB

glossary.md — griff project glossary

Purpose: single source of truth for terms used by humans and LLM agents working on griff.

Rule of use: if a term appears in the spec, an ADR, a stage doc, code, or an agent task, check this file first. Do not invent competing definitions. If a term is missing or ambiguous, extend this file rather than creating synonyms in code.

0. Project terms

griff

The guitar riff engine project: a system to analyze, slice, generate, and regenerate guitar riffs, targeted at swancore / DGD-like clean / prog / post-hardcore parts. Internally it works on a structured musical model, not on raw MIDI bytes.

Naming etymology: "griff" = "guitar riff" (English). Also a multilingual pun: Russian "гриф" (grif) means the guitar fretboard/neck; "гриф" also denotes a griffon (the mythical bird). The project mascot contrast: swan (soft, expressive, flowing) vs griffon (aggressive, intense, soaring). Marketing slogan: "soft as swan & aggressive as griffon". Future brand variant: "Griff-On" (the griffon bird, full name reveal).

guitar riff engine

An engine that treats guitar riffs as musical objects — phrases, motifs, rhythm cells, techniques, fretboard positions, transitions, variations — rather than emitting random notes.

swancore-first

Architectural principle: design features for expressive clean / prog / swancore guitar parts first, not for "music generation in general". Drives the data model, features, generator, corpus, and UI.

DGD-like

Use structural traits similar to Dance Gavin Dance (fast clean riffs, syncopation, register jumps, melodic intervals, tapping / legato-like motion, unconventional phrasing) to produce original ideas — not to copy songs.

MVP

Minimum Viable Product. In griff: a minimal working vertical slice — import → internal model → analysis/slicing → generation/export → tests. Not "a quick throwaway".

vertical slice

An end-to-end piece of functionality through every layer of the system.

roadmap stage

A development stage S0, S1, … Each stage has a goal, tasks, acceptance criteria, tests, and constraints.

S0

Baseline stage. Freeze current behavior via characterization tests, golden snapshots, and smoke tests before refactoring.

S1

Canonical score model stage. Introduce Score / MasterBar / Track / Voice / EventGroup without breaking existing code in one stroke.

S2

MIDI transport refactor stage. Move MIDI import/export onto the master timeline and canonical score model.

S3

Guitar Pro import stage. Add Guitar Pro as a first-class data source, especially for techniques and guitar specifics.

S4

Phrase boundary detection stage. Detect phrase boundaries automatically with explainable heuristics and manual override.

S5

Corpus and schema stage. Build a micro-corpus and an annotation schema for phrases, techniques, tags, and quality.

S6

Rule-based generator v0 stage. First controlled, non-neural phrase generator.

S7

Graph layer stage. Add a graph of phrases, motifs, rhythm cells, transitions.

S8

Preview app stage. Standalone app to view, listen, compare, and hand-annotate.

S9

Feedback layer stage. Human-in-the-loop: like/dislike, favorites, preferences, reranking.

S10

CLAP MVP stage. MIDI-oriented CLAP plugin, once core is stable enough.

S11

Region regeneration stage. Regenerate selected ranges while preserving anchors / frozen regions.

S12

Neural assistance stage. Neural layer for continuation / infilling / variation, only after corpus and rule-based baseline exist.

S13

Complementary part generation stage (ComplementArranger). Generate a second part related to an existing one on chosen axes and contrasting on others. Depends on S6; appended as the next free number rather than renumbering S7…S12 (ADR-0012; see docs/audit/2026-05-s13-complementary-arranger.md).

S14

Structure controls and metrics stage. Make time-organisation controllable — target span, pattern period, repeatability/variation, complexity profile — as a constraint compiler over S6. Depends on S6/S4; appended as the next free number. Feeds the graph layer but does not depend on it or on DP/Viterbi (ADR-0015).

S15

Tonal context and harmonic control stage. Make tonal/harmonic context explicit, uncertain, scoped, and reusable before it may influence generation; observed evidence stays distinct from inferred meaning, and abstention is a valid result. Phase 0–1 accepted and closed 2026-07-12; confidence thresholds, automatic scope selection, and generation integration remain frozen until their own acceptance. Depends on S1/S5/S6; appended as the next free number.

S16

Swang language and verified lifting stage. A deterministic, versioned musical DSL over the canonical model: bounded pattern algebra (fractalize, traversals, budgets), recipes, exact canonical escape hatches, and verified lifting of imported scores into executable programs with explicit residuals (ADR-0029; normative semantics in docs/swang/spec.md). Depends on S1/S2/S3/S4/S6, building on S13/S14 and on S15 contracts once accepted; appended as the next free number.

1. Architecture and data model

canonical model

Single internal model into which MIDI, Guitar Pro, MusicXML, and other formats are imported. Not a copy of MIDI or Guitar Pro — a normalized model of its own.

canonical score model

The target score-level model: Score -> MasterBar -> Track -> Voice -> EventGroup -> AtomEvent. Needed for tempo map, polyphony, chords, Guitar Pro effects, and generation.

Score

Top-level musical document: master timeline, tracks, metadata, source info, tuning, global parameters.

MasterBar

Score-level bar. Holds bar parameters shared by all tracks: time signature, tempo changes, repeats, markers, bar index, absolute tick range. Prevents re-deriving tempo per track.

Track

An instrument part or logical layer (clean guitar, rhythm guitar, lead guitar, bass).

Voice

An independent event stream inside a track. Needed for polyphony, overlapping notes, ringing notes, chords, multiple rhythmic lines.

EventGroup

A group of events bound by time or musical role: chord, arpeggio group, tuplet, grace cluster, sequential fragment. Fixes the "Event::Note/Rest is too linear" problem.

AtomEvent

The minimal event in the canonical model: note, rest, tie, control/expression event, or a service unit. The atom that groups are built from.

Fretboard position

The (string, fret) location of a note under the track's Tuning, carried optionally on a note as part of the rich note model (ADR-0018, superseding ADR-0014): Guitar Pro import supplies it directly, MIDI import leaves it absent or inferred. Pitch alone cannot express hand position; position is what makes fret_jump_penalty and human-plausible parts possible.

Position inference

Assigning a plausible (string, fret) to each pitch of MIDI-sourced material — the guitar fingering problem — via a small, local, deterministic DP over per-note candidates, minimising hand movement / stretch / string changes under the track Tuning (ADR-0019). VI-independent geometry (distinct from the parked MIDI technique inference); output is marked InferredFromMidi with confidence. GP positions stay Explicit and are not inferred.

Part playability

Playability facts of one part's melodic line (highest pitch per onset), measured on the position-inference DP's optimal path under the track's Tuning (fretboard::measure_playability): line notes measured, notes with no playable (string, fret), and the largest fret travel between consecutively positioned notes. The verdict is reachability — a part with an unreachable line note is not playable; fret travel is a fact, not a verdict (jump thresholds are calibration data). The S13 pair validator's per-part filter, and the seed of the S7 playability / fret_jump_penalty cost terms. Chord voicing playability is deferred (ADR-0019 §7).

Note

A sounding note (AtomNote): pitch, duration, velocity, an optional FretboardPosition, and a set of NoteMarks, each technique carrying TechniqueEvidence. The flat Option<Articulation> is superseded by the marks set plus TechniqueSpans (ADR-0018).

Rest

A musically significant silence of a given duration. Distinct from "no event".

Event

Current enum in griff-core holding Note and Rest. In the target architecture it becomes a compatibility layer or part of a richer model.

Bar

Current single-bar event container. In the target model it links to MasterBar or becomes a view/projection.

Phrase

A musical phrase: a sequence of events/bars perceived as a complete unit. The base unit of analysis, generation, and corpus.

PhraseChunk

A fragment extracted from a source and stored in the corpus. Has boundaries, tags, features, source reference, quality flags.

Style cohort

Provenance label on a corpus chunk relative to the swancore-first scope: core (swancore) or adjacent (neighbouring genres admitted for coverage and graph mass). Consumed as per-consumer slices (decisions 2026-06-11): statistical gates and the style centroid read core only; the graph layer reads everything with per-cohort transition statistics; novelty references and taste ignore cohorts. Schema v4 (ChunkMeta.style_cohort); absent = unlabeled pre-v4 record.

Ensemble group

Several single-part chunks curated from one source span (e.g. the two role-fluid guitars of a DGD section), linked by a shared group id and a manifest-level group record carrying measured pairwise relation axes (measure_pair_axes) — the corpus-side complement hyperedge (§9). No role labels by design: the per-phrase relation axes are the role information. Schema v4 (ChunkMeta.ensemble, CorpusManifest.groups); written by griff curate --ensemble.

Motif

A short recognizable musical idea: a rhythmic figure, an interval shape, or a repeated phrasal cell. The generator must vary motifs, not shuffle notes.

RhythmCell

A small rhythmic unit: an onset/duration/rest pattern. Used in the graph layer and rule-based generator.

PitchMaterial

A set of pitch constraints: scale, mode, pitch set, anchor notes, allowed intervals, register range.

Timeline

The time axis of a piece, expressed through ticks, tempo map, and master bars.

Master timeline

The global time structure of a score. Single source of truth for tempo, meter, bar positions, and transport-level markers.

SourceMeta

Metadata from the source format: Guitar Pro effects, string/fret, MIDI CC evidence, original track name, importer warnings. Must not be dropped silently.

ImportWarning

Importer warning: data read partially, approximately, or lost.

LossReport

A report of losses during import/export. Especially important for MIDI ↔ Guitar Pro, which store different semantics.

Compatibility layer

A layer letting the old Phrase/Bar/Event API live during the transition to the canonical score model.

Projection

A representation of the rich model in a simpler form (e.g. polyphonic score → monophonic phrase view).

View

A read-only representation for a specific use case: monophonic phrase view, track summary, CLI summary, debug dump.

2. Time, rhythm, transport

Tick

An abstract unit of musical time. In MIDI it depends on PPQN. Typed as Ticks.

Ticks

Rust newtype around a tick count, so musical time is not confused with bytes, indices, or milliseconds.

PPQN

Pulses Per Quarter Note. Ticks per quarter note (e.g. 480 PPQN = 480 ticks per quarter).

Metrical timing

MIDI timing based on ticks per beat/quarter. The path griff supports today.

SMPTE timing

Frame-based MIDI timing. Not supported yet; would need TransportTimebase::{Ppqn, Timecode} or an absolute-time conversion layer.

Timecode

Time as hours/minutes/seconds/frames. Less convenient than PPQN for a generator, but appears in MIDI/film/video workflows.

Tempo

Music speed, usually BPM. Currently Tempo(pub f64).

BPM

Beats Per Minute (120 BPM = 120 beats per minute).

Microseconds per beat

MIDI tempo representation: microseconds per beat (500000 µs/beat = 120 BPM).

Tempo map

A sequence of tempo changes along the timeline. Lives in the master timeline, not scattered across tracks.

Time signature

Bar meter (4/4, 7/8, 5/4). Typed as TimeSignature.

Meter

Same meaning as time signature, used more as a musical category.

Bar duration

Bar length in ticks; depends on PPQN and time signature.

Half-open range

Range [start, end): start included, end excluded. Important for TickRange, slicing, and boundary logic.

TickRange

A tick range used for slicing, selection, region regeneration, boundary detection.

TimedEvent

An event with absolute start and source indexes; used for analysis, slicing, regeneration.

Quantization

Snapping events to a time grid. Useful for MIDI import but dangerous if it destroys human micro-timing.

Swing

Rhythmic offset of beats producing groove. Less central for swancore than syncopation but relevant for groove-aware generation.

Syncopation

An accent or event on a weak/unexpected beat. A key swancore/prog feel marker.

Cadence

A sense of phrase completion: harmonic, rhythmic, or melodic.

Rhythmic reset

A new rhythmic pattern starting after dense/syncopated motion. A useful phrase boundary signal.

Density

Event density over time: notes/attacks/changes per region.

Onset

The start moment of a sounding event. Onset patterns matter for rhythm analysis.

3. MIDI

MIDI

Musical Instrument Digital Interface. An event format/protocol (note on/off, velocity, CC, pitch bend, program change). MIDI does not encode "hammer-on" as full guitar semantics.

SMF

Standard MIDI File — the .mid file format.

midly

Rust crate for reading/writing MIDI. Currently used by griff.

NoteOn

MIDI note-start event. Velocity > 0 usually means note start.

NoteOff

MIDI note-end event. NoteOn velocity=0 is a common NoteOff equivalent.

Velocity

Note intensity, 0–127. A dedicated type in griff.

Pitch

MIDI pitch number, 0–127. 60 = middle C.

Channel

MIDI channel 0–15. A track currently gets the dominant channel by majority of note events.

TrackEvent

A midly MIDI track event: delta time + payload.

Meta event

A service MIDI event: tempo, time signature, track name, end of track, etc.

Track name

MIDI meta event with the track name; imported as an optional name.

EndOfTrack

MIDI meta event ending a track. Required for correct export.

Control Change / CC

MIDI controller events (pedals, modulation, expression). Not always unambiguous musically.

Pitch Bend

MIDI pitch-bend event. Evidence for bend/vibrato, not equal to a symbolic Guitar Pro technique without context.

Channel Pressure

Channel-level aftertouch. Possible expression evidence.

Poly Pressure

Per-note aftertouch. Useful for expression/MPE.

MPE

MIDI Polyphonic Expression — per-note pitch bend/pressure/timbre. Not MVP, but potentially useful for a future expression layer.

MIDI import

Conversion of .mid into the canonical score model, preserving as much evidence as possible.

MIDI export

Conversion of the canonical score model into .mid, built from the master timeline and tracks — not from a random first track.

MIDI roundtrip

Import MIDI → export MIDI → re-import → compare normalized result. An important integration/golden test.

MIDI evidence

Low-level MIDI events from which articulations or expression can be inferred, but which cannot be claimed as symbolic technique.

4. Guitar Pro, tablature, notation formats

Guitar Pro

Tablature formats .gp3, .gp4, .gp5, .gpx, .gp. Important because they carry guitar semantics: strings, frets, techniques, effects.

GP3 / GP4 / GP5

Binary Guitar Pro 3/4/5 formats. MVP import candidates.

GPX

Guitar Pro 6 format — a proprietary container with GPIF/XML-like content. Harder than GP3–GP5.

GP7 / GP8 .gp

Newer archive/zip-like Guitar Pro formats with score.gpif plus extra files. Mark as experimental.

GPIF

XML-like internal representation used by Guitar Pro 6+; can be easier to import than binary parsing.

PyGuitarPro

Python library for GP3/GP4/GP5; usable as a sidecar adapter if pure Rust is immature.

guitarpro crate

Rust crate for Guitar Pro; candidate for a Rust-native GP import pipeline.

alphaTab

Tablature render/parse ecosystem including Guitar Pro; a reference model and possible adapter inspiration.

MusicXML

Open notation interchange format. Possible fallback/interchange, but does not replace Guitar Pro for guitar techniques.

Tab / tablature

Guitar notation by strings and frets. Matters for playability, string/fret movement, position shifts.

String

A guitar string. Stored separately from pitch (one pitch is playable on several strings).

Fret

A guitar fret. With string, defines the physical position of a note.

Tuning

Guitar tuning (standard, drop D, alternate). A first-class model type carried per Track (default Standard E, ADR-0006), the reference that maps pitch ↔ (string, fret) (ADR-0018). Distinct from the coarse corpus tuning string tag.

Guitar technique

A playing technique: hammer-on, pull-off, slide, bend, vibrato, palm mute, tapping, harmonic, etc.

TechniqueSpan

A spanning guitar technique over a tick (later: note) range — slide, legato (hammer-on/pull-off), bend, vibrato, palm-mute, let-ring, tremolo, sweep. Holds a SpanTechnique kind plus TechniqueEvidence. The relational / time-extended half of the technique model; the per-note half is NoteMark (ADR-0018).

Source-of-truth articulation

An articulation from a format that stores it explicitly (e.g. Guitar Pro), as opposed to inferred from MIDI.

Inferred articulation

A technique guessed by heuristics from MIDI evidence. Carries TechniqueEvidence (InferredFromMidi + confidence < 1.0), so it never masquerades as a source-of-truth (Explicit) technique (ADR-0018).

Lossless import

Import without losing important semantics. Possible for much of Guitar Pro if the model is rich enough.

Lossy export

Export losing information (e.g. Guitar Pro techniques → MIDI is almost always lossy).

5. Articulations and guitar techniques

Articulation

Renamed to SpanTechnique (ADR-0018 Slice 2b). The dominant-label projection over a note's marks and spans is deferred until a consumer needs it (none does yet): feature reads marks, complement reads a technique-label set.

NoteMark

A per-note guitar technique that is intrinsic to one note and co-occurs with others: accent, ghost, staccato, dead/muted, natural/pinch harmonic, tap. A note carries a set of marks (NoteMarks, a Copy bitset) replacing the old Option<Articulation>. Evidence-free — provenance lives on spans/positions (ADR-0018).

SpanTechnique

The kind of a TechniqueSpan — a technique that relates notes or covers a range: slide, bend, legato (hammer-on/pull-off), palm-mute, vibrato. The renamed former Articulation enum, without the harmonic variants (those are NoteMarks), so "a span is a harmonic" is unrepresentable (ADR-0018 Slice 2b).

TechniqueEvidence

Provenance on a TechniqueSpan: a TechniqueSource (Explicit = read from a source-of-truth format like Guitar Pro, confidence 1.0; InferredFromMidi = guessed from MIDI evidence, confidence < 1.0) plus the confidence (f64). Keeps inferred techniques from masquerading as fact (ADR-0018). Position evidence is deferred until position inference exists. The import-side sense of evidence reserved by ADR-0017 (distinct from a scoring rationale).

TechniqueSource

Where a technique came from: Explicit (source-of-truth format) or InferredFromMidi (heuristic cue). The source field of TechniqueEvidence (ADR-0018).

NoteId

A lightweight stable note identifier, so a TechniqueSpan can pin specific endpoints (a legato pair, which chord note bends) and survive region regeneration. Part of the target rich note model; phased in after the initial tick-range spans (ADR-0018).

Slide

Sliding between notes/positions. In MIDI only indirectly via pitch bend; in Guitar Pro an explicit effect.

Bend

String bend. A symbolic Guitar Pro technique, or MIDI pitch-bend evidence.

Legato

Connected playing; on guitar often hammer-on/pull-off.

Hammer-on

Next note sounded by a fretting-hand finger strike, no new pick attack.

Pull-off

Next note produced by pulling a finger off the string.

Palm mute

String muting with the palm edge. Important in heavier/prog contexts; usually not stored explicitly in plain MIDI.

Vibrato

Pitch oscillation. MIDI: pitch bend/modulation evidence; Guitar Pro: explicit technique.

Natural harmonic

A natural harmonic. Explicit in Guitar Pro; usually absent in MIDI.

Pinch harmonic

Pick/artificial harmonic. Almost impossible to recover reliably from MIDI without the source.

Tapping

A note sounded by tapping a fretboard. Can matter for swancore. Not stored directly in MIDI.

Tremolo picking

Fast repeated picking. Detectable via dense repeated onsets.

Let ring

Notes ringing over following events. Needs polyphony/voices.

Ghost note

A quiet/muted note. May be velocity/technique-driven; interpret carefully.

Accent

An accented note. May be high velocity in MIDI, but velocity ≠ musical accent.

Grace note

A short auxiliary note before a main note. Needs its own model or an EventGroup.

Tuplet

A rhythmic subdivision off the regular grid (triplets, quintuplets, …).

Strum

A chord stroke across strings with micro-offsets. Needs an EventGroup, not a single chord timestamp.

Arpeggio

A broken chord: chord notes sounded sequentially.

6. Phrase boundary detection

Phrase boundary

A boundary between phrases. May coincide with a pause, cadence, bar boundary, or a change in rhythmic/melodic behavior.

Boundary detector

An algorithm proposing likely phrase boundaries.

Boundary score

A numeric boundary likelihood, e.g. pause + cadence + rhythm_reset + motif_boundary + register_jump + density_change.

BoundaryReason

An explanation of why a boundary was placed (pause, rhythmic reset, register jump, harmonic resolution, …).

Manual override

A user correction of boundaries. Mandatory for the corpus; fully automatic labelling will confidently err.

Pause score

Boundary signal from a long pause or rest.

Cadence score

Completion signal from harmonic/melodic/rhythmic resolution.

Register jump score

Boundary signal from a sharp register jump.

Density change score

Boundary signal from a sharp change in event density.

Motif boundary score

Boundary signal from a motif ending/repeat/change.

Harmonic resolution

A sense of tension resolving to a stable point; may be heuristic when harmonic context is poor.

LBDM

Local Boundary Detection Model. Segmentation by local parameter changes. Inspiration for an explainable heuristic detector.

IDyOM

Information Dynamics of Music — an expectation/surprise model. Not MVP; theoretical reference for predictive boundary cues.

7. Features and analysis

Feature extraction

Extraction of numeric/categorical phrase features: pitch range, density, intervals, syncopation, articulation ratio, etc.

PhraseFeatures

Current griff struct computing basic phrase features. Must be extended.

Pitch range

Min and max note pitch in a phrase.

Velocity range

Min and max velocity.

Note count

Number of notes.

Rest count

Number of rests.

Articulated note count

Number of notes carrying articulation.

Rest ratio

Fraction of rests in a phrase. Useful for boundary detection and generator style.

Interval

Distance between two pitches (melodic or harmonic).

Interval histogram

Distribution of intervals. Useful for similarity and style constraints.

Pitch contour

Shape of pitch motion: up, down, wave, leaps, repeats.

Register

Pitch region (low/mid/high). For guitar, related to fretboard position.

Register movement

Motion between registers. Often significant in swancore.

Onset pattern

The rhythmic pattern of note onsets.

Duration pattern

The pattern of durations.

Syncopation score

A measure of syncopation strength.

Technique ratio

Fraction of notes/spans with a given technique.

Playability

How physically playable a phrase is on guitar.

Fretboard movement

Motion across the fretboard: position shifts, string changes, fret distance. A key swancore-specific feature.

Similarity

Similarity of phrases/motifs; may consider rhythm, contour, intervals, techniques, register, tags.

Distance metric

A distance function between objects. Music rarely needs only one.

Closure (melodic)

The perceptual sense that a phrase is finished rather than broken off (Meyer / Narmour; survey in audit/2026-06-melodic-closure-research.md). In griff it is a scored axis set under the ADR-0017 vocabulary (core/src/closure.rs): internal_continuity (the S4 boundary detector re-used as the generation-side referee), ending_stability (Krumhansl-inspired tiers over the pitch material), final_lengthening, and gap_fill (implication-realization mini-rules), weighted by the uniform closure v1 policy. Ambiguity warning: always the music-cognition term here, never a Rust closure.

Novelty guard

The measure that keeps corpus learning at the schema level: how much of a candidate is a verbatim quote of reference material (core/src/novelty.rs). Compares (interval, normalised IOI) transition sequences of the melodic line — so a quote is caught through transposition and tick-resolution changes — and reports the longest common run plus n-gram overlap. Gives the §8 "Quality score" novelty axis its concrete measure (quote_novelty / ngram_novelty, ADR-0017); the rejection threshold (e.g. quotes longer than 1–2 bars) is the caller's cut, not code.

Gesture statistics (burst/rest)

The distributions that describe burst-and-rest writing without its content (core/src/gesture.rs; melodic-closure note §3.5 — the DGD case): burst length (maximal melodic-line runs between gesture rests), rest length and quarter-grid placement (a rest reads as part of the gesture when metrically predictable, as a hole when not), the share of bursts landing on the line's modal pitch class, and burst-final lengthening (closure-v1 normalisation). A gesture rest is at least one quarter of line silence after a sounded note; sub-quarter holes are phrasing. Persisted per chunk as ChunkMeta.gesture (corpus schema v3); the intensive distributions feed the chunk-similarity edge (§9), and the stats derive a Gesture control (§8) — the S6 constraint input they were measured for.

8. Generation

Generator

A component that creates new phrases, variations, or regions.

Rule-based generator

A generator driven by rules and heuristics. Must precede the neural layer.

Deterministic generator

Same seed/input → same result. Required for tests.

Seed

The RNG seed; needed for reproducibility.

Candidate

One generated phrase variant.

Candidate set

A set of variants for the user or reranker to choose from.

Reranking

Re-sorting candidates by quality score, user preferences, similarity, constraints.

Variation

A modified version of a source phrase or motif.

Continuation

A continuation of a given phrase.

Infilling

Filling a missing/selected span between two contexts.

Regeneration

Re-generating a selected span, usually preserving some context.

Region regeneration

Regenerating a specific TickRange or selection.

Frozen region

A span that must not change during regeneration.

Anchor

An event/note/boundary that must be preserved (e.g. first and last note of a region).

Constraint

A generation constraint: scale, range, rhythm density, max fret distance, preserve contour, allowed techniques.

Rhythm-copy

Strategy: take rhythm from a source, replace pitch material.

Pitch-substitute

Strategy: keep rhythm, replace pitches by rules.

Motif variation

Strategy: keep a recognizable motif shape, change details.

Constrained random walk

A random walk over pitch/fretboard space with constraints, to avoid meaningless output.

Cadence-aware ending

Generating a phrase ending with a sense of completion.

Playability filter

A filter discarding physically awkward or impossible phrases.

Quality score

The aggregate of a quality axis-vector — similarity, novelty, playability, density, user preference, style fit — not a primitive scalar (ADR-0017). The axes are the truth; the aggregate is a derived convenience for sort/UI.

Scored value

The shared output shape Scored<T>: a produced value (candidate, boundary, part) plus its score axes, rationale, and provenance. Replaces ad-hoc { score, reason } shapes so boundary, complement, structure, and DP scores share one form (ADR-0017).

Score axes

The named, normalised per-axis measurements behind a score, carried as labelled data rather than a fixed struct (e.g. complement rhythm_similarity / register_overlap / density_ratio / technique_overlap, a ComplexityProfile, or the DP cost terms). The source of truth; never discarded in favour of the aggregate (ADR-0017).

Score weights

The data-valued policy vector that reduces axes to an aggregate — the surface the feedback layer (S9) tunes. Kept separate from the code that computes axes so weights change without touching scoring (ADR-0013, ADR-0017).

Score rationale

The explainable trace of a score: which axes fired or contributed, which thresholds were crossed (the generalisation of BoundaryReason). The "why". Distinct from evidence, which is reserved for import-side provenance (ADR-0017).

Aggregate score

The derived scalar aggregate(axes, weights) used for sorting and display. Reproducible only relative to (seed, weights-version); ties break by a fixed, documented rule so ordering is total and stable (ADR-0017, extends SPEC §6).

Novelty

How different a candidate is from the source. Balance: too low = copy, too high = noise.

Style fit

How well a candidate matches swancore-first constraints.

Complementary part

A part (part B) generated to accompany an existing part (part A): related to A on chosen musical axes (rhythm, harmony, register, technique, density, contour) and deliberately contrasting on others. Arrangement, not duplication.

ComplementArranger

The rule-based engine that produces a complementary part. A constraint compiler over the S6 generator, not a new generator: it analyses part A, picks a relation mode, derives an S6 request for part B, and validates the pair. Named for the relation, not a fixed part count (S13, ADR-0012).

Complement relation

The typed, multi-axis relation between two parts. Exists in three distinct roles that must not be conflated: spec (input ComplementSpec/relation mode), fact (a mined hyperedge in the graph layer, §9), and provenance (metadata on a produced candidate).

Relation mode

A named complementarity preset chosen for generating part B: rhythm_lock, register_contrast, call_response, support_layer, octave_double, counter_melody.

Part profile

The per-part feature summary ComplementArranger derives from part A: onset/rhythm grid, accent pattern, register band, contour, normalised density, technique multiset, harmonic context. Richer than PhraseFeatures.

Harmonic context

The estimated key of a part — tonic pitch class plus major/natural-minor mode — together with its scale fit: the duration-weighted fraction of notes on that key's scale. Estimated with the Krumhansl–Schmuckler key-finding algorithm (Krumhansl–Kessler profiles over the part's pitch-class histogram). A fact carried by the part profile, not a verdict; fit thresholds are corpus/S9 calibration.

Pair validator

A post-generation check over the (A, B) pair: per-part playability plus harmonic compatibility — no dissonant clashes on coincident onsets, no register mud. Distinct from the single-part playability filter.

Target span

The region of the timeline to fill — a TickRange (or bar count). The physical length of the result; says nothing about the material inside (S14, ADR-0015).

Pattern period

The length of the base repeating idea inside a span (e.g. 1/2 bar, 1 bar, 2 bars), possibly sub-bar. Distinct from target span and from complexity: a short period can carry hard material. None = through-composed (no strong repeat).

Repeatability

How strictly the material repeats across pattern periods: identical copies → high; recurring-but-transformed → medium; always-new → low.

Variation rate

How much repeats mutate (the complement of strict repeatability). High variation with a recognisable period = "A A' A'' A'''".

Loopability

How seamlessly a span can be looped — the smoothness of the wrap-around seam. Distinct from repeatability (internal self-similarity vs seam continuity).

Complexity profile

A vector, not a scalar: rhythmic / pitch / technical / harmonic / playability / structural complexity, each normalised. Orthogonal to length and period — a short loop may be technically hard; a long line may be trivial.

Structure control

The input spec for S14 generation: target span, pattern period, repeatability, variation rate, loopability, complexity profile. Compiled into S6 generation constraints (ADR-0015).

Structure metrics

The measured counterpart of a structure control over a produced or imported span: detected pattern period, repeatability, variation, loopability, structural complexity. Used to rerank candidates and — later — as graph node attributes. Computed by self-similarity / autocorrelation analysis; does not depend on the graph layer or DP/Viterbi (ADR-0015).

Gesture control

The ask counterpart of the measured gesture statistics (§7) — the structure control duality applied to burst/rest writing: burst notes (notes per burst) and rest quarters (minimum gesture-rest length), derivable from a measured corpus chunk (GestureControl::from_stats). Compiled over the S6 generator (generate_gestured, core/src/gesture.rs): plain S6 writes wall-to-wall, then gesture rests are carved deterministically — after every burst notes kept notes, following notes are dropped until at least rest quarters of line silence opens; survivors keep their absolute onsets, so the master timeline is untouched and bursts span barlines. The candidate carries the re-measured gesture statistics as provenance (ask vs is).

9. Graph layer

Graph layer

A graph representation of phrases, motifs, rhythm cells, and transitions.

Node

A graph node: phrase, motif, rhythm cell, or technique pattern.

Edge

A relation between nodes: similarity, transition, harmonic compatibility, or user preference.

Edge weight

The relation weight, used in traversal/generation/reranking.

Chunk similarity (similarity edge)

The first concrete S7 edge (core/src/similarity.rs): per-axis agreement between two corpus chunks over facts already persisted in ChunkMeta — detected pattern period (min/max bar ratio; through-composed pairs agree), repeatability / loopability / structural complexity (1 − |Δ|), tag-set Jaccard, and the five intensive gesture distributions (mean burst / rest length as min/max ratios — two restless chunks agree; rest-grid, modal landing, and final-lengthening shares as 1 − |Δ|) — as named ADR-0017 axes under the uniform similarity v2 policy. The extensive gesture counts are deliberately not axes (a length echo would shadow the style facts). find_similar_chunks is the brute-force query over the edge (no ANN at micro-corpus scale; decisions.log 2026-06-10 AudioMuse entry, idea (a)); measured means structure and gesture, so schema-v1/v2 records cannot sit on the edge until re-curated.

Phrase graph

A graph whose nodes are phrases or phrase chunks.

Motif graph

A graph of motifs and their variations.

Transition graph

A graph of allowed phrase transitions.

Graph traversal

Walking the graph to pick a continuation, variation, or candidate chain.

Recombination

Assembling a new phrase from parts of existing phrases/motifs.

Knowledge graph

The documentation/semantic graph of concepts, files, decisions, stages, and dependencies. Not the runtime phrase graph.

Complement hyperedge

A graph edge linking two phrases/parts by a set of per-axis relations (rhythm, harmony, register, technique, density, contour) at once, not a single similarity weight. The concrete case that makes the graph layer a hypergraph rather than a similarity graph. Generative-first in S13; mined from real two-part corpus material later in the graph layer.

Map vs route

The separation between the hypergraph (the map — what is connected / possible) and traversal (the route — which sequence is best). They must not be conflated; the graph stores musical relations, DP selects a path through them.

DP / Viterbi traversal

Dynamic-programming selection of the optimal candidate sequence across bars, the primary S7 traversal mechanism (ADR-0013). Deterministic by construction (no RNG needed; ties break by a fixed rule), so it satisfies SPEC §6, and it optimises the whole sequence instead of picking the locally-best candidate per bar. Beam search is an approximation for graphs too large for exact DP.

DP state

The running context carried through traversal: current candidate, fretboard position, last technique, energy level (EnergyState), and rhythmic similarity to part A. Kept small so exact DP stays tractable.

Cost function

The inspectable transition cost DP minimises: harmonic_fit + rhythm_complement + style_fit + playability + phrase_continuity − mud_penalty − repetition_penalty − fret_jump_penalty. Exposed as data (weights), because it is the same surface the feedback layer (S9) tunes.

EnergyState

A graph node / DP-state component representing the local energy level of a passage (e.g. verse below chorus). Used to shape the global arc of a generated part.

10. Human-in-the-loop

Human-in-the-loop

The user rates candidates, corrects boundaries, picks good fragments, and thereby steers the system.

Like/dislike

The minimal feedback signal. Used for reranking and the preference profile.

Favorite

A stronger signal than a like: save a candidate as a good example.

Preference profile

A model of user preferences: which features, tags, styles are liked more.

Feedback weight

A feature weight adjusted by user ratings.

Active curation

The user does not just press "generate" but builds a micro-corpus and marks the best results.

Reviewer decision

A human decision on a chunk/candidate: accepted, rejected, needs edit, favorite, boundary corrected.

Relation preference

Learned preference over complement-relation axes (rhythm_similarity, technique_overlap, register_overlap, density_ratio), as opposed to preference over single-phrase features. The feedback layer can weight these once ComplementArranger emits per-axis relation scores.

11. UI, CLI, plugin

CLI

Command Line Interface. griff already has import, inspect, export. The CLI stays the first debugging surface.

griff import

Reads a file and prints a short summary.

griff inspect

Detailed bar-by-bar view.

griff export

Roundtrip/export.

Preview app

A standalone app for viewing phrases, candidates, boundaries, graph, and feedback. Comes before CLAP.

View-model

A pure, renderer-agnostic projection of a Score for display (e.g. PianoRollView, Analysis). No rendering, no I/O. The shared input every frontend draws from. See ADR-0016.

UI core

The shared, frontend-independent layers behind every griff GUI: the view-model, the interaction core (Viewport/Intent), and the scene. Frontends (ratatui, egui) are thin adapters over it. See ADR-0016.

Viewport

The interactive UI-core state: scroll, zoom, pitch offset, section selection, playback position, inspector toggle. Renderer-agnostic; mutated only by the reducer. See ADR-0016.

Intent

A semantic, device-independent UI action (e.g. TogglePlay, ScrollRight, NextSection). Frontends translate raw input (keys, mouse) into intents; the reducer Viewport::apply is the only place that interprets them. See ADR-0016.

Scene

A resolved, renderer-agnostic placement of a frame: a grid of placed cells (note blocks, bar/section lines, playhead, section band, gutter labels) in abstract cells with semantic style. Produced by resolve(view, analysis, viewport, size); each renderer maps it to glyphs/pixels. Carries placement only — toolkit-specific text (header, footer, inspector) is rendered per-frontend from the same view-model, never resolved into the scene. See ADR-0016.

Renderer

A thin frontend backend (ratatui or egui) that maps a Scene to its toolkit and raw input to Intents. Holds no interaction logic and no layout math. See ADR-0016.

egui

A Rust immediate-mode GUI library. Candidate for the preview app.

eframe

A framework around egui for desktop apps.

CLAP

CLever Audio Plugin API. The target plugin format for griff at S10.

NIH-plug

A Rust framework for VST3/CLAP plugins. Candidate for the CLAP MVP.

MIDI-out plugin

A plugin that outputs MIDI events into the DAW rather than synthesizing audio.

DAW

Digital Audio Workstation (Ableton, Reaper, Logic, Bitwig, …).

Host

The DAW or app loading the plugin.

Host transport

Tempo, play/stop, timeline position, bar/beat info from the DAW host.

Drag-and-drop MIDI

Dragging a generated MIDI fragment from the plugin/preview into the DAW.

Parameter

A configurable plugin parameter: density, variation amount, style mode, seed, phrase length, etc.

12. Rust and workspace

Rust workspace

A group of crates in one repo. In griff: core, cli, plugin.

crate

A Rust package/library/binary unit.

griff-core

Core crate: musical model, import/export, slicing, features, generation.

griff-cli

CLI crate: user commands and a test debugging surface.

griff-plugin

Plugin crate: empty until S10.

Cargo.toml

Rust crate/workspace manifest: dependencies, package metadata, profiles, lints.

rust-toolchain.toml

Pins the toolchain and components: stable, rustfmt, clippy.

MSRV

Minimum Supported Rust Version. griff targets Rust 1.92 — the floor egui / eframe 0.34 impose on the cockpit, verified by a CI job that builds the workspace on it. Do not use newer syntax/features without a decision.

clippy

The Rust linter, configured strictly in griff.

rustfmt

The Rust code formatter.

unsafe_code = forbid

Unsafe code is forbidden. A key architectural rule.

lint policy

The code-quality rule set. griff has a strict workspace-wide policy.

thiserror

Rust crate for ergonomic error types.

clap

Rust crate for CLI arguments.

Result

Rust success/error type. All fallible operations return errors, not panic.

Option

Rust optional-value type (e.g. optional articulation or track name).

newtype

A wrapper around a primitive: Pitch(u8), Ticks(u32). Provides type safety.

13. TDD and testing

TDD

Test-Driven Development: red → green → refactor. Behavior tests first, code second.

Red

A test fails because the feature is not implemented or a bug is confirmed.

Green

A minimal implementation makes the test pass.

Refactor

Improving structure without changing behavior.

Characterization test

A test that pins existing/legacy behavior. Required before refactoring.

Golden test

A test against a reference file/output.

Snapshot test

A test comparing output to a stored snapshot. Good for CLI output, debug dumps, normalized score dumps.

Approval test

Like snapshot/golden: a human approves the reference result.

Unit test

A test of a small function/module.

Integration test

A test of several components together: import → model → export, CLI → output, GP file → score.

Property-based test

Testing properties over generated inputs (e.g. duration(a+b) == duration(a) + duration(b), roundtrip invariants).

proptest

Rust crate for property-based testing.

insta

Rust crate for snapshot testing.

cargo-nextest

A fast test runner for a Rust workspace.

cargo-mutants

Mutation testing for Rust: checks whether tests catch injected bugs.

Mutation testing

Test-quality check via small code mutations. If tests do not fail, they are weak.

Fuzz testing

Feeding many automatically generated inputs to a target to find panics, hangs, unbounded allocation, or invalid internal models. In griff a mandatory robustness/security layer for format adapters and selected core transforms — never a correctness proof (ADR-0010, fuzzing.md).

Fuzz target

A small entry point a fuzzer drives, with an oracle. In griff: fuzz/fuzz_targets/*.rs (e.g. midi_import, midi_roundtrip).

cargo-fuzz

The standard Rust fuzzing harness around libFuzzer. griff's chosen tool; lives in the isolated nightly fuzz/ crate.

libfuzzer-sys

Rust bindings exposing the libFuzzer engine; the fuzz_target! macro crate.

arbitrary

Rust crate turning raw bytes into typed structures, for structure-aware fuzzing (canonical Score, generation requests) rather than only raw bytes.

Structure-aware fuzzing

Fuzzing typed inputs (via arbitrary) instead of raw byte slices. Used for score_projection, phrase_boundary, generation targets.

Fuzz corpus

The committed input set for a target: fuzz/corpus/<target>/.

Seed corpus

Hand-picked starting inputs (minimal valid files) that bootstrap a target.

Regression corpus

Minimized crash/hang inputs committed permanently so a fixed bug stays fixed. The first one is hang_ppqn1_eighth.mid (finding F-001).

Fuzz oracle

The pass/fail contract for a target: no panic/hang/unbounded alloc, typed error xor success, plus target-specific normalized invariants.

Hang

Input that makes the target not return (infinite loop / pathological work). Detected by libFuzzer -timeout. Distinct from a panic.

Uncontrolled allocation

Input that drives unbounded memory growth (e.g. zip bomb, degenerate loop). Bounded by libFuzzer -rss_limit_mb / -malloc_limit_mb.

cargo-llvm-cov

Code coverage tool for Rust. Coverage ≠ test quality.

Test fixture

A file or object used by a test (minimal MIDI fixture, GP5 fixture, score JSON dump).

Corpus fixture

A minimal corpus slice for tests, not the full corpus.

Smoke test

A fast "the system starts and does not crash" test.

Regression test

A test for a previously found bug.

Roundtrip test

A test of import → export → import, or format A → canonical → format A.

Invariant

A property that must always hold (e.g. TickRange.start <= TickRange.end).

Test oracle

The source of truth for the expected result: snapshot, manual labelling, fixture, formal property.

CI gate

A condition required to accept a PR: tests green, clippy green, format green, snapshots reviewed.

14. Documentation and agent development

AGENTS.md

Instruction file for AI agents in the repo. Short, concrete, links to docs.

CLAUDE.md

Agent instruction file for Claude-style tooling. May alias/bridge to AGENTS.md.

SPEC.md

The main project spec: what griff does, does not do, and which architectural rules are mandatory.

ADR

Architecture Decision Record: a short doc fixing an important decision — context, decision, consequences.

Stage doc

A per-stage doc: goal, tasks, tests, acceptance criteria, risks.

Architecture doc

A doc about the model, dataflow, boundaries, modules.

Corpus schema doc

A doc describing the corpus annotation format.

Agent task

An LLM-agent task with context, files to touch, constraints, tests to run, definition of done.

Definition of Done

Task completion criteria. For griff: tests green, docs updated, loss report considered, no hidden behavior changes.

Prompt rot

When long instructions go stale and start to harm. Cured by short docs, ADRs, stage files.

Context window

The limited text an LLM can hold in a request. Hence a glossary, not an endless scroll.

Knowledge base

The set of docs, glossary, ADRs, specs, and stage files an agent relies on.

Knowledge graph documentation

Documentation linking terms, decisions, stages, and modules. Distinct from the runtime phrase graph.

15. Quality, risks, constraints

Technical debt

Debt in code/architecture that speeds up now and slows down later.

Architecture risk

Risk that the chosen model will not survive future use cases (e.g. linear Event::Note/Rest vs polyphony/chords).

Format risk

Risk that an external format stores data differently or richer than the internal model.

Semantic loss

Loss of meaning during conversion (e.g. Guitar Pro palm mute → MIDI velocity is not full preservation).

Backward compatibility

Preserving old behavior/API while changing the architecture.

Migration path

A plan to move from old to new model without a total rewrite.

Feature flag

A switch for experimental functionality (e.g. GP7/GP8 or SMPTE support).

Experimental support

A feature exists, but API/behavior stability is not promised.

Stable support

A feature covered by tests, docs, fixtures, and acceptance criteria.

Fail-fast

Fail quickly and explicitly on unsupported input instead of silently corrupting data.

Graceful degradation

Partial support with a warning/loss report when full support is impossible.

Observability

The ability to understand what happened: debug dumps, summaries, import warnings, loss reports.

Debug dump

A normalized text/JSON dump of the internal model for tests and analysis.

Normalized dump

A dump without unstable details (absolute paths, random ids, map iteration order). Needed for snapshot tests.

16. Quick map: term → where it lives

  • Score, MasterBar, Track, Voice, EventGroup → griff-core, future canonical model.
  • Pitch, Ticks, Velocity, Tempo, TimeSignature → scalar musical types.
  • MIDI, SMF, PPQN, Tempo map → format adapter + transport.
  • Guitar Pro, GP3/4/5, GPX, GPIF → format adapter + source metadata.
  • Phrase, Motif, RhythmCell → analysis, corpus, generation.
  • Boundary score, BoundaryReason → phrase boundary detection.
  • Feature extraction, Similarity, Playability → analysis/generator/reranking.
  • Candidate, Variation, Regeneration, Frozen region, Anchor → generation workflows.
  • Graph layer, Phrase graph, Motif graph → S7+ recombination.
  • Like/dislike, Preference profile → S9 feedback layer.
  • CLAP, NIH-plug, Host transport → S10 plugin.
  • TDD, Snapshot, Property test, Mutation testing → development process.
  • Fuzz testing, cargo-fuzz, Fuzz corpus, Fuzz oracle → robustness/security layer (ADR-0010, fuzzing.md), isolated fuzz/.
  • ADR, SPEC.md, AGENTS.md → documentation/process.

17. Rules for the LLM agent

  1. Do not use MIDI as the internal model. MIDI is an adapter boundary.
  2. Do not treat Event::Note/Rest as the final guitar model.
  3. Do not promise recovery of Guitar Pro articulations from plain MIDI without confidence/evidence.
  4. Do not add CLAP before the core model and format adapters are stable.
  5. Do not add neural generation before corpus, features, and a rule-based baseline.
  6. Every new format adapter must produce a loss report.
  7. Every refactor must start with characterization tests.
  8. Every new generation must be deterministic under a fixed seed.
  9. Every stage task must have tests, docs, and acceptance criteria.
  10. If a term is unclear, extend this glossary rather than spawning synonyms in code.

18. Preferred naming

Use these as defaults until an ADR decides otherwise:

Score, MasterBar, Track, Voice, EventGroup, AtomEvent, TechniqueSpan, SourceMeta, ImportWarning, LossReport, PhraseBoundary, BoundaryReason, BoundaryScore, PhraseChunk, FeatureVector, GenerationRequest, GenerationCandidate, GenerationSeed, RegenerationRegion, FrozenRegion, AnchorPoint, PreferenceProfile, Scored, ScoreAxes, ScoreWeights, Rationale (ADR-0017), FretboardPosition, Tuning, NoteMark, SpanTechnique, TechniqueEvidence, NoteId (ADR-0018).

19. Terms to avoid or use carefully

AI magic

Not a plan. A neural net does not replace the data model, corpus, tests, and generator.

Works fine

Banned as self-soothing. If it "works fine", show tests, fixtures, and acceptance criteria.

Just a quick hack

A danger sign. Spikes/prototypes are allowed but must be marked as spikes and not dragged into production core without cleanup.

MIDI articulation

Dangerous term. Prefer MIDI expression evidence or inferred articulation from MIDI evidence.

Evidence (in scoring)

Do not use "evidence" for a scoring rationale. "Evidence" is reserved for import-side articulation provenance (why a technique is believed — MIDI / Guitar Pro, §3 / §5). For "why this score" use rationale; for output metadata use provenance (ADR-0017).

Guitar Pro support

Always qualify: GP3/4/5, GPX/GP6, GP7/GP8, read-only or export, stable or experimental.

Polyphony support

Always qualify: simultaneous notes, voices, chords, overlapping notes, let-ring, strum timing.

20. Definition of Done for glossary changes

A glossary.md change is done if:

  • the new term has a short definition;
  • it states how the term is used in griff;
  • if ambiguous, a warning is added;
  • if it replaces an old name, the preferred name is stated;
  • agent/stage docs do not use contradicting definitions.