UNPKG

shimi

Version:

A JS framework for building complex MIDI applications

59 lines (58 loc) 2.59 kB
import Chord from './Chord'; import Range from './Range'; /** * ChordProgressionChord represents a chord to be played within a progression, specifying the start and end time of the chord. * * @category Chords & Scales */ export declare class ChordProgressionChord extends Range { /** Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable. */ get typeName(): string; /** The chord to be played at a specific point in the progression. */ get chord(): Chord; set chord(value: Chord); private _chord; constructor(start: number, duration: number, chord: Chord); } /** * The ChordProgression class reppresents a sequence of chords that play one after another. * * @category Chords & Scales */ export default class ChordProgression extends Range { /** Returns the name of this type. This can be used rather than instanceof which is sometimes unreliable. */ get typeName(): string; /** * The collection of chords that the progression contains. */ chords: ChordProgressionChord[]; constructor(duration: number); /** * Add a new chord to the progression. If the new chord overlaps or entirely contains existing chords within the progression, then those chords will be shrunk down, or fully removed to make room for the new chord. * @param start The start beat of the chord within the context of the progression * @param duration The beat duration of the chord * @param chord The chord itself that is to be added * @returns Returns the ChordProgression instance, to allow for chained operations */ addChord(start: number, duration: number, chord: Chord): ChordProgression; /** * Removes all chords from the progression that match the passed in criteria * @param condition The rule for which chords to remove */ removeChords(condition: (cpc: ChordProgressionChord) => boolean): void; /** * Returns a collection of all the chords that overlap with the passed in range. * * If rangeEnd < rangeStart, then it returns all chords which end after rangeStart, or begin before rangeEnd. * @param rangeStart * @param rangeEnd * @returns */ getChordsInRange(rangeStart: number, rangeEnd: number): Array<ChordProgressionChord>; /** * Returns the chord that occurs at the given point in time within the chord progression. * @param beat The beat of the chord, relative to the start of the chord progression. * @returns */ getChordAt(beat: number): ChordProgressionChord; }