Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Generation
diff options
context:
space:
mode:
authorOli2 <olivier.belanger@umontreal.ca>2007-03-13 01:15:40 (GMT)
committer Oli2 <olivier.belanger@umontreal.ca>2007-03-13 01:15:40 (GMT)
commit74272d1d9f7848aaeabebc85e94863988f8795be (patch)
tree3f28d2c8f218dd0b6209a5887180a0331844938f /Generation
parentc4446c5cfe941555a78ecb24e475113909a6c37e (diff)
algo onset values
Diffstat (limited to 'Generation')
-rwxr-xr-xGeneration/GenerationConstants.py2
-rw-r--r--Generation/GenerationRythm.py21
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)