music21.lily.lilyObjects¶
music21 translates to Lilypond format and if Lilypond is installed on the local computer, can automatically generate .pdf, .png, and .svg versions of musical files using Lilypond
this replaces (April 2012) the old LilyString() conversion methods.
The Grammar for Lilypond comes from http://lilypond.org/doc/v2.14/Documentation/notation/lilypond-grammar
LyAlternativeMusic¶
-
class
music21.lily.lilyObjects.
LyAlternativeMusic
(musicList=None)¶
LyAlternativeMusic
bases
LyAlternativeMusic
read-only properties
Read-only properties inherited from LyObject
:
LyAlternativeMusic
methods
-
LyAlternativeMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyAssignment¶
-
class
music21.lily.lilyObjects.
LyAssignment
(assignmentId=None, identifierInit=None, propertyPath=None, embeddedScm=None)¶ one of three forms of assignment:
assignment_id ‘=’ identifier_init assignment_id property_path ‘=’ identifier_init embedded_scmif self.embeddedScm is not None, uses type 3 if self.propertyPath is not None, uses type 2 else uses type 1 or raises an exception.
>>> lyii = lily.lilyObjects.LyIdentifierInit(string="hi") >>> lya = lily.lilyObjects.LyAssignment(assignmentId="title", identifierInit=lyii) >>> print(lya) title = "hi"
Note that you could also pass assignmentId a LyAssignmentId object, but that’s overkill for a lot of things.
LyAssignment
bases
LyAssignment
read-only properties
Read-only properties inherited from LyObject
:
LyAssignment
methods
-
LyAssignment.
stringOutput
()¶
Methods inherited from LyObject
:
LyAssignmentId¶
-
class
music21.lily.lilyObjects.
LyAssignmentId
(content=None, isLyricString=False)¶
LyAssignmentId
bases
LyAssignmentId
read-only properties
Read-only properties inherited from LyObject
:
LyAssignmentId
methods
-
LyAssignmentId.
stringOutput
()¶
Methods inherited from LyObject
:
LyBookBlock¶
-
class
music21.lily.lilyObjects.
LyBookBlock
(bookBody=None)¶
LyBookBlock
bases
LyBookBlock
read-only properties
Read-only properties inherited from LyObject
:
LyBookBlock
methods
-
LyBookBlock.
stringOutput
()¶
Methods inherited from LyObject
:
LyBookBody¶
-
class
music21.lily.lilyObjects.
LyBookBody
(contents=None, bookIdentifier=None)¶ Contains None, bookIdentifier (string?) or one or more of the following:
paperBlock bookPartBlock scoreBlock compositeMusic fullMarkup fullMarkupList lilypondHeader error>>> lybb = lily.lilyObjects.LyBookBody(bookIdentifier="bookId") >>> lybb.stringOutput() 'bookId'
LyBookBody
bases
LyBookBody
read-only properties
Read-only properties inherited from LyObject
:
LyBookBody
methods
-
LyBookBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyBookpartBlock¶
-
class
music21.lily.lilyObjects.
LyBookpartBlock
(bookpartBody=None)¶
LyBookpartBlock
bases
LyBookpartBlock
read-only properties
Read-only properties inherited from LyObject
:
LyBookpartBlock
methods
-
LyBookpartBlock.
stringOutput
()¶
Methods inherited from LyObject
:
LyBookpartBody¶
-
class
music21.lily.lilyObjects.
LyBookpartBody
(contents=None, bookIdentifier=None)¶ Contains None, bookIdentifier (string?) or one or more of the following:
paperBlock scoreBlock compositeMusic fullMarkup fullMarkupList lilypondHeader error
LyBookpartBody
bases
LyBookpartBody
read-only properties
Read-only properties inherited from LyObject
:
LyBookpartBody
methods
-
LyBookpartBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyChordBody¶
-
class
music21.lily.lilyObjects.
LyChordBody
(chordBodyElements=None)¶
LyChordBody
bases
LyChordBody
read-only properties
Read-only properties inherited from LyObject
:
LyChordBody
methods
-
LyChordBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyChordBodyElement¶
-
class
music21.lily.lilyObjects.
LyChordBodyElement
(parts=None)¶ Contains a note or a drum pitch or a music function:
chord_body_element: pitch exclamations (a string of zero or more ! marks) questions (a string of zero or more ? marks) octave_check post_events | DRUM_PITCH post_events | music_function_chord_body
TODO: only the first form is currently supported in creation
LyChordBodyElement
bases
LyChordBodyElement
read-only properties
Read-only properties inherited from LyObject
:
LyChordBodyElement
methods
-
LyChordBodyElement.
stringOutput
()¶
Methods inherited from LyObject
:
LyCommandElement¶
-
class
music21.lily.lilyObjects.
LyCommandElement
(commandType=None, argument=None)¶
LyCommandElement
bases
LyCommandElement
read-only properties
Read-only properties inherited from LyObject
:
LyCommandElement
methods
-
LyCommandElement.
stringOutput
()¶
Methods inherited from LyObject
:
LyCommandEvent¶
-
class
music21.lily.lilyObjects.
LyCommandEvent
(commandType=None, argument1=None, argument2=None)¶
LyCommandEvent
bases
LyCommandEvent
read-only properties
Read-only properties inherited from LyObject
:
LyCommandEvent
methods
-
LyCommandEvent.
stringOutput
()¶
Methods inherited from LyObject
:
LyCompositeMusic¶
-
class
music21.lily.lilyObjects.
LyCompositeMusic
(prefixCompositeMusic=None, groupedMusicList=None, newLyrics=None)¶ one of LyPrefixCompositeMusic or LyGroupedMusicList stored in self.contents
LyCompositeMusic
bases
LyCompositeMusic
read-only properties
-
LyCompositeMusic.
contents
¶
Read-only properties inherited from LyObject
:
LyCompositeMusic
methods
-
LyCompositeMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyContextChange¶
-
class
music21.lily.lilyObjects.
LyContextChange
(before=None, after=None)¶
LyContextChange
bases
LyContextChange
read-only properties
Read-only properties inherited from LyObject
:
LyContextChange
methods
-
LyContextChange.
stringOutput
()¶
Methods inherited from LyObject
:
LyContextDefMod¶
-
class
music21.lily.lilyObjects.
LyContextDefMod
(contextDef=None)¶ one of consists, remove, accepts, defaultchild, denies, alias, type, description, name
LyContextDefMod
bases
LyContextDefMod
read-only properties
Read-only properties inherited from LyObject
:
LyContextDefMod
methods
-
LyContextDefMod.
stringOutput
()¶
Methods inherited from LyObject
:
LyContextDefSpecBlock¶
-
class
music21.lily.lilyObjects.
LyContextDefSpecBlock
(contextDefSpecBody=None)¶
LyContextDefSpecBlock
bases
LyContextDefSpecBlock
read-only properties
Read-only properties inherited from LyObject
:
LyContextDefSpecBlock
methods
-
LyContextDefSpecBlock.
stringOutput
()¶
Methods inherited from LyObject
:
LyContextDefSpecBody¶
-
class
music21.lily.lilyObjects.
LyContextDefSpecBody
(contextDefIdentifier=None, contextDefSpecBody=None, embeddedScm=None, contextMod=None, contextModification=None)¶ None or one of four forms:
CONTEXT_DEF_IDENTIFIER context_def_spec_body “grobdescriptions” embedded_scm context_def_spec_body context_mod context_def_spec_body context_modification>>> lyCdsb = lily.lilyObjects.LyContextDefSpecBody(contextDefIdentifier="cdi") >>> lyCdsb.stringOutput() 'cdi'
LyContextDefSpecBody
bases
LyContextDefSpecBody
read-only properties
Read-only properties inherited from LyObject
:
LyContextDefSpecBody
methods
-
LyContextDefSpecBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyContextMod¶
-
class
music21.lily.lilyObjects.
LyContextMod
(contextDefOrProperty=None, scalar=None)¶
LyContextMod
bases
LyContextMod
read-only properties
Read-only properties inherited from LyObject
:
LyContextMod
methods
-
LyContextMod.
stringOutput
()¶
Methods inherited from LyObject
:
LyContextModList¶
-
class
music21.lily.lilyObjects.
LyContextModList
(contents=None, contextModIdentifier=None)¶ contains zero or more LyContextMod objects and an optional contextModIdentifier
LyContextModList
bases
LyContextModList
read-only properties
Read-only properties inherited from LyObject
:
LyContextModList
methods
-
LyContextModList.
stringOutput
()¶
Methods inherited from LyObject
:
LyContextModification¶
-
class
music21.lily.lilyObjects.
LyContextModification
(contextModList=None, contextModIdentifier=None, displayWith=True)¶ represents both context_modification and optional_context_mod
but not context_mod!!!!!
LyContextModification
bases
LyContextModification
read-only properties
Read-only properties inherited from LyObject
:
LyContextModification
methods
-
LyContextModification.
stringOutput
()¶
Methods inherited from LyObject
:
LyDirectionLessEvent¶
-
class
music21.lily.lilyObjects.
LyDirectionLessEvent
(event=None)¶ represents [‘[‘,’]’,’~’,’(‘,’)’,’!’,’(‘,’)’,’>’,’<’] or an EVENT_IDENTIFIER or a tremolo_type
LyDirectionLessEvent
bases
LyDirectionLessEvent
read-only properties
Read-only properties inherited from LyObject
:
LyDirectionLessEvent
methods
-
LyDirectionLessEvent.
stringOutput
()¶
Methods inherited from LyObject
:
LyDirectionReqdEvent¶
-
class
music21.lily.lilyObjects.
LyDirectionReqdEvent
(event=None)¶
LyDirectionReqdEvent
bases
LyDirectionReqdEvent
read-only properties
Read-only properties inherited from LyObject
:
LyDirectionReqdEvent
methods
-
LyDirectionReqdEvent.
stringOutput
()¶
Methods inherited from LyObject
:
LyEmbeddedScm¶
-
class
music21.lily.lilyObjects.
LyEmbeddedScm
(content=None)¶ represents Scheme embedded in Lilypond code.
Can be either a SCM_TOKEN (Scheme Token) or SCM_IDENTIFIER String stored in self.content
Note that if any LyEmbeddedScm is found in an output then the output SHOULD be marked as unsafe. But a lot of standard lilypond functions are actually embedded scheme. For instance, clef, which as http://lilypond.org/doc/v2.12/input/lsr/lilypond-snippets/Pitches#Tweaking-clef-properties shows is a macro to run a lot of set commands.
>>> lyscheme = lily.lilyObjects.LyEmbeddedScm('##t') >>> str(lyscheme) '##t'
LyEmbeddedScm
bases
LyEmbeddedScm
read-only properties
Read-only properties inherited from LyObject
:
LyEmbeddedScm
methods
-
LyEmbeddedScm.
stringOutput
()¶
Methods inherited from LyObject
:
LyEventChord¶
-
class
music21.lily.lilyObjects.
LyEventChord
(simpleChordElements=None, postEvents=None, chordRepetition=None, multiMeasureRest=None, duration=None, commandElement=None, noteChordElement=None)¶ takes all the parts as a list of up to three elements
- event_chord: simple_chord_elements post_events
- CHORD_REPETITION optional_notemode_duration post_eventsMULTI_MEASURE_REST optional_notemode_duration post_eventscommand_elementnote_chord_element
simple_chord_elements can be a LySimpleElement object. Or it can be a LyNewChord or LyFigureSpec + Duration once that is done. But there is no LySimpleChordElements object yet.
LyEventChord
bases
LyEventChord
read-only properties
Read-only properties inherited from LyObject
:
LyEventChord
methods
-
LyEventChord.
stringOutput
()¶
Methods inherited from LyObject
:
LyFullMarkup¶
-
class
music21.lily.lilyObjects.
LyFullMarkup
¶
LyFullMarkup
bases
LyFullMarkup
read-only properties
Read-only properties inherited from LyObject
:
LyFullMarkup
methods
-
LyFullMarkup.
stringOutput
()¶
Methods inherited from LyObject
:
LyFullMarkupList¶
-
class
music21.lily.lilyObjects.
LyFullMarkupList
¶
LyFullMarkupList
bases
LyFullMarkupList
read-only properties
Read-only properties inherited from LyObject
:
LyFullMarkupList
methods
-
LyFullMarkupList.
stringOutput
()¶
Methods inherited from LyObject
:
LyGenTextDef¶
-
class
music21.lily.lilyObjects.
LyGenTextDef
(value=None)¶ holds either full_markup, string, or DIGIT
LyGenTextDef
bases
LyGenTextDef
read-only properties
Read-only properties inherited from LyObject
:
LyGenTextDef
methods
-
LyGenTextDef.
stringOutput
()¶
Methods inherited from LyObject
:
LyGroupedMusicList¶
-
class
music21.lily.lilyObjects.
LyGroupedMusicList
(simultaneousMusic=None, sequentialMusic=None)¶ one of LySimultaneousMusic or LySequentialMusic
LyGroupedMusicList
bases
LyGroupedMusicList
read-only properties
Read-only properties inherited from LyObject
:
LyGroupedMusicList
methods
-
LyGroupedMusicList.
stringOutput
()¶
Methods inherited from LyObject
:
LyIdentifierInit¶
-
class
music21.lily.lilyObjects.
LyIdentifierInit
(scoreBlock=None, bookBlock=None, bookPartBlock=None, outputDef=None, contextDefSpecBlock=None, music=None, postEvent=None, numberExpression=None, string=None, embeddedScm=None, fullMarkup=None, fullMarkupList=None, digit=None, contextModification=None)¶ >>> lyii = lily.lilyObjects.LyIdentifierInit(string = "hello") >>> print(lyii) "hello"
LyIdentifierInit
bases
LyIdentifierInit
read-only properties
Read-only properties inherited from LyObject
:
LyIdentifierInit
methods
-
LyIdentifierInit.
stringOutput
()¶
Methods inherited from LyObject
:
LyLayout¶
-
class
music21.lily.lilyObjects.
LyLayout
¶
LyLayout
bases
LyLayout
read-only properties
Read-only properties inherited from LyObject
:
LyLayout
methods
-
LyLayout.
stringOutput
()¶
Methods inherited from LyObject
:
LyLilypondHeader¶
-
class
music21.lily.lilyObjects.
LyLilypondHeader
(lilypondHeaderBody=None)¶ A header object with a headerbody
>>> lyh = lily.lilyObjects.LyLilypondHeader() >>> str(lyh) '\\header { } '
LyLilypondHeader
bases
LyLilypondHeader
read-only properties
Read-only properties inherited from LyObject
:
LyLilypondHeader
methods
-
LyLilypondHeader.
stringOutput
()¶
Methods inherited from LyObject
:
LyLilypondHeaderBody¶
-
class
music21.lily.lilyObjects.
LyLilypondHeaderBody
(assignments=None)¶
LyLilypondHeaderBody
bases
LyLilypondHeaderBody
read-only properties
Read-only properties inherited from LyObject
:
LyLilypondHeaderBody
methods
-
LyLilypondHeaderBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyLilypondTop¶
-
class
music21.lily.lilyObjects.
LyLilypondTop
(contents=None)¶ corresponds to the highest level lilypond object in Appendix C:
`lilypond: /* empty */ | lilypond toplevel_expression | lilypond assignment | lilypond error | lilypond "\invalid"`
error and invalid are not defined by music21
LyLilypondTop
bases
LyLilypondTop
read-only properties
Read-only properties inherited from LyObject
:
LyLilypondTop
methods
-
LyLilypondTop.
stringOutput
()¶
Methods inherited from LyObject
:
LyLyricElement¶
-
class
music21.lily.lilyObjects.
LyLyricElement
(lyMarkupOrString=None)¶ Object represents a single Lyric in lilypond.
>>> lle = lily.lilyObjects.LyLyricElement("hel_") >>> lle <music21.lily.lilyObjects.LyLyricElement object 'hel_'> >>> print(lle) hel_
LyLyricElement
bases
LyLyricElement
read-only properties
Read-only properties inherited from LyObject
:
LyLyricElement
methods
-
LyLyricElement.
stringOutput
()¶
Methods inherited from LyObject
:
LyLyricMarkup¶
-
class
music21.lily.lilyObjects.
LyLyricMarkup
¶
LyLyricMarkup
bases
LyLyricMarkup
read-only properties
Read-only properties inherited from LyObject
:
LyLyricMarkup
methods
-
LyLyricMarkup.
stringOutput
()¶
Methods inherited from LyObject
:
LyMarkup¶
-
class
music21.lily.lilyObjects.
LyMarkup
(simpleMarkup=None, optionalMarkupHeadList=None)¶
LyMarkup
bases
LyMarkup
read-only properties
Read-only properties inherited from LyObject
:
LyMarkup
methods
-
LyMarkup.
stringOutput
()¶
Methods inherited from LyObject
:
LyMarkupBracedList¶
-
class
music21.lily.lilyObjects.
LyMarkupBracedList
(listBody=None)¶
LyMarkupBracedList
bases
LyMarkupBracedList
read-only properties
Read-only properties inherited from LyObject
:
LyMarkupBracedList
methods
-
LyMarkupBracedList.
stringOutput
()¶
Methods inherited from LyObject
:
LyMarkupBracedListBody¶
-
class
music21.lily.lilyObjects.
LyMarkupBracedListBody
(markupOrMarkupList=None)¶
LyMarkupBracedListBody
bases
LyMarkupBracedListBody
read-only properties
Read-only properties inherited from LyObject
:
LyMarkupBracedListBody
methods
-
LyMarkupBracedListBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyMarkupComposedList¶
-
class
music21.lily.lilyObjects.
LyMarkupComposedList
(markupHeadList=None, markupBracedList=None)¶
LyMarkupComposedList
bases
LyMarkupComposedList
read-only properties
Read-only properties inherited from LyObject
:
LyMarkupComposedList
methods
-
LyMarkupComposedList.
stringOutput
()¶
Methods inherited from LyObject
:
LyMarkupList¶
-
class
music21.lily.lilyObjects.
LyMarkupList
(markupIdentifierOrList=None)¶
LyMarkupList
bases
LyMarkupList
read-only properties
Read-only properties inherited from LyObject
:
LyMarkupList
methods
-
LyMarkupList.
stringOutput
()¶
Methods inherited from LyObject
:
LyMarkupTop¶
-
class
music21.lily.lilyObjects.
LyMarkupTop
(argument1=None, argument2=None)¶
LyMarkupTop
bases
LyMarkupTop
read-only properties
Read-only properties inherited from LyObject
:
LyMarkupTop
methods
-
LyMarkupTop.
stringOutput
()¶
Methods inherited from LyObject
:
LyMock¶
-
class
music21.lily.lilyObjects.
LyMock
¶ A test object for trying various music21 to Lily conversions
LyMock
bases
LyMock
read-only properties
Read-only properties inherited from LyObject
:
LyMock
methods
Methods inherited from LyObject
:
LyModeChangingHead¶
-
class
music21.lily.lilyObjects.
LyModeChangingHead
(hasContext=False, mode=None)¶ represents both mode_changing_head and mode_changing_head_with_context
.hasContext = False .mode = [‘note’, ‘drum’, ‘figure’, ‘chord’, ‘lyric’]
>>> l = lily.lilyObjects.LyModeChangingHead(hasContext=True, mode = 'drum') >>> print(l.stringOutput()) \drummode >>> l2 = lily.lilyObjects.LyModeChangingHead(hasContext=False, mode = 'chord') >>> print(l2.stringOutput()) \chords
LyModeChangingHead
bases
LyModeChangingHead
read-only properties
Read-only properties inherited from LyObject
:
LyModeChangingHead
methods
-
LyModeChangingHead.
stringOutput
()¶
Methods inherited from LyObject
:
LyMultipliedDuration¶
-
class
music21.lily.lilyObjects.
LyMultipliedDuration
(stenoDur=None, multiply=None)¶ represents either a simple LyStenoDuration or a list of things that the steno duration should be multiplied by.
if stenoDur is None then output is None – thus also represents optional_notemode_duration
LyMultipliedDuration
bases
LyMultipliedDuration
read-only properties
Read-only properties inherited from LyObject
:
LyMultipliedDuration
methods
-
LyMultipliedDuration.
stringOutput
()¶
Methods inherited from LyObject
:
LyMusic¶
-
class
music21.lily.lilyObjects.
LyMusic
(simpleMusic=None, compositeMusic=None)¶
LyMusic
bases
LyMusic
read-only properties
Read-only properties inherited from LyObject
:
LyMusic
methods
-
LyMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyMusicList¶
-
class
music21.lily.lilyObjects.
LyMusicList
(contents=None)¶ can take any number of LyMusic, LyEmbeddedScm, or LyError objects
LyMusicList
bases
LyMusicList
read-only properties
Read-only properties inherited from LyObject
:
LyMusicList
methods
-
LyMusicList.
stringOutput
()¶
Methods inherited from LyObject
:
LyMusicPropertyDef¶
-
class
music21.lily.lilyObjects.
LyMusicPropertyDef
(isOnce=False, propertyDef=None)¶
LyMusicPropertyDef
bases
LyMusicPropertyDef
read-only properties
Read-only properties inherited from LyObject
:
LyMusicPropertyDef
methods
-
LyMusicPropertyDef.
stringOutput
()¶
Methods inherited from LyObject
:
LyNewLyrics¶
-
class
music21.lily.lilyObjects.
LyNewLyrics
(groupedMusicLists=None)¶ contains a list of LyGroupedMusicList objects or identifiers
LyNewLyrics
bases
LyNewLyrics
read-only properties
Read-only properties inherited from LyObject
:
LyNewLyrics
methods
-
LyNewLyrics.
stringOutput
()¶
Methods inherited from LyObject
:
LyNoteChordElement¶
-
class
music21.lily.lilyObjects.
LyNoteChordElement
(chordBody=None, optionalNoteModeDuration=None, postEvents=None)¶
LyNoteChordElement
bases
LyNoteChordElement
read-only properties
Read-only properties inherited from LyObject
:
LyNoteChordElement
methods
-
LyNoteChordElement.
stringOutput
()¶
Methods inherited from LyObject
:
LyNumberExpression¶
-
class
music21.lily.lilyObjects.
LyNumberExpression
(numberAndSepList=None)¶ any list of numbers or LyNumberTerms separated by ‘+’ or ‘-‘ objects.
LyNumberExpression
bases
LyNumberExpression
read-only properties
Read-only properties inherited from LyObject
:
LyNumberExpression
methods
-
LyNumberExpression.
stringOutput
()¶
Methods inherited from LyObject
:
LyNumberTerm¶
-
class
music21.lily.lilyObjects.
LyNumberTerm
(numberAndSepList=None)¶ any list of numbers separated by ‘*’ or ‘/’ strings.
LyNumberTerm
bases
LyNumberTerm
read-only properties
Read-only properties inherited from LyObject
:
LyNumberTerm
methods
-
LyNumberTerm.
stringOutput
()¶
Methods inherited from LyObject
:
LyObject¶
-
class
music21.lily.lilyObjects.
LyObject
¶
LyObject
read-only properties
-
LyObject.
newlineIndent
¶
LyObject
methods
-
LyObject.
ancestorList
()¶ returns a list of all unwrapped parent objects for the current object
-
LyObject.
comment
(stringIn)¶ returns a comment that is %{ stringIn.strip() %}
Don’t put %} etc. in comments. That’s just rude...
-
LyObject.
encloseCurly
(arg)¶
-
LyObject.
getAncestorByClass
(classObj, getAncestorNumber=1)¶
-
LyObject.
getFirstNonNoneAttribute
(attributeList)¶
-
LyObject.
getParent
()¶
-
LyObject.
newlineSeparateStringOutputIfNotNone
(contents)¶
-
LyObject.
quoteString
(stringIn)¶ returns a string that is quoted with internal quotation marks backslash’d out and an extra space at the end.
>>> m = lily.lilyObjects.LyObject() >>> print(m.quoteString(r'Hello "there"!')) "Hello \"there\"!"
-
LyObject.
setAttributes
(m21Object)¶ Returns a dictionary and sets self.lilyAttributes to that dictionary, for a m21Object of class classLookup using the mapping of self.m21toLy[classLookup]
>>> class Mock(base.Music21Object): pass >>> m = Mock() >>> m.mockAttribute = 32 >>> m.mockAttribute2 = None
>>> lm = lily.lilyObjects.LyMock()
LyMock (our test class) defines mappings for two classes: to LyMock.lilyAttributes:
>>> print(lm.supportedClasses) [...'Mock', ...'Mocker']
Thus we can get attributes from the Mock class (see setAttributesFromClassObject):
>>> lilyAttributes = lm.setAttributes(m) >>> for x in sorted(lilyAttributes.keys()): ... print("%s: %s" % (x, lilyAttributes[x])) mock-attribute: 32 mock-attribute-2: None
>>> lilyAttributes is lm.lilyAttributes True
-
LyObject.
setAttributesFromClassObject
(classLookup, m21Object)¶ Returns a dictionary and sets self.lilyAttributes to that dictionary, for a m21Object of class classLookup using the mapping of self.m21toLy[classLookup]
>>> class Mock(base.Music21Object): pass >>> m = Mock() >>> lm = lily.lilyObjects.LyMock()
LyMock (our test class) defines certain mappings from the m21 Mock class to LyMock.lilyAttributes:
>>> for x in sorted(lm.m21toLy['Mock'].keys()): ... print("%s: %s" % (x, lm.m21toLy['Mock'][x])) mockAttribute: mock-attribute mockAttribute2: mock-attribute-2
Some of these attributes have defaults:
>>> for x in sorted(lm.defaultAttributes.keys()): ... print("%s: %s" % (x, lm.defaultAttributes[x])) mockAttribute2: 7
>>> m.mockAttribute = "hello"
>>> lilyAttributes = lm.setAttributesFromClassObject('Mock', m) >>> for x in sorted(lilyAttributes.keys()): ... print("%s: %s" % (x, lilyAttributes[x])) mock-attribute: hello mock-attribute-2: 7
>>> lilyAttributes is lm.lilyAttributes True
-
LyObject.
setParent
(parentObject)¶
-
LyObject.
stringOutput
()¶
LyOctaveCheck¶
-
class
music21.lily.lilyObjects.
LyOctaveCheck
(equalOrQuotesOrNone=None)¶
LyOctaveCheck
bases
LyOctaveCheck
read-only properties
Read-only properties inherited from LyObject
:
LyOctaveCheck
methods
-
LyOctaveCheck.
stringOutput
()¶
Methods inherited from LyObject
:
LyOptionalId¶
-
class
music21.lily.lilyObjects.
LyOptionalId
(content=None)¶ an optional id setting
LyOptionalId
bases
LyOptionalId
read-only properties
Read-only properties inherited from LyObject
:
LyOptionalId
methods
-
LyOptionalId.
stringOutput
()¶
Methods inherited from LyObject
:
LyOptionalRest¶
-
class
music21.lily.lilyObjects.
LyOptionalRest
(rest=False)¶
LyOptionalRest
bases
LyOptionalRest
read-only properties
Read-only properties inherited from LyObject
:
LyOptionalRest
methods
-
LyOptionalRest.
stringOutput
()¶
Methods inherited from LyObject
:
LyOssiaMusic¶
-
class
music21.lily.lilyObjects.
LyOssiaMusic
(musicList=None, startstop=True)¶ represents ossia music.
Can be tagged with startStaff and stopStaff if startstop is True
LyOssiaMusic
bases
LyOssiaMusic
read-only properties
Read-only properties inherited from LyObject
:
LyOssiaMusic
methods
-
LyOssiaMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyOutputDef¶
-
class
music21.lily.lilyObjects.
LyOutputDef
(outputDefBody=None)¶ ugly grammar since it doesnt close curly bracket...
LyOutputDef
bases
LyOutputDef
read-only properties
Read-only properties inherited from LyObject
:
LyOutputDef
methods
-
LyOutputDef.
stringOutput
()¶
Methods inherited from LyObject
:
LyOutputDefBody¶
-
class
music21.lily.lilyObjects.
LyOutputDefBody
(outputDefHead=None, outputDefIdentifier=None, outputDefBody=None, assignment=None, contextDefSpecBlock=None, error=None)¶ - output_def_body: output_def_head_with_mode_switch ‘{‘
- output_def_head_with_mode_switch ‘{‘ OUTPUT_DEF_IDENTIFIERoutput_def_body assignmentoutput_def_body context_def_spec_blockoutput_def_body error
LyOutputDefBody
bases
LyOutputDefBody
read-only properties
Read-only properties inherited from LyObject
:
LyOutputDefBody
methods
-
LyOutputDefBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyOutputDefHead¶
-
class
music21.lily.lilyObjects.
LyOutputDefHead
(defType=None)¶ defType can be paper, midi, or layout.
>>> lyODH = lily.lilyObjects.LyOutputDefHead() >>> lyODH.defType = 'midi' >>> print(lyODH.stringOutput()) \midi
According to Appendix C, is the same as LyOutputDefHeadWithModeSwitch
LyOutputDefHead
bases
LyOutputDefHead
read-only properties
Read-only properties inherited from LyObject
:
LyOutputDefHead
methods
-
LyOutputDefHead.
stringOutput
()¶
Methods inherited from LyObject
:
LyPaperBlock¶
-
class
music21.lily.lilyObjects.
LyPaperBlock
(outputDef=None)¶
LyPaperBlock
bases
LyPaperBlock
read-only properties
Read-only properties inherited from LyObject
:
LyPaperBlock
methods
-
LyPaperBlock.
stringOutput
()¶
Methods inherited from LyObject
:
LyPitch¶
-
class
music21.lily.lilyObjects.
LyPitch
(noteNamePitch=None, quotes=None)¶ represents a pitch name and zero or more sup or sub quotes also used for steno_pitch and steno_tonic_pitch
LyPitch
bases
LyPitch
read-only properties
Read-only properties inherited from LyObject
:
LyPitch
methods
-
LyPitch.
stringOutput
()¶
Methods inherited from LyObject
:
LyPostEvent¶
-
class
music21.lily.lilyObjects.
LyPostEvent
(arg1=None, arg2=None)¶
LyPostEvent
bases
LyPostEvent
read-only properties
Read-only properties inherited from LyObject
:
LyPostEvent
methods
-
LyPostEvent.
stringOutput
()¶
Methods inherited from LyObject
:
LyPostEvents¶
-
class
music21.lily.lilyObjects.
LyPostEvents
(eventList=None)¶
LyPostEvents
bases
LyPostEvents
read-only properties
Read-only properties inherited from LyObject
:
LyPostEvents
methods
-
LyPostEvents.
stringOutput
()¶
Methods inherited from LyObject
:
LyPrefixCompositeMusic¶
-
class
music21.lily.lilyObjects.
LyPrefixCompositeMusic
(type=None, genericPrefixMusicScm=None, simpleString=None, optionalId=None, optionalContextMod=None, music=None, fraction=None, repeatedMusic=None, pitchAlsoInChords1=None, pitchAlsoInChords2=None, modeChangingHead=None, groupedMusicList=None, modeChangingHeadWithContext=None, relativeMusic=None, reRhythmedMusic=None)¶ type must be specified. Should be one of:
scheme, context, new, times, repeated, transpose, modeChanging, modeChangingWith, relative, rhythmed
- prefix_composite_music: generic_prefix_music_scm
- “context” simple_string optional_id optional_context_mod music“new” simple_string optional_id optional_context_mod music“times” fraction musicrepeated_music“transpose” pitch_also_in_chords pitch_also_in_chords musicmode_changing_head grouped_music_listmode_changing_head_with_context optional_context_mod grouped_music_listrelative_musicre_rhythmed_music
LyPrefixCompositeMusic
bases
LyPrefixCompositeMusic
read-only properties
Read-only properties inherited from LyObject
:
LyPrefixCompositeMusic
methods
-
LyPrefixCompositeMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyPropertyOperation¶
-
class
music21.lily.lilyObjects.
LyPropertyOperation
(mode=None, value1=None, value2=None, value3=None)¶ Represents:
- property_operation: STRING ‘=’ scalar
- “\unset” simple_string“override” simple_string property_path ‘=’ scalar“revert” simple_string embedded_scm
manditory mode in [‘set’, ‘unset’, ‘override’, ‘revert’]
also represents simple_music_property_def which has the same forms
LyPropertyOperation
bases
LyPropertyOperation
read-only properties
Read-only properties inherited from LyObject
:
LyPropertyOperation
methods
-
LyPropertyOperation.
stringOutput
()¶
Methods inherited from LyObject
:
LyPropertyPath¶
-
class
music21.lily.lilyObjects.
LyPropertyPath
(embeddedScheme=None)¶ represents both property_path and property_path_revved
has one or more of LyEmbeddedScm objects
LyPropertyPath
bases
LyPropertyPath
read-only properties
Read-only properties inherited from LyObject
:
LyPropertyPath
methods
-
LyPropertyPath.
stringOutput
()¶
Methods inherited from LyObject
:
LyReRhythmedMusic¶
-
class
music21.lily.lilyObjects.
LyReRhythmedMusic
(groupedMusic=None, newLyrics=None)¶
LyReRhythmedMusic
bases
LyReRhythmedMusic
read-only properties
Read-only properties inherited from LyObject
:
LyReRhythmedMusic
methods
-
LyReRhythmedMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyRelativeMusic¶
-
class
music21.lily.lilyObjects.
LyRelativeMusic
(content=None)¶ relative music
LyRelativeMusic
bases
LyRelativeMusic
read-only properties
Read-only properties inherited from LyObject
:
LyRelativeMusic
methods
-
LyRelativeMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyRepeatedMusic¶
-
class
music21.lily.lilyObjects.
LyRepeatedMusic
(simpleString=None, unsignedNumber=None, music=None, alternativeMusic=None)¶
LyRepeatedMusic
bases
LyRepeatedMusic
read-only properties
Read-only properties inherited from LyObject
:
LyRepeatedMusic
methods
-
LyRepeatedMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LySchemeFunction¶
-
class
music21.lily.lilyObjects.
LySchemeFunction
(content=None)¶ Unsupported for now, represents all of:
function_scm_argument: embedded_scm 116 | simple_string 117 function_arglist_music_last: EXPECT_MUSIC function_arglist music 118 function_arglist_nonmusic_last: EXPECT_MARKUP function_arglist full_markup 119 | EXPECT_MARKUP function_arglist simple_string 120 | EXPECT_SCM function_arglist function_scm_argument 121 function_arglist_nonmusic: EXPECT_NO_MORE_ARGS 122 | EXPECT_MARKUP function_arglist_nonmusic full_markup 123 | EXPECT_MARKUP function_arglist_nonmusic simple_string 124 | EXPECT_SCM function_arglist_nonmusic function_scm_argument 125 function_arglist: EXPECT_NO_MORE_ARGS 126 | function_arglist_music_last 127 | function_arglist_nonmusic_last 128 generic_prefix_music_scm: MUSIC_FUNCTION function_arglist
We have ususally been using LyEmbeddedScm for this
LySchemeFunction
bases
LySchemeFunction
read-only properties
Read-only properties inherited from LyObject
:
LySchemeFunction
methods
-
LySchemeFunction.
stringOutput
()¶
Methods inherited from LyObject
:
LyScoreBlock¶
-
class
music21.lily.lilyObjects.
LyScoreBlock
(scoreBody=None)¶ represents the container for a score ( score { ... } )
with all the real stuff being in self.scoreBody
>>> lysb = lily.lilyObjects.LyScoreBlock(scoreBody = "hello") >>> print(lysb) \score { hello }
LyScoreBlock
bases
LyScoreBlock
read-only properties
Read-only properties inherited from LyObject
:
LyScoreBlock
methods
-
LyScoreBlock.
stringOutput
()¶
Methods inherited from LyObject
:
LyScoreBody¶
-
class
music21.lily.lilyObjects.
LyScoreBody
(music=None, scoreIdentifier=None, scoreBody=None, lilypondHeader=None, outputDef=None, error=None)¶ represents the contents of a score { ...contents... } block
can take one of the following attributes: music, scoreIdentifier, scoreBody, lilypondHeader, outputDef, error
LyScoreBody
bases
LyScoreBody
read-only properties
Read-only properties inherited from LyObject
:
LyScoreBody
methods
-
LyScoreBody.
stringOutput
()¶
Methods inherited from LyObject
:
LyScriptAbbreviation¶
-
class
music21.lily.lilyObjects.
LyScriptAbbreviation
(value=None)¶ Holds a script abbreviation (for articulations etc.), one of:
^ + - | > . _
LyScriptAbbreviation
bases
LyScriptAbbreviation
read-only properties
Read-only properties inherited from LyObject
:
LyScriptAbbreviation
methods
-
LyScriptAbbreviation.
stringOutput
()¶
Methods inherited from LyObject
:
LyScriptDir¶
-
class
music21.lily.lilyObjects.
LyScriptDir
(value=None)¶ Holds a script direction abbreviation (above below etc), one of:
_ ^ -
LyScriptDir
bases
LyScriptDir
read-only properties
Read-only properties inherited from LyObject
:
LyScriptDir
methods
-
LyScriptDir.
stringOutput
()¶
Methods inherited from LyObject
:
LySequentialMusic¶
-
class
music21.lily.lilyObjects.
LySequentialMusic
(musicList=None, displayTag=False, beforeMatter=None)¶ represents sequential music.
Can be explicitly tagged with “sequential” if displayTag is True
LySequentialMusic
bases
LySequentialMusic
read-only properties
Read-only properties inherited from LyObject
:
LySequentialMusic
methods
-
LySequentialMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LySimpleElement¶
-
class
music21.lily.lilyObjects.
LySimpleElement
(parts=None)¶ A single note, lyric element, drum pitch or hidden rest:
simple_element: pitch exclamations (a string of zero or more ! marks) questions (a string of zero or more ? marks) octave_check optional_notemode_duration optional_rest | DRUM_PITCH optional_notemode_duration | RESTNAME optional_notemode_duration | lyric_element optional_notemode_duration
LySimpleElement
bases
LySimpleElement
read-only properties
Read-only properties inherited from LyObject
:
LySimpleElement
methods
-
LySimpleElement.
stringOutput
()¶
Methods inherited from LyObject
:
LySimpleMarkup¶
-
class
music21.lily.lilyObjects.
LySimpleMarkup
(simpleType='string', argument1=None, argument2=None)¶ simpleType can be ‘string’ (or markup identifier or lyric markup identifier, etc.) or ‘score-body’ or ‘markup-function’
takes 1 required arg, 2nd for markup_function
LySimpleMarkup
bases
LySimpleMarkup
read-only properties
Read-only properties inherited from LyObject
:
LySimpleMarkup
methods
-
LySimpleMarkup.
stringOutput
()¶
Methods inherited from LyObject
:
LySimpleMusic¶
-
class
music21.lily.lilyObjects.
LySimpleMusic
(eventChord=None, musicIdentifier=None, musicPropertyDef=None, contextChange=None)¶
LySimpleMusic
bases
LySimpleMusic
read-only properties
Read-only properties inherited from LyObject
:
LySimpleMusic
methods
-
LySimpleMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LySimultaneousMusic¶
-
class
music21.lily.lilyObjects.
LySimultaneousMusic
(musicList=None, displayTag=False)¶ represents simultaneous music.
Can be explicitly tagged with “simultaneous” if displayTag is True otherwise encloses in double angle brackets
LySimultaneousMusic
bases
LySimultaneousMusic
read-only properties
Read-only properties inherited from LyObject
:
LySimultaneousMusic
methods
-
LySimultaneousMusic.
stringOutput
()¶
Methods inherited from LyObject
:
LyStenoDuration¶
-
class
music21.lily.lilyObjects.
LyStenoDuration
(durationNumber=None, numDots=0)¶ the main thing that we think of as non-tuplet duration.
a duration number followed by one or more dots
>>> lsd = lily.lilyObjects.LyStenoDuration('2', 2) >>> print(lsd) 2..
LyStenoDuration
bases
LyStenoDuration
read-only properties
Read-only properties inherited from LyObject
:
LyStenoDuration
methods
-
LyStenoDuration.
stringOutput
()¶
Methods inherited from LyObject
:
LyTempoEvent¶
-
class
music21.lily.lilyObjects.
LyTempoEvent
(tempoRange=None, stenoDuration=None, scalar=None)¶ - tempo_event: “tempo” steno_duration ‘=’ tempo_range
- “tempo” scalar steno_duration ‘=’ tempo_range“tempo” scalar
LyTempoEvent
bases
LyTempoEvent
read-only properties
Read-only properties inherited from LyObject
:
LyTempoEvent
methods
-
LyTempoEvent.
stringOutput
()¶
Methods inherited from LyObject
:
LyTempoRange¶
-
class
music21.lily.lilyObjects.
LyTempoRange
(lowestOrOnlyTempo=None, highestTempoOrNone=None)¶ defines either a single tempo or a range
LyTempoRange
bases
LyTempoRange
read-only properties
Read-only properties inherited from LyObject
:
LyTempoRange
methods
-
LyTempoRange.
stringOutput
()¶
Methods inherited from LyObject
:
LyTopLevelExpression¶
-
class
music21.lily.lilyObjects.
LyTopLevelExpression
(lilypondHeader=None, bookBlock=None, bookPartBlock=None, scoreBlock=None, compositeMusic=None, fullMarkup=None, fullMarkupList=None, outputDef=None)¶ can contain one of:
lilypondHeader bookBlock bookPartBlock scoreBlock compositeMusic fullMarkup fullMarkupList outputDef>>> bookBlock = lily.lilyObjects.LyBookBlock() >>> lytle = lily.lilyObjects.LyTopLevelExpression(bookBlock=bookBlock) >>> str(lytle) '\\book { } '
LyTopLevelExpression
bases
LyTopLevelExpression
read-only properties
Read-only properties inherited from LyObject
:
LyTopLevelExpression
methods
-
LyTopLevelExpression.
stringOutput
()¶
Methods inherited from LyObject
:
LyTremoloType¶
-
class
music21.lily.lilyObjects.
LyTremoloType
(tremTypeOrNone=None)¶
LyTremoloType
bases
LyTremoloType
read-only properties
Read-only properties inherited from LyObject
:
LyTremoloType
methods
-
LyTremoloType.
stringOutput
()¶
Methods inherited from LyObject
: