Class ClipNote

ClipNote represents a note to be played within a clip, specifying the start and end time of the note within the clip, as well as all the information like pitch, velocity, channel, etc. needed to play the note.

Hierarchy

  • Range

    Hierarchy

    • ClipNote

Constructors

  • Parameters

    • start: number

      What beat within the clip that the note starts on.

    • duration: number

      How many beats the note lasts.

    • 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 | ITween

      The note's velocity, valid values range from 0 - 127, or a function that maps beats to values.

    • channel: number = null

      Which channel to play the note on, valid values range from 0 - 15, or null to allow whatever is playing the clip to decide.

    • ref: string = null

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

    Returns ClipNote

Properties

ref: string

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

Accessors

  • get channel(): number
  • Which channel to play the note on, valid values range from 0 - 15, or null to allow whatever is playing the clip to decide.

    Returns number

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

    • value: number

    Returns void

  • get duration(): number
  • The difference between the start and end values.

    Attempts to set this to a negative value will result in an error being thrown.

    Returns number

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

    • value: number

    Returns void

  • get end(): number
  • The value which the range ends at.

    Attempts to set this to a value less than start will result in an error being thrown.

    Returns number

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

    • value: number

    Returns void

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

    Returns number

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

    • value: number

    Returns void

  • get start(): number
  • The value which the range starts at.

    Attempts to set this to a value greater than end will result in an error being thrown.

    Returns number

  • set start(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 | ITween
  • The note's velocity, valid values range from 0 - 127, or an ITween object to allow for values that change over time.

    An example of using a tween for velocity to make a note swell in volume as it's played: clipNote.velocity = Tween.linear(1, 127)

    Returns number | ITween

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

    Returns void

Methods

  • Returns true if the passed in point is greater than or equal to range start, and less than or equal to range end.

    Returns

    Parameters

    • point: number

      The point value to determine whether it's within the range.

    Returns boolean

  • The createNote method is primarily intended for use by the ClipPlayer to generate a new Note object from the ClipNote.

    Returns

    Parameters

    • channel: number

      This is the preferred channel to use if the ClipNote doesn't specify one.

    • percent: number

      How far into the note we should start from

    Returns Note

  • Returns a copy of this ClipNote object

    Returns ClipNote

  • Accepts a value and returns what percentage of the way into the range that the value is.

    The returned value can be negative, or greater than 100%, if the passed in value is less than the range start, or greater than the range end.

    Returns

    Parameters

    • value: number

      The value to compare against the range.

    Returns number

  • Used by the library for the custom serialization of Clips

    Returns any

  • Takes an object parsed from JSON ClipNote data to load into an actual clip note instance.

    Parameters

    • clipNoteData: any

    Returns ClipNote

Generated using TypeDoc