| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Termtab.Notation.Staff
Description
Pure music-notation helpers shared by the text staff widget (Termtab.UI.Widgets.Notation) and the rasterized image renderer (Termtab.Graphics.Notation): mapping pitches to treble-clef staff positions and durations to SMuFL glyph code points.
Staff positions are integers where 0 = E4 (bottom line) and 8 = F5 (top line); even positions are lines, odd positions are spaces. Positions below 0 / above 8 are ledger territory.
Synopsis
- pitchToStaffPos :: Instrument -> Pitch -> Int
- isStaffLine :: Int -> Bool
- noteheadGlyph :: Duration -> Char
- restGlyph :: Duration -> Char
- gClefGlyph :: Char
Documentation
pitchToStaffPos :: Instrument -> Pitch -> Int Source #
Convert a MIDI pitch to a treble-clef staff position. Guitar/bass are transposed up an octave (standard tab convention). Position 0 = E4 (bottom line), 8 = F5 (top line).
Every chromatic (sharp/flat) pitch class maps to the same staff position
as the natural note just below it (e.g. both C and C# land on
naturalPos 0) — this renderer draws no accidentals, so a sharped note is
visually indistinguishable on the staff from its natural neighbor.
isStaffLine :: Int -> Bool Source #
Is this staff position a line (as opposed to a space)?
noteheadGlyph :: Duration -> Char Source #
SMuFL notehead code point for a duration.
gClefGlyph :: Char Source #
SMuFL G (treble) clef.