Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

clamp

  • clamp(min: number, max: number, v: number): number
  • Parameters

    • min: number
    • max: number
    • v: number

    Returns number

dbToGain

  • dbToGain(db: number): number

Const f2m

  • f2m(hz: number): number
  • Convert a frequency to a midi note number, assuming 69=A5=440hz. The output is not rounded to an integer, so use Math.round on the output if you need an integer note number.

    Parameters

    • hz: number

      frequency in hz

    Returns number

    midi note number

gainToDb

  • gainToDb(gain: number): number

Const m2f

  • m2f(midiNote: number): number
  • Convert a midi note number to fundamental frequency in hz. Equal temperment.

    Parameters

    • midiNote: number

    Returns number

    fundamental frequency in hz

midiVelocityToDbfs

  • midiVelocityToDbfs(v: number, min?: number, max?: number): number
  • Parameters

    • v: number
    • min: number = -60
    • max: number = 6

    Returns number

Const numberToMidiNote

  • numberToMidiNote(note: number): { note: number; type: string }
  • Parameters

    • note: number

    Returns { note: number; type: string }

    • note: number
    • type: string

range

  • range(start: number, end: number): number[]
  • Create an array of integers from start (inclusive) to end (exclusive). If only a single argument is passed, create an array from 0 (inclusive) to start (exclusive).

    Works with negative numbers, and counts backwards if needed.

    Parameters

    • start: number
    • end: number

    Returns number[]

Const valueToMidiNoteNumber

  • valueToMidiNoteNumber(value: string | number): any

Const valueToWholeNotes

  • valueToWholeNotes(value: string | number): any
  • Convert a string or number to a number of whole notes.

    Parameters

    • value: string | number

      input value can be 'quarter' or '1/4' or 0.25

    Returns any

    • A duration in whole notes

velocityNumberToDynamic

  • velocityNumberToDynamic(velocity: number): { dbfs: number; intensity: number; v: number }
  • Parameters

    • velocity: number

    Returns { dbfs: number; intensity: number; v: number }

    • dbfs: number
    • intensity: number
    • v: number