music21.percussion¶
This module contains classes for representing unpitched events such as percussion.
For backwards compatibility reasons, the module does not contain the actual
Unpitched
which is in the note module.
PercussionChord¶
- class music21.percussion.PercussionChord(notes: None | str | Sequence[str] | Sequence[Pitch] | Sequence[ChordBase] | Sequence[NotRest] | Sequence[int] = None, **keywords)¶
A representation of one or (normally) more than one unpitched object sharing a stem and treated like a “chord.” It may also contain standard notes (pitches) for cases such as a percussionist playing a cymbal and marimba at the same time.
It is a
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 <music21.percussion.PercussionChord [Vibraslap E5]>
>>> pChord.isChord False
A PercussionChord has “notes,” just like anything deriving from ChordBase. Some of these are Unpitched objects.
>>> pChord.notes (<music21.note.Unpitched 'Vibraslap'>, <music21.note.Note E>)
The same notes can also be assigned 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
: