Chord Object

Updated 3 years ago
This page shows old instructions for MuseScore 1.
For MuseScore 4 users, see Chord Object.

This documentation applies to plugins for 1.x only!


Documentation for 2.x+ is built into the Plugin Creator of Musescore.

( ⇒ In Musescore press Ctrl+Shift+P, then F1 to bring it up. )


Click here for Documentation for 3.x



Represents a constituent of a voice and is made of notes (opposed to Rest, which is silent): voices are made of chords and staves are made of voices. A Chord may contain one or more Notes; all the Notes of a Chord start and end at the same time.

A new Chord can be created with:
  chord = new Chord();
or
  chord = new Chord(score);
where score is a Score Object .

The Chord existing at a given time of a given voice of a given staff of a score can be obtained by moving a Cursor to the needed staff / voice / time and using:

   if ( cursor.isChord() )
      chord = cursor.chord();

See also:

Cursor Object , Harmony Object , Note Object , Rest Object , Score Object .

Properties

Name Type Description
noStem boolean whether the chord has a stem or not. The chord needs to be retrieved from a cursor first
notes integer number of notes in the chord (read-only)
tickLen integer length of the notes in the chord (all notes of a chord have the same length); expressed in conventional units (see Tick Length values ).
type integer type of note(s) (read-only):
  0: normal
  1: acciaccatura
  2: appoggiatura
  3: grace 1/4
  4: grace1/16
  5: grace 1/32

Methods

addHarmony(Harmony harmony)

Add the Harmony harmony to the chord.

addNote(Note note)

Add Note note to the chord.

Note note(integer index)

Return Note at index index.

removeNote(integer index)

Remove from chord the index-th Note.

Note topNote()

Return topmost Note of chord (Note at index notes - 1).