- class neoscore.western.chordrest.PitchAndGlyph
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
- class neoscore.western.chordrest.Chordrest
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
Nonefor a rest.
It will automatically generate and lay out:
Noteheads if pitches are given
Flagif pitches are given and required by the given
Accidentals as needed by any given pitches
Restif no pitches are given
RhythmDots if needed by the given
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)
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
Nonethis 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
Pitchobjects. 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
beam_hook_dir – Beamlet hook direction used in a
table – The set of noteheads to use according to
- property rest_y: Optional[Unit]
The vertical position used by generated rests.
Defaults to the staff center.
- property ledgers: List[LedgerLine]
The ledger lines contained in this Chordrest.
An empty list means none are needed.
- property beam_break_depth: Optional[int]
Break depth used if in a
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
1would indicate a subdivision break to 1 beam at this point.
- property beam_hook_dir: Optional[DirectionX]
Beamlet hook direction used in a
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 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.UPas 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
If there are no noteheads (meaning this Chordrest is a rest), this arbitrarily returns
The height of the stem