Options
All
  • Public
  • Public/Protected
  • All
Menu

Allows the audio playback of notes

Hierarchy

  • SynthInstrument

Index

Constructors

constructor

  • new SynthInstrument(gridWidth: number, gridHeight: number, noteLength: number, options?: RecursivePartial<SynthOptions>, filterOptions?: Partial<FilterOptions>): SynthInstrument
  • Creates a synth instrument

    Parameters

    • gridWidth: number

      The width of the grid, in tiles

    • gridHeight: number

      The height of the grid, in tiles

    • noteLength: number
    • Optional options: RecursivePartial<SynthOptions>
    • Optional filterOptions: Partial<FilterOptions>

    Returns SynthInstrument

Properties

Private currentPlayer

currentPlayer: number = 0

Private destroyed

destroyed: boolean = false

Private gridHeight

gridHeight: number

Private gridWidth

gridWidth: number

Private noteLength

noteLength: number

Private noteOffset

noteOffset: number

Private notes

notes: Map<number, { x: number; y: number }>

Private numVoices

numVoices: number

Private players

players: Player[]

Private polyphony

polyphony: number[]

Private scale

scale: string[]

Methods

clearNotes

  • clearNotes(): void

dispose

  • dispose(): void

getPlayheadX

  • getPlayheadX(): number
  • Get the x position on the grid where the playhead currently is

    Returns number

    The x position

scheduleNote

  • scheduleNote(gridX: number, gridY: number): number
  • Schedules a note at an (x, y) grid coordinate to automatically play at the appropriate time and pitch

    Parameters

    • gridX: number

      The x position of the note, in grid tiles

    • gridY: number

      The y position of the note, in grid tiles

    Returns number

    The id of the note that's been scheduled, for use with unscheduleNote()

unscheduleNote

  • unscheduleNote(id: number): void
  • Unschedules a note so that it will no longer play

    Parameters

    • id: number

      The id of the note to unschedule

    Returns void

Generated using TypeDoc