Elements Reference

MuseScore represents musical notation using a hierarchy of elements. This document describes the available element types and their properties.

Source Files

  • src/engraving/api/v1/elements.h
  • src/engraving/api/v1/qmlpluginapi.h (enumerations)

Creating Elements

// Create a new element var element = newElement(Element.STAFF_TEXT); // Set properties element.text = "Hello"; // Add to score via cursor cursor.add(element);

Element Types (Element.*)

Note-Related Elements

Element TypeDescription
Element.NOTEA single note
Element.CHORDA chord (contains notes)
Element.RESTA rest
Element.NOTEDOTDot on a note/rest
Element.STEMNote stem
Element.HOOKFlag on stem
Element.BEAMBeam connecting notes
Element.TUPLETTuplet grouping
Element.ACCIDENTALAccidental sign

Text Elements

Element TypeDescription
Element.TEXTGeneric text
Element.STAFF_TEXTText attached to staff
Element.SYSTEM_TEXTText attached to system
Element.REHEARSAL_MARKRehearsal mark
Element.TEMPO_TEXTTempo marking
Element.LYRICSLyrics
Element.FIGURED_BASSFigured bass
Element.HARMONYChord symbol
Element.FINGERINGFingering
Element.INSTRUMENT_NAMEInstrument name
Element.DYNAMICDynamic marking
Element.EXPRESSIONExpression text
Element.STICKINGSticking notation

Lines and Spanners

Element TypeDescription
Element.SLURSlur
Element.TIETie
Element.HAIRPINCrescendo/diminuendo hairpin
Element.OTTAVAOttava line
Element.PEDALPedal marking
Element.TRILLTrill line
Element.VIBRATOVibrato line
Element.GLISSANDOGlissando
Element.VOLTAVolta bracket
Element.TEXTLINEGeneric text line
Element.NOTELINENote-anchored line
Element.LET_RINGLet ring line
Element.PALM_MUTEPalm mute line
Element.LAISSEZ_VIBLaissez vibrer

Articulations and Ornaments

Element TypeDescription
Element.ARTICULATIONArticulation mark
Element.ORNAMENTOrnament
Element.FERMATAFermata
Element.ARPEGGIOArpeggio
Element.TREMOLOTremolo
Element.CHORDLINEChord line (fall, doit, etc.)

Clefs, Key, Time Signatures

Element TypeDescription
Element.CLEFClef
Element.KEYSIGKey signature
Element.TIMESIGTime signature

Barlines and Structure

Element TypeDescription
Element.BAR_LINEBarline
Element.MEASUREMeasure
Element.SEGMENTSegment within measure
Element.SYSTEMSystem (line of music)
Element.PAGEPage
Element.SPACERSpacer element

Frames

Element TypeDescription
Element.HBOXHorizontal frame
Element.VBOXVertical frame
Element.TBOXText frame
Element.FBOXFretboard diagram frame

Guitar/Fretted Elements

Element TypeDescription
Element.FRET_DIAGRAMFretboard diagram
Element.GUITAR_BENDGuitar bend
Element.BENDBend
Element.FRETBOARD_DIAGRAMFretboard diagram

Layout Elements

Element TypeDescription
Element.LAYOUT_BREAKLayout break (system, page, section)
Element.BRACKETStaff bracket
Element.SYSTEM_DIVIDERSystem divider

Other Elements

Element TypeDescription
Element.JUMPJump (D.C., D.S., etc.)
Element.MARKERMarker (Fine, Coda, etc.)
Element.IMAGEImage
Element.BREATHBreath mark

Common Element Properties

All elements share these base properties:

PropertyTypeDescription
typeintElement type (from Element enum)
nameQStringElement type name (read only)
parentEngravingItemParent element
staffStaffStaff this element belongs to
visibleboolWhether element is visible
colorQColorElement color
selectedboolWhether element is selected (read only)
generatedboolWhether element is auto-generated (read only)
zintStacking order
smallboolWhether element is cue size

Positioning Properties

PropertyTypeDescription
offsetQPointFOffset from reference position (spatium units)
offsetXqrealX-axis offset
offsetYqrealY-axis offset
posXqrealReference position X (read only)
posYqrealReference position Y (read only)
posQPointFReference position (read only)
pagePosQPointFPosition in page coordinates (read only)
canvasPosQPointFPosition in canvas coordinates (read only)
bboxQRectFBounding box (read only)

Staff Properties

PropertyTypeDescription
staffIdxintStaff index
effectiveStaffIdxintEffective staff index (for system objects)
vStaffIdxintStaff index accounting for cross-staffing

Note Properties

PropertyTypeDescription
pitchintMIDI pitch (0-127)
tpcintTonal pitch class
tpc1intTPC in concert pitch
tpc2intTPC in transposing pitch
stringintString number (for TAB)
fretintFret number (for TAB)
lineintStaff line position
velocityintMIDI velocity
veloTypeintVelocity type
tuningqrealTuning offset in cents
ghostboolGhost note
playboolWhether note is played
headTypeintNotehead type
headGroupintNotehead group
mirrorHeadintNotehead horizontal direction
hasParenthesesboolWhether note has parentheses
accidentalAccidentalNote's accidental
accidentalTypeintAccidental type
tieTieForward tie
tieBackTieBackward tie
dotsarrayNote dots
elementsarrayAttached elements
playEventsarrayPlay events
// Access note properties var note = cursor.element.notes[0]; console.log("Pitch: " + note.pitch); console.log("TPC: " + note.tpc); // Modify note curScore.startCmd("Modify Note"); note.pitch = 60; // Set to Middle C note.velocity = 80; curScore.endCmd();

Chord Properties

PropertyTypeDescription
notesarrayArray of notes in chord
stemStemStem element
hookHookHook element
beamBeamBeam element
lyricsarrayAttached lyrics
graceNotesarrayGrace notes
durationFractionDuration value
durationTypeintDuration type
stemDirectionintStem direction
upboolWhether stem points up
// Access chord properties if (cursor.element.type == Element.CHORD) { var chord = cursor.element; var notes = chord.notes; for (var i = 0; i < notes.length; i++) { console.log("Note " + i + ": pitch=" + notes[i].pitch); } }

Rest Properties

PropertyTypeDescription
durationFractionDuration value
durationTypeintDuration type
dotsintNumber of dots

Text Element Properties

PropertyTypeDescription
textQStringPlain text content
htmlTextQStringHTML formatted text
fontFaceQStringFont family
fontSizeqrealFont size
fontStyleintFont style flags
placementintPlacement (above/below)
alignintText alignment
frameTypeintFrame type
framePaddingqrealFrame padding
frameWidthqrealFrame width
frameRoundintFrame corner rounding
frameFgColorQColorFrame foreground color
frameBgColorQColorFrame background color
// Create and configure staff text var text = newElement(Element.STAFF_TEXT); text.text = "pizz."; text.placement = Placement.ABOVE; text.fontSize = 10; curScore.startCmd("Add Text"); cursor.add(text); curScore.endCmd();

Dynamic Properties

PropertyTypeDescription
dynamicTypeintDynamic type (p, mp, mf, f, etc.)
velocityintMIDI velocity
changeSpeedintSpeed of dynamic change

Tempo Text Properties

PropertyTypeDescription
tempoqrealTempo in BPM
tempoFollowTextboolWhether tempo follows text
textQStringText content

Hairpin Properties

PropertyTypeDescription
hairpinTypeintType (crescendo, diminuendo)
placementintPlacement
beginTextQStringText at start
continueTextQStringContinuation text
endTextQStringText at end
veloChangeintVelocity change
veloChangeSpeedintSpeed of change

Measure Properties

PropertyTypeDescription
timesigTimeSigTime signature
startRepeatboolHas start repeat barline
endRepeatboolHas end repeat barline
repeatCountintRepeat count
nointMeasure number (0-based)
noStringQStringMeasure number string
irregularboolIs irregular measure

Segment Properties

PropertyTypeDescription
tickintTick position
segmentTypeintSegment type
nextInMeasureSegmentNext segment in measure
prevInMeasureSegmentPrevious segment in measure
annotationsarrayAttached annotations

Segment Types (Segment.*)

TypeDescription
Segment.AllAll segment types
Segment.ChordRestChords and rests
Segment.ClefClef
Segment.KeySigKey signature
Segment.TimeSigTime signature
Segment.StartRepeatBarLineStart repeat
Segment.BarLineBarline
Segment.BreathBreath

Enumerations

Accidental Types (Accidental.*)

TypeDescription
Accidental.NONENo accidental
Accidental.FLATFlat
Accidental.NATURALNatural
Accidental.SHARPSharp
Accidental.SHARP2Double sharp
Accidental.FLAT2Double flat
Accidental.NATURAL_FLATNatural flat
Accidental.NATURAL_SHARPNatural sharp
Accidental.SHARP_SHARPSharp sharp

Note Head Types (NoteHeadType.*)

TypeDescription
NoteHeadType.HEAD_AUTOAuto
NoteHeadType.HEAD_WHOLEWhole note
NoteHeadType.HEAD_HALFHalf note
NoteHeadType.HEAD_QUARTERQuarter note
NoteHeadType.HEAD_BREVISBrevis

Note Head Groups (NoteHeadGroup.*)

TypeDescription
NoteHeadGroup.HEAD_NORMALNormal
NoteHeadGroup.HEAD_CROSSCross
NoteHeadGroup.HEAD_PLUSPlus
NoteHeadGroup.HEAD_XCIRCLEX circle
NoteHeadGroup.HEAD_WITHXWith X
NoteHeadGroup.HEAD_TRIANGLE_UPTriangle up
NoteHeadGroup.HEAD_TRIANGLE_DOWNTriangle down
NoteHeadGroup.HEAD_DIAMONDDiamond
NoteHeadGroup.HEAD_SLASHSlash
NoteHeadGroup.HEAD_DODo
NoteHeadGroup.HEAD_RERe
NoteHeadGroup.HEAD_MIMi
NoteHeadGroup.HEAD_FAFa
NoteHeadGroup.HEAD_SOLSol
NoteHeadGroup.HEAD_LALa
NoteHeadGroup.HEAD_TITi

Direction (Direction.*)

TypeDescription
Direction.AUTOAutomatic
Direction.UPUp
Direction.DOWNDown

Placement (Placement.*)

TypeDescription
Placement.ABOVEAbove staff
Placement.BELOWBelow staff

Hairpin Types (HairpinType.*)

TypeDescription
HairpinType.CRESC_HAIRPINCrescendo hairpin
HairpinType.DECRESC_HAIRPINDecrescendo hairpin
HairpinType.CRESC_LINECrescendo line
HairpinType.DECRESC_LINEDecrescendo line

Ottava Types (OttavaType.*)

TypeDescription
OttavaType.OTTAVA_8VA8va alta
OttavaType.OTTAVA_8VB8va bassa
OttavaType.OTTAVA_15MA15ma alta
OttavaType.OTTAVA_15MB15ma bassa
OttavaType.OTTAVA_22MA22ma alta
OttavaType.OTTAVA_22MB22ma bassa

Beam Modes (Beam.*)

TypeDescription
Beam.AUTOAuto beaming
Beam.NONENo beam
Beam.BEGINBegin beam
Beam.MIDMiddle of beam
Beam.ENDEnd beam

Dynamic Types (DynamicType.*)

TypeDescription
DynamicType.OTHEROther
DynamicType.PPPPPPpppppp
DynamicType.PPPPPppppp
DynamicType.PPPPpppp
DynamicType.PPPppp
DynamicType.PPpp
DynamicType.Pp
DynamicType.MPmp
DynamicType.MFmf
DynamicType.Ff
DynamicType.FFff
DynamicType.FFFfff
DynamicType.FFFFffff
DynamicType.FFFFFfffff
DynamicType.FFFFFFffffff
DynamicType.FPfp
DynamicType.SFsf
DynamicType.SFZsfz
DynamicType.SFFsff
DynamicType.SFFZsffz
DynamicType.RFZrfz
DynamicType.RFrf