Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/common/Generation/GenerationRythm.py
diff options
context:
space:
mode:
authorOli <olivier.belanger@umontreal.ca>2007-10-19 08:08:02 (GMT)
committer Oli <olivier.belanger@umontreal.ca>2007-10-19 08:08:02 (GMT)
commit3e9a586f404b70cda362cf888653de9c940fd849 (patch)
tree427a99619ebf947600a3cc2c0ef9437fb2953f09 /common/Generation/GenerationRythm.py
parent9307df223f0be4193a21fddd48e32ce15b9ed4ef (diff)
switch to instrumentDB
Diffstat (limited to 'common/Generation/GenerationRythm.py')
-rw-r--r--common/Generation/GenerationRythm.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/common/Generation/GenerationRythm.py b/common/Generation/GenerationRythm.py
index 5e1b31d..583f642 100644
--- a/common/Generation/GenerationRythm.py
+++ b/common/Generation/GenerationRythm.py
@@ -1,10 +1,13 @@
import Utils
import random
from math import sqrt
+import common.Util.InstrumentDB as InstrumentDB
import common.Config as Config
from common.Generation.GenerationConstants import GenerationConstants
class GenerationRythm:
+ def __init__(self):
+ self.instrumentDB = InstrumentDB.getRef()
def celluleRythmSequence(self, parameters, barLength, trackId, trackInstrument=None ):
rythmSequence = [0, ]
@@ -85,7 +88,6 @@ class GenerationRythm:
rythmSequence = []
onsetTime = None
randomParamScaler = parameters.rythmRegularity[trackId] * 2 + 0.5
-# need radioButton with 0 for random choose and each generator independant
whichRandomGenerator = random.randint(0, 4)
maximumNumberOfNotes = int( (parameters.density[trackId]) * GenerationConstants.MAX_NOTES_PER_BAR)
@@ -133,7 +135,7 @@ class GenerationRythm:
upBeatsAppend = upBeats.append
- if Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.PUNCH:
+ if self.instrumentDB.instNamed[ trackInstrument ].instrumentRegister == Config.PUNCH:
registerDensity = 0.5
downBeatRecurence = 4
upBeatOffset = Config.TICKS_PER_BEAT / 2
@@ -141,7 +143,7 @@ class GenerationRythm:
for downBeat in downBeats:
upBeatsAppend( downBeat + upBeatOffset )
- elif Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.LOW:
+ elif self.instrumentDB.instNamed[ trackInstrument ].instrumentRegister == Config.LOW:
registerDensity = 1.5
downBeatRecurence = 4
upBeatOffset = Config.TICKS_PER_BEAT / 2
@@ -149,7 +151,7 @@ class GenerationRythm:
for downBeat in downBeats:
upBeatsAppend( downBeat + upBeatOffset )
- elif Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.MID:
+ elif self.instrumentDB.instNamed[ trackInstrument ].instrumentRegister == Config.MID:
registerDensity = 1
downBeatRecurence = 1
upBeatOffset = Config.TICKS_PER_BEAT / 4
@@ -157,7 +159,7 @@ class GenerationRythm:
for downBeat in downBeats:
upBeatsAppend( downBeat + upBeatOffset )
- elif Config.INSTRUMENTS[ trackInstrument ].instrumentRegister == Config.HIGH:
+ elif self.instrumentDB.instNamed[ trackInstrument ].instrumentRegister == Config.HIGH:
registerDensity = 1.5
downBeatRecurence = 1
upBeatOffset = Config.TICKS_PER_BEAT / 4