class neoscore.western.chordrest.PitchAndGlyph[source]

Bases: tuple

Used to define individual notes with one-off SMuFL glyphs.

property pitch

The pitch for the notehead

property notehead_glyph

The SMuFL glyph name for the notehead

static __new__(_cls, pitch: Union[Pitch, str, tuple], notehead_glyph: str)

Create new instance of PitchAndGlyph(pitch, notehead_glyph)

class neoscore.western.chordrest.Chordrest[source]

Bases: PositionedObject, StaffObject

A chord or a rest.

This is a unified interface for conventionally notated musical notes/chords/rests. It can be given any number of pitches to be used as notes in the chord, or None for a rest.

It will automatically generate and lay out:

  • Noteheads if pitches are given

  • a Stem if pitches are given and required by the given Duration

  • a Flag if pitches are given and required by the given Duration

  • LedgerLines as needed (taking into consideration the given pitches and their location on the Staff)

  • Accidentals as needed by any given pitches

  • a Rest if no pitches are given

  • RhythmDots if needed by the given Duration

Any accidentals given in pitches will be unconditionally drawn regardless of context and key signature.

__init__(pos_x: Unit, staff: Staff, notes: Optional[List[Union[Pitch, str, tuple, PitchAndGlyph]]], duration: Union[Duration, Tuple[int, int]], rest_y: Optional[Unit] = None, stem_direction: Optional[DirectionY] = None, beam_break_depth: Optional[int] = None, beam_hook_dir: Optional[DirectionX] = None, table: NoteheadTable = notehead_tables.STANDARD)[source]
  • pos_x – The horizontal position in the staff

  • staff – The staff the object is attached to

  • notes – A list of pitches and optional notehead-specific data. If None this indicates a rest. For simple notes and chords, this can typically be a list of pitch string shorthands (see Pitch.from_str). Pitches with extended accidentals can be given by passing fully constructed Pitch objects. Individual notehead glyphs (by default taken from the given table) can be overridden by passing a tuple of a pitch and a SMuFL glyph name string.

  • duration – The written duration for the object.

  • rest_y – The vertical position used by rests. This defaults to the center of the staff.

  • stem_direction – An optional stem direction override. If omitted, the direction is automatically calculated to point away from the furthest-out notehead.

  • beam_break_depth – Break depth used if in a BeamGroup.

  • beam_hook_dir – Beamlet hook direction used in a BeamGroup.

  • table – The set of noteheads to use according to duration.

property notes: List[Union[Pitch, str, tuple, PitchAndGlyph]]
property noteheads: List[Notehead]

The noteheads contained in this Chordrest.

property rest_y: Optional[Unit]

The vertical position used by generated rests.

Defaults to the staff center.

property rest: Optional[Rest]

A rest glyph, if no noteheads exist.

property accidentals: List[Accidental]

The accidentals contained in this Chordrest.

property ledgers: List[LedgerLine]

The ledger lines contained in this Chordrest.

An empty list means none are needed.

property dots: List[RhythmDot]
property stem: Optional[Stem]

The stem for the Chordrest.

property flag: Optional[Flag]

The flag attached to the stem.

property beam_break_depth: Optional[int]

Break depth used if in a BeamGroup.

If this Chordrest is within a beam group, this triggers a beam subdivision break at this point. The value indicates the number of beams to which the subdivision breaks. For example, in run of 16th notes a beam_break_depth of 1 would indicate a subdivision break to 1 beam at this point.

property beam_hook_dir: Optional[DirectionX]

Beamlet hook direction used in a BeamGroup.

If this Chordrest is within a beam group and this position is one requiring a beamlet hook whose direction is ambiguous, this controls that direction.

property table: NoteheadTable
property duration: Duration

The written length of this event.

This affects many components of the chordrest.


A set of staff positions of needed ledger lines.

Positions are in centered staff positions.

An empty list means no ledger lines are needed.


The positions of all rhythm dots needed.


The notehead furthest from the staff center


The highest notehead in the chord.


The lowest notehead in the chord.


The notehead furthest to the left in the chord


The notehead furthest to the right in the chord


A point where common attachments like ornaments could go.

For chords, this is a point centered above or below the outermost notehead opposite of the stem direction.

For rests, this is a point centered above the rest.

The returned point is relative to the Chordrest.


The width of the notehead column after layout


All noteheads which are above or below the staff


The notehead furthest to the left outside the staff


The notehead furthest to the right outside the staff


The total width of any noteheads outside the staff

property stem_direction: DirectionY

The direction of the stem

Takes the notehead furthest from the center of the staff, and returns the opposite direction.

If the furthest notehead is in the center of the staff, the direction defaults to DirectionY.DOWN, unless the staff has only one line, in which case it defaults to DirectionY.UP as a convenience for percussion staves.

This automatically calculated property may be overridden using its setter. To revert to the automatically calculated value set this property to None.

If there are no noteheads (meaning this Chordrest is a rest), this arbitrarily returns DirectionY.UP.


The height of the stem