OpenSheetMusicDisplay
    Preparing search index...

    Class BrailleOctaveTracker

    Tracks the current octave context and determines when octave marks are needed in braille music output.

    Rules from Music Braille Code 2015, Par. 3.2:

    • 3.2.1: Octave mark REQUIRED for first note of a braille line, and after numeric indicators
    • 3.2.2(a): NOT marked if interval from previous note is less than a 4th (unison, 2nd, 3rd)
    • 3.2.2(b): ALWAYS marked if interval is greater than a 5th (6th or more)
    • 3.2.2(c): For interval of a 4th or 5th: ONLY marked if the note is in a different octave
    Index

    Constructors

    Methods

    • Determine if an octave mark is needed for the given pitch, and return the appropriate braille octave mark string. Returns empty string if no mark is needed.

      Also updates internal state to track the current pitch for future comparisons.

      Parameters

      • pitch: Pitch

        The pitch of the current note

      Returns string

      The braille octave mark string, or empty string if not needed

    • Calculate the diatonic interval (in scale steps) between two pitches. A unison = 1, a second = 2, a third = 3, a fourth = 4, etc. This counts letter names, not semitones.

      Parameters

      • from: Pitch

        The starting pitch

      • to: Pitch

        The target pitch

      Returns number

      The diatonic interval (1 = unison, 2 = second, etc.)