Class: ProtoM21Object

music21.prebase. ProtoM21Object

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.

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 music21.prebase.ProtoM21Object: obviously true.

isMusic21Object Boolean

Does this object descend from music21.base.Music21Object; default false.

Source:

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 ._cloneCallbacks object which maps {attribute: callbackFunction}
to handle custom clone cases. See, for instance, music21.base.Music21Object which
uses a custom callback to NOT clone the .activeSite attribute.

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
testClass string | 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
Music21j, Copyright © 2013-2018 Michael Scott Cuthbert and cuthbertLab.
Documentation generated by JSDoc 3.5.5 on Wed Jul 4th 2018 using the DocStrap template.