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-21 00:02:49 (GMT)
committer Oli2 <olivier.belanger@umontreal.ca>2007-03-21 00:02:49 (GMT)
commit842bed893d32067ea31990755ced77323a597311 (patch)
tree84b6fc28f0e855d2ef8052e7b3f6fd5b0ab398a5 /Generation
parent9e8998571aac0f8641049567c2ce3f4a0227a1c2 (diff)
presets fine tunning
Diffstat (limited to 'Generation')
-rwxr-xr-xGeneration/GenerationConstants.py14
-rw-r--r--Generation/GenerationRythm.py50
2 files changed, 49 insertions, 15 deletions
diff --git a/Generation/GenerationConstants.py b/Generation/GenerationConstants.py
index b31d723..1ee46df 100755
--- a/Generation/GenerationConstants.py
+++ b/Generation/GenerationConstants.py
@@ -30,13 +30,13 @@ class GenerationConstants:
# Default parameters for algorithmic generation
- RYTHM_DENSITY_BANK = [.4, 1., .92, .8, .22]
- RYTHM_REGU_BANK = [.75, .8, .85, .66, .5]
- PITCH_REGU_BANK = [.5, .8, .5, 0, .9]
- PITCH_STEP_BANK = [.5, .7, .15, .8, .15]
- DURATION_BANK = [.8, .8, .8, .87, 1]
- SILENCE_BANK = [.2, .5, .4, .45, .12]
- PATTERN_BANK = [0, 3, 1, 2, 1]
+ RYTHM_DENSITY_BANK = [.25, .88, .92, 1, .22]
+ RYTHM_REGU_BANK = [.75, .8, .85, .5, .5]
+ PITCH_REGU_BANK = [.5, .8, .5, 1, .9]
+ PITCH_STEP_BANK = [.5, .7, .15, .88, .15]
+ DURATION_BANK = [.8, 1, .8, 1, 1]
+ SILENCE_BANK = [.2, .5, .45, .35, .12]
+ PATTERN_BANK = [0, 3, 1, 0, 1]
SCALE_BANK = [MAJOR, NATURAL_MINOR, LYDIEN, HARMONIC_MINOR, MYXOLYDIEN]
chooseDefault = random.randint(0,4)
diff --git a/Generation/GenerationRythm.py b/Generation/GenerationRythm.py
index 56e9199..d210c22 100644
--- a/Generation/GenerationRythm.py
+++ b/Generation/GenerationRythm.py
@@ -23,9 +23,11 @@ class GenerationRythm:
currentOnsetValue = currentOnsetValue
onsetDelta = GenerationConstants.TABLE_ONSET_VALUES[ currentOnsetValue ]
- for i in range( int( barLength / Config.TICKS_PER_BEAT * 8 ) ):
+ listLen = range( int( barLength / Config.TICKS_PER_BEAT * 8 ) )
+ randInt = random.randint
+ for i in listLen:
if self.count == 0:
- currentOnsetValue = onsetValue + ( random.randint( 0, onsetDeviation ) - ( onsetDeviation / 2 ) )
+ currentOnsetValue = onsetValue + ( randInt( 0, onsetDeviation ) - ( onsetDeviation / 2 ) )
if currentOnsetValue < 0:
currentOnsetValue = 0
elif currentOnsetValue > onsetLen:
@@ -33,14 +35,46 @@ class GenerationRythm:
else:
currentOnsetValue = currentOnsetValue
onsetDelta = GenerationConstants.TABLE_ONSET_VALUES[ currentOnsetValue ]
-
- 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)
+
+ if onsetDelta == GenerationConstants.DOUBLE_TICK_DUR:
+ if self.count < (GenerationConstants.DOUBLE_HOW_MANY - 1):
+ self.count += 1
+ else:
+ self.count = 0
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength:
+ rythmSequence.append(onsetTime)
+ continue
+ else:
+ break
+ elif onsetDelta == GenerationConstants.HALF_TRIPLET_TICK_DUR:
+ if self.count < (GenerationConstants.HALF_TRIPLET_HOW_MANY - 1):
+ self.count += 1
+ else:
+ self.count = 0
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength:
+ rythmSequence.append(onsetTime)
+ continue
+ else:
+ break
+ elif onsetDelta == GenerationConstants.HOLE_TRIPLET_TICK_DUR:
+ if self.count < (GenerationConstants.HOLE_TRIPLET_HOW_MANY - 1):
+ self.count += 1
+ else:
+ self.count = 0
+ onsetTime = onsetDelta + lastOnsetTime
+ lastOnsetTime = onsetTime
+ if onsetTime < barLength:
+ rythmSequence.append(onsetTime)
+ continue
+ else:
+ break
onsetTime = onsetDelta + lastOnsetTime
- lastOnsetTime = onsetTime
-
+ lastOnsetTime = onsetTime
if onsetTime < barLength:
rythmSequence.append(onsetTime)
else: