diff options
Diffstat (limited to 'Generation')
-rwxr-xr-x | Generation/GenerationConstants.py | 2 | ||||
-rw-r--r-- | Generation/GenerationRythm.py | 21 |
2 files changed, 12 insertions, 11 deletions
diff --git a/Generation/GenerationConstants.py b/Generation/GenerationConstants.py index 1972181..38bcf1e 100755 --- a/Generation/GenerationConstants.py +++ b/Generation/GenerationConstants.py @@ -8,7 +8,7 @@ class GenerationConstants: PHRASE_LENGTH = 4 PHRASE_COMPLEXITY = .5 - TABLE_ONSET_VALUES = [ 3, 4, 6, 8, 12, 18, 24, 36, 48 ] + TABLE_ONSET_VALUES = [ 3, 6, 3, 4, 3, 6, 12, 6, 8, 6, 12, 18, 12, 24, 18, 36, 24, 36, 48 ] # scaling constants MAJOR = 0 diff --git a/Generation/GenerationRythm.py b/Generation/GenerationRythm.py index c211602..b9f4eaa 100644 --- a/Generation/GenerationRythm.py +++ b/Generation/GenerationRythm.py @@ -10,30 +10,31 @@ class GenerationRythm: rythmSequence = [0, ] self.count = 0 lastOnsetTime = 0 + onsetLen = len(GenerationConstants.TABLE_ONSET_VALUES) - onsetValue = int( ( 1 - parameters.density ) * 8 ) - onsetDeviation = int( ( 1 - parameters.rythmRegularity ) * 4 ) + onsetValue = int( ( 1 - parameters.density ) * onsetLen ) + onsetDeviation = int( ( 1 - parameters.rythmRegularity ) * 8 ) currentOnsetValue = onsetValue + ( random.randint( 0, onsetDeviation ) - ( onsetDeviation / 2 ) ) if currentOnsetValue < 0: - currentOnsetValue == 0 - elif currentOnsetValue > 8: - currentOnsetValue == 8 + currentOnsetValue = 0 + elif currentOnsetValue > onsetLen: + currentOnsetValue = onsetLen else: currentOnsetValue = currentOnsetValue onsetDelta = GenerationConstants.TABLE_ONSET_VALUES[ currentOnsetValue ] - + print currentOnsetValue, onsetDelta for i in range( int( barLength / Config.TICKS_PER_BEAT * 8 ) ): if self.count == 0: currentOnsetValue = onsetValue + ( random.randint( 0, onsetDeviation ) - ( onsetDeviation / 2 ) ) if currentOnsetValue < 0: - currentOnsetValue == 0 - elif currentOnsetValue > 8: - currentOnsetValue == 8 + currentOnsetValue = 0 + elif currentOnsetValue > onsetLen: + currentOnsetValue = onsetLen else: currentOnsetValue = currentOnsetValue onsetDelta = GenerationConstants.TABLE_ONSET_VALUES[ currentOnsetValue ] - + print currentOnsetValue, onsetDelta self.makeCellule(onsetDelta, GenerationConstants.DOUBLE_TICK_DUR, GenerationConstants.DOUBLE_HOW_MANY) self.makeCellule(onsetDelta, GenerationConstants.HALF_TRIPLET_TICK_DUR, GenerationConstants.HALF_TRIPLET_HOW_MANY) self.makeCellule(onsetDelta, GenerationConstants.HOLE_TRIPLET_TICK_DUR, GenerationConstants.HOLE_TRIPLET_HOW_MANY) |