new ProtoM21Object()
Class for pseudo-m21 objects to inherit from. The most important attributes that nearly
everything in music21 should inherit from are given below.
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
classes |
Array.<string> | An Array of strings of classes that the object belongs to (default ['ProtoM21Object']) |
isProtoM21Object |
Boolean | Does this object descend from |
isMusic21Object |
Boolean | Does this object descend from |
Methods
-
<static> ProtoM21Object#clone() → {Object}
-
Makes (as much as possible) a complete duplicate copy of the object called with .clone()
Works similarly to Python's copy.deepcopy().
Every ProtoM21Object has a
._cloneCallbacksobject which maps{attribute: callbackFunction}
to handle custom clone cases. See, for instance,music21.base.Music21Objectwhich
uses a custom callback to NOT clone the.activeSiteattribute.- Source:
Returns:
- Type
- object
Example
var n1 = new music21.note.Note("C#"); n1.duration.quarterLength = 4; var n2 = n1.clone(); n2.duration.quarterLength == 4; // true n2 === n1; // false -
<static> ProtoM21Object#isClassOrSubclass(testClass) → {Boolean}
-
Check to see if an object is of this class or subclass.
Parameters:
Name Type Description testClassstring | Array.<string> a class or Array of classes to test
- Source:
Returns:
- Type
- Boolean
Example
var n = new music21.note.Note(); n.isClassOrSubclass('Note'); // true n.isClassOrSubclass('Music21Object'); // true n.isClassOrSubclass(['Duration', 'NotRest']); // true // NotRest