Arabic Maqām Network - TypeScript Library Documentation - v0.1.0
    Preparing search index...
    • Automatically detects the format of pitch class data values from an array of string values.

      This function analyzes pitch class data values to determine its format, enabling automatic parsing and conversion. It's essential for import workflows where the data format might not be explicitly specified.

      The detection logic follows this priority:

      1. Fraction patterns (e.g., "3/2", "4:3")
      2. Cents values (ascending numbers < 1200)
      3. Decimal ratios (ascending numbers 1.0-2.0)
      4. String lengths (descending numbers)

      Parameters

      • values: string[]

        Array of pitch class values as strings

      Returns "fraction" | "decimalRatio" | "cents" | "stringLength" | "unknown"

      The detected format type or "unknown" if indeterminate

      detectPitchClassType(["1/1", "9/8", "5/4", "4/3"]) // Returns "fraction"
      
      detectPitchClassType(["0", "204", "386", "498"]) // Returns "cents"
      
      detectPitchClassType(["1.0", "1.125", "1.25", "1.333"]) // Returns "decimalRatio"
      
      detectPitchClassType(["10000", "9600", "8700", "7000"]) // Returns "stringLength"