Class Arpeggio

The Shimi Arpeggio object can contain a collection of ArpeggioNote objects.

Once an Arpeggio has been defined, it can be passed into an Arpeggiator object to be played.

Example arpeggio definition:

 const arp = new shimi.Arpeggio(4);   //The arpeggio is defined for 4 beats, after that it will repeat
arp.notes.push(
new shimi.ArpeggioNote(0, 1, c => c.getPitch(0), 80),
new shimi.ArpeggioNote(1, 1, c => c.getPitch(2), 80),
new shimi.ArpeggioNote(2, 1, c => c.getPitch(1), 80),
new shimi.ArpeggioNote(3, 1, c => c.getPitch(2), 80)
);

Hierarchy

  • Range

    Hierarchy

    • Arpeggio

Constructors

  • Parameters

    • duration: number

      How many beats the arpeggio pattern will span before repeating.

    Returns Arpeggio

Properties

notes: ArpeggioNote[] = []

The collection of notes that make up the arpeggio shape.

Accessors

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

Methods

  • Adds a note to the arpeggio. The start parameter can take an array of values, allowing for multiple notes to be added at once for the same pitch.

    Returns

    Returns the Arpeggio object which the note(s) is being added to.

    Parameters

    • start: number | number[]

      What beat within the arpeggio that the note starts on. Can take an array of multiple note starts

    • duration: number

      How many beats the note lasts

    • pitch: ((c: Chord) => number)

      A function which takes in a chord object as a parameter, and should return a MIDI pitch value (valid values range from 0 - 127). The most common way to use this is something like c => c.getPitch(0)

        • (c: Chord): number
        • Parameters

          Returns number

    • velocity: number | ITween

      The note's velocity, valid values range from 0 - 127

    • channel: number = null

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

    Returns Arpeggio

  • 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

  • Mainly intended for use by the Arpeggiator. Returns the collection of ArpeggioNote objects which end within the given beat range.

    Returns

    Parameters

    • start: number

      The beat to start searching from.

    • end: number

      The beat to end the search at.

    Returns ArpeggioNote[]

  • Mainly intended for use by the Arpeggiator. Returns the collection of ArpeggioNote objects which start within the given beat range.

    Returns

    Parameters

    • start: number

      The beat to start searching from.

    • end: number

      The beat to end the search at.

    Returns ArpeggioNote[]

  • 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

Generated using TypeDoc