music21.percussion¶
PercussionChord¶
- class music21.percussion.PercussionChord(notes: None | str | Sequence[str] | Sequence[Pitch] | Sequence[ChordBase] | Sequence[NotRest] | Sequence[int] = None, **keywords)¶
ChordBase
and :class:`~music21.note.NotRest subclass that is NOT aChord
because one or more notes is anUnpitched
object.>>> vibraslapNote = note.Unpitched(displayName='D4', storedInstrument=instrument.Vibraslap()) >>> pChord = percussion.PercussionChord([vibraslapNote, note.Note('E5')]) >>> pChord.isChord False
Has notes, just like any ChordBase:
>>> pChord.notes (<music21.note.Unpitched 'Vibraslap'>, <music21.note.Note E>)
Assign them to another PercussionChord:
>>> pChord2 = percussion.PercussionChord() >>> pChord2.notes = pChord.notes >>> pChord2.notes (<music21.note.Unpitched 'Vibraslap'>, <music21.note.Note E>)
Don’t attempt setting anything but Note or Unpitched objects as notes:
>>> pChord2.notes = [note.Rest()] Traceback (most recent call last): TypeError: every element of notes must be a note.Note or note.Unpitched object
Equality
Two PercussionChord objects are equal if their notes are equal and in the same order (this is different from Chord, but necessary because we cannot compare based just on pitch equality)
>>> pChord == pChord2 True >>> pChord3 = percussion.PercussionChord([note.Unpitched('D4')]) >>> pChord == pChord3 False
PercussionChord
bases
PercussionChord
read-only properties
Read-only properties inherited from GeneralNote
:
Read-only properties inherited from Music21Object
:
Read-only properties inherited from ProtoM21Object
:
PercussionChord
read/write properties
- PercussionChord.notes¶
- PercussionChord.pitches¶
Get or set a list or tuple of all Pitch objects in this PercussionChord.
Unpitched members (that at most have only display pitches) are ignored.
>>> pChord = percussion.PercussionChord([note.Unpitched(displayName='D4'), note.Note('E5')]) >>> pChord.pitches (<music21.pitch.Pitch E5>,)
>>> pChord.pitches = [60] >>> pChord.pitches (<music21.pitch.Pitch C4>,)
Notice that setting pitches has now just cleared any existing notes, pitched or unpitched: >>> pChord.notes (<music21.note.Note C>,)
Read/write properties inherited from ChordBase
:
Read/write properties inherited from NotRest
:
Read/write properties inherited from GeneralNote
:
Read/write properties inherited from Music21Object
:
PercussionChord
methods
- PercussionChord.__eq__(other)¶
Returns True if all the notes are equal and in the same order.
Methods inherited from ChordBase
:
Methods inherited from NotRest
:
Methods inherited from GeneralNote
:
Methods inherited from Music21Object
:
Methods inherited from ProtoM21Object
:
PercussionChord
instance variables
Instance variables inherited from ChordBase
:
Instance variables inherited from NotRest
:
Instance variables inherited from GeneralNote
:
Instance variables inherited from Music21Object
: