Class Note

The Note class models a single musical note which can be started and stopped, to be played at a specific pitch & velocity, on a specific channel.

Hierarchy

  • Note

Constructors

Properties

Accessors

Methods

Constructors

  • Parameters

    • pitch: string | number

      The MIDI pitch of the note, valid values range from 0 - 127. Can also take pitch names, see the pitch method for more information.

    • velocity: number

      The note's velocity (loudness), valid values range from 0 - 127.

    • channel: number

      Which channel should the note play on, valid values range from 0 - 15.

    • Optional ref: string

      Provides way of identifying notes so they can be easily retrieved later.

    Returns Note

Properties

onTracker: PropertyTracker<boolean>

Tracks changes to whether the note is playing.

By default the state is on and dirty.

ref: string

Provides way of identifying notes so they can be easily retrieved later.

velocityTracker: PropertyTracker<number>

Tracks changes to the note velocity.

Accessors

  • get channel(): number
  • Which channel should the note play on, valid values range from 0 - 15.

    WARNING! Even though the channel value can be set at any time, you should avoid setting it once the note has already started being played.

    Returns number

  • set channel(value: number): void
  • Parameters

    • value: number

    Returns void

  • get on(): boolean
  • Is the note playing.

    Returns boolean

  • set on(value: boolean): void
  • Parameters

    • value: boolean

    Returns void

  • get pitch(): number
  • The MIDI pitch of the note, valid values range from 0 - 127.

    WARNING! Even though the pitch value can be set at any time, you should avoid setting it once the note has already started being played.

    Returns number

  • set pitch(value: number): void
  • Parameters

    • value: number

    Returns void

  • get typeName(): string
  • Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable.

    Returns string

  • get velocity(): number
  • The note's velocity (loudness), valid values range from 0 - 127. The setter for this rounds the value to the nearest integer so that note velocity tweening will not recognise tiny marginal changes and send out unnecessary aftertouch messages.

    Returns number

  • set velocity(value: number): void
  • Parameters

    • value: number

    Returns void

Methods

  • Sets on = true, returns whether this changed the note's state.

    Returns boolean

  • Sets on = false, returns whether this changed the note's state.

    Returns boolean

Generated using TypeDoc