@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
"""
Copyright 2020 , Nils Hilbricht , Germany ( https : / / www . hilbricht . net )
Copyright 2020 , Nils Hilbricht , Germany ( https : / / www . hilbricht . net )
@ -657,29 +656,29 @@ class DurationGroup(object):
def createChordOrRest ( completeDuration , pitchlist , velocityModification ) :
def createChordOrRest ( completeDuration , pitchlist , velocityModification ) :
""" Return a Chord or Rest instance.
""" Return a Chord or Rest instance.
The complete duration is the absolute duration after
The complete duration is the absolute duration after
dots , tuplets etc . e . g . generated by midi in .
dots , tuplets etc . e . g . generated by midi in .
Pitchlist can also be empty then it generates rests . But you
Pitchlist can also be empty then it generates rests . But you
have to explicitely set it to empty .
have to explicitely set it to empty .
This is used by the pattern generator which supports both
This is used by the pattern generator which supports both
rests and chords and works by absolute durations .
rests and chords and works by absolute durations .
"""
"""
durationObject = Duration . createByGuessing ( completeDuration )
durationObject = Duration . createByGuessing ( completeDuration )
dynamic = Dynamic ( )
dynamic = Dynamic ( )
dynamic . velocityModification = velocityModification
dynamic . velocityModification = velocityModification
if pitchlist : #chord
if pitchlist : #chord
new = Chord ( firstDuration = durationObject , firstPitch = pitchlist [ 0 ] )
new = Chord ( firstDuration = durationObject , firstPitch = pitchlist [ 0 ] )
for pitch in pitchlist [ 1 : ] :
for pitch in pitchlist [ 1 : ] :
new . addNote ( pitch )
new . addNote ( pitch )
for note in new . notelist :
for note in new . notelist :
note . dynamic = dynamic . copy ( )
note . dynamic = dynamic . copy ( )
else :
else :
new = Rest ( durationObject )
new = Rest ( durationObject )
return new
return new
class Item ( object ) :
class Item ( object ) :
@ -2829,6 +2828,8 @@ class ChannelChange(Item):
else :
else :
return " "
return " "
#Note in use.
class RecordedNote ( Item ) :
class RecordedNote ( Item ) :
""" An intermediate item that gets created by the live recording process.
""" An intermediate item that gets created by the live recording process.
It has no Duration instance but a simple tick duration instead .
It has no Duration instance but a simple tick duration instead .
@ -2840,7 +2841,7 @@ class RecordedNote(Item):
def __init__ ( self , itemData ) :
def __init__ ( self , itemData ) :
""" Either init gets called, by creation during runtime, or instanceFromSerializedData.
""" Either init gets called, by creation during runtime, or instanceFromSerializedData.
That means everything in init must be matched by a loading call in instanceFromSerializedData . """
That means everything in init must be matched by a loading call in instanceFromSerializedData . """
super ( ) . __init__ ( positionInTicks , durationInTicks )
super ( ) . __init__ ( positionInTicks , durationInTicks ) #TODO: that is not super._init of item. Item has no parameters!
self . positionInTicks = positionInTicks
self . positionInTicks = positionInTicks
self . durationInTicks = durationInTicks
self . durationInTicks = durationInTicks