Arabic Maqām Network - TypeScript Library Documentation - v0.1.0
    Preparing search index...
    • Converts Roman numerals to numbers for parsing pattern notes in playSequence.

      When playing musical patterns, notes can be specified as Roman numerals (I, II, III, etc.) representing scale degrees. This function converts them to numbers so we can find the correct pitch in the scale. Supports + and - prefixes for octave shifts.

      Used in sound-context.tsx playSequence function to parse pattern note degrees like "V" → 5th scale degree, "+II" → 2nd degree in higher octave.

      Parameters

      • r: string

        Roman numeral (I-XII), optionally prefixed with + or -

      Returns number

      Number 1-12, or 0 if invalid

      romanToNumber("V") // 5 (fifth scale degree)
      romanToNumber("+IV") // 4 (fourth degree, higher octave)
      romanToNumber("-II") // 2 (second degree, lower octave)