Table Of Contents

Previous topic

music21.key

Next topic

music21.interval

This Page

music21.instrument

Instrument

class music21.instrument.Instrument

inherits from: Music21Object

Instrument attributes

Attributes without Documentation: instrumentName, midiChannel, partId, partName, midiProgram, instrumentAbbreviation, transposition, partAbbreviation

Attributes inherited from Music21Object: id, groups

Instrument properties

mx

Properties inherited from Music21Object: duration, offset, parent, priority

Instrument methods

bestName()
Find a viable name, looking first at instrument, then part, then abbreviations.
partIdRandomize()
Force a unique id by using an MD5

Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), purgeLocations(), removeLocation(), setOffsetBySite(), show(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()

Bassoon

class music21.instrument.Bassoon
inherits from: WoodwindInstrument, Instrument, Music21Object

StringInstrument

class music21.instrument.StringInstrument

inherits from: Instrument, Music21Object

StringInstrument attributes

Attributes inherited from Instrument: instrumentName, midiChannel, partId, partName, midiProgram, instrumentAbbreviation, transposition, partAbbreviation

Attributes inherited from Music21Object: id, groups

StringInstrument properties

stringPitches

stringPitches is a property that stores a list of Pitches (or pitch names, such as “C4”) that represent the pitch of the open strings from lowest to highest[#reentrant]_

>>> vln1 = Violin()
>>> vln1.stringPitches
[G3, D4, A4, E5]
instrument.stringPitches are full pitch objects, not just names
>>> [x.octave for x in vln1.stringPitches]
[3, 4, 4, 5]
scordatura for Scelsi's *Anahit*. N.B. string to pitch conversion
>>> vln1.stringPitches = ["G3","G4","B4","D4"]
>>> vln1.stringPitches
[G3, G4, B4, D4]
..[#reentrant] In some tuning methods such as reentrant tuning on the ukulele,
lute, or five-string banjo the order might not strictly be from lowest to
highest.  The same would hold true for certain violin scordatura pieces, such
as some of Biber's *Mystery Sonatas*

Properties inherited from Instrument: mx

Properties inherited from Music21Object: duration, offset, parent, priority

StringInstrument methods

Methods inherited from Instrument: bestName(), partIdRandomize()

Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), purgeLocations(), removeLocation(), setOffsetBySite(), show(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()

Viola

class music21.instrument.Viola

inherits from: StringInstrument, Instrument, Music21Object

Viola attributes

lowestNote
An object for storing pitch values. All values are represented internally as a scale step (self.step), and octave and an accidental object. In addition, pitches know their pitchSpace representation (self._ps); altering any of the first three changes the pitchSpace representation. Similarly, altering the pitchSpace representation alters the first three.

Attributes inherited from Instrument: instrumentName, midiChannel, partId, partName, midiProgram, instrumentAbbreviation, transposition, partAbbreviation

Attributes inherited from Music21Object: id, groups

Viola properties

Properties inherited from StringInstrument: stringPitches

Properties inherited from Instrument: mx

Properties inherited from Music21Object: duration, offset, parent, priority

Viola methods

Methods inherited from Instrument: bestName(), partIdRandomize()

Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), purgeLocations(), removeLocation(), setOffsetBySite(), show(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()

Violin

class music21.instrument.Violin

inherits from: StringInstrument, Instrument, Music21Object

Violin attributes

lowestNote
An object for storing pitch values. All values are represented internally as a scale step (self.step), and octave and an accidental object. In addition, pitches know their pitchSpace representation (self._ps); altering any of the first three changes the pitchSpace representation. Similarly, altering the pitchSpace representation alters the first three.

Attributes inherited from Instrument: instrumentName, midiChannel, partId, partName, midiProgram, instrumentAbbreviation, transposition, partAbbreviation

Attributes inherited from Music21Object: id, groups

Violin properties

Properties inherited from StringInstrument: stringPitches

Properties inherited from Instrument: mx

Properties inherited from Music21Object: duration, offset, parent, priority

Violin methods

Methods inherited from Instrument: bestName(), partIdRandomize()

Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), purgeLocations(), removeLocation(), setOffsetBySite(), show(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()

Violoncello

class music21.instrument.Violoncello

inherits from: StringInstrument, Instrument, Music21Object

Violoncello attributes

lowestNote
An object for storing pitch values. All values are represented internally as a scale step (self.step), and octave and an accidental object. In addition, pitches know their pitchSpace representation (self._ps); altering any of the first three changes the pitchSpace representation. Similarly, altering the pitchSpace representation alters the first three.

Attributes inherited from Instrument: instrumentName, midiChannel, partId, partName, midiProgram, instrumentAbbreviation, transposition, partAbbreviation

Attributes inherited from Music21Object: id, groups

Violoncello properties

Properties inherited from StringInstrument: stringPitches

Properties inherited from Instrument: mx

Properties inherited from Music21Object: duration, offset, parent, priority

Violoncello methods

Methods inherited from Instrument: bestName(), partIdRandomize()

Methods inherited from Music21Object: searchParentByAttr(), getContextAttr(), setContextAttr(), addContext(), addLocation(), addLocationAndParent(), freezeIds(), getContextByClass(), getOffsetBySite(), getSiteIds(), getSites(), hasContext(), isClass(), purgeLocations(), removeLocation(), setOffsetBySite(), show(), unfreezeIds(), unwrapWeakref(), wrapWeakref(), write()

WoodwindInstrument

class music21.instrument.WoodwindInstrument
inherits from: Instrument, Music21Object