diff options
Diffstat (limited to 'Player/NoteStdAlone.py')
-rw-r--r-- | Player/NoteStdAlone.py | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/Player/NoteStdAlone.py b/Player/NoteStdAlone.py index 9722899..a64bd64 100644 --- a/Player/NoteStdAlone.py +++ b/Player/NoteStdAlone.py @@ -1,7 +1,6 @@ -from Framework.Constants import Constants -from Framework.CSound.CSoundClient import CSoundClient -from Framework.CSound.CSoundConstants import CSoundConstants -from Framework.Generation.GenerationConstants import GenerationConstants +import Config +from Util.CSoundClient import CSoundClient +from Generation.GenerationConstants import GenerationConstants class NoteStdAlone: def __init__( self, client, @@ -12,7 +11,7 @@ class NoteStdAlone: duration, trackID, fullDuration = False, - instrument = CSoundConstants.FLUTE, + instrument = Config.FLUTE, attack = 0.005, decay = 0.095, reverbSend = 0.1, @@ -20,7 +19,7 @@ class NoteStdAlone: filterCutoff = 1000, tied = False, overlap = False, - instrumentFlag = CSoundConstants.FLUTE ): + instrumentFlag = Config.FLUTE ): self.csnd = client self.onset = onset self.pitch = pitch @@ -38,7 +37,7 @@ class NoteStdAlone: self.tied = tied self.overlap = overlap if self.instrument == 'drum1kit': - self.instrumentFlag = CSoundConstants.DRUM1INSTRUMENTS[ self.pitch ] + self.instrumentFlag = Config.DRUM1INSTRUMENTS[ self.pitch ] else: self.instrumentFlag = self.instrument @@ -51,25 +50,25 @@ class NoteStdAlone: self.pitch = GenerationConstants.DRUMPITCH[ self.pitch ] if self.instrument == 'drum1kit': - self.instrumentFlag = CSoundConstants.DRUM1INSTRUMENTS[ self.pitch ] + self.instrumentFlag = Config.DRUM1INSTRUMENTS[ self.pitch ] if self.instrument == 'drum2kit': - self.instrumentFlag = CSoundConstants.DRUM2INSTRUMENTS[ self.pitch ] + self.instrumentFlag = Config.DRUM2INSTRUMENTS[ self.pitch ] if self.instrument == 'drum3kit': - self.instrumentFlag = CSoundConstants.DRUM3INSTRUMENTS[ self.pitch ] + self.instrumentFlag = Config.DRUM3INSTRUMENTS[ self.pitch ] newPitch = 1 else: self.instrumentFlag = self.instrument newPitch = pow( GenerationConstants.TWO_ROOT_TWELVE, self.pitch - 36 ) - oneTickDuration = (Constants.MS_PER_MINUTE / 1000) / tempo / Constants.TICKS_PER_BEAT + oneTickDuration = (Config.MS_PER_MINUTE / 1000) / tempo / Config.TICKS_PER_BEAT newDuration = oneTickDuration * self.duration # condition for tied notes - if CSoundConstants.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentID == 101 and self.tied and self.fullDuration: + if Config.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentID == 101 and self.tied and self.fullDuration: newDuration = -1 # condition for overlaped notes - if CSoundConstants.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentID == 102 and self.overlap: + if Config.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentID == 102 and self.overlap: newDuration = oneTickDuration * self.duration + 1. if True: newAmplitude = self.amplitude * 0.8 @@ -83,10 +82,10 @@ class NoteStdAlone: if newDecay <= 0.002: newDecay = 0.002 - loopStart = CSoundConstants.INSTRUMENTS[ self.instrumentFlag ].loopStart - loopEnd = CSoundConstants.INSTRUMENTS[ self.instrumentFlag ].loopEnd - crossDur = CSoundConstants.INSTRUMENTS[ self.instrumentFlag ].crossDur - return CSoundConstants.PLAY_NOTE_COMMAND % ( CSoundConstants.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentID, + loopStart = Config.INSTRUMENTS[ self.instrumentFlag ].loopStart + loopEnd = Config.INSTRUMENTS[ self.instrumentFlag ].loopEnd + crossDur = Config.INSTRUMENTS[ self.instrumentFlag ].crossDur + return Config.PLAY_NOTE_COMMAND % ( Config.INSTRUMENTS[ self.instrumentFlag ].csoundInstrumentID, self.trackID, 0, newDuration, @@ -94,7 +93,7 @@ class NoteStdAlone: self.reverbSend, newAmplitude, self.pan, - CSoundConstants.INSTRUMENT_TABLE_OFFSET + CSoundConstants.INSTRUMENTS[ self.instrumentFlag ].instrumentID, + Config.INSTRUMENT_TABLE_OFFSET + Config.INSTRUMENTS[ self.instrumentFlag ].instrumentID, newAttack, newDecay, self.filterType, |