Universal Music Theory Library - v0.12.0
    Preparing search index...

    Function freqToMidiPitchBend

    • Converts a frequency to the closest valid MIDI note and the pitch bend offset in cents. Useful for microtonal playback via standard MIDI.

      Parameters

      • freq: number
      • baseA4: number = 440

      Returns { centsOffset: number; note: number }

      • centsOffset: number

        Distance from that note, in cents, -50 to 50.

      • note: number

        Nearest MIDI note number (not clamped to 0-127).