diff options
author | Oli2 <olivier.belanger@umontreal.ca> | 2007-03-08 02:23:19 (GMT) |
---|---|---|
committer | Oli2 <olivier.belanger@umontreal.ca> | 2007-03-08 02:23:19 (GMT) |
commit | 5935ef05a3ec865b7c08c334f36bb974eb5c9b53 (patch) | |
tree | 1eb8326e9120bddc90f0a5a5b7d3dea85d6f0789 /miniTamTam | |
parent | b579a2d0c893cc5b236029c717bc8016c9b920b9 (diff) |
sequencer and other little bugs
Diffstat (limited to 'miniTamTam')
-rw-r--r-- | miniTamTam/KeyboardStandAlone.py | 2 | ||||
-rw-r--r-- | miniTamTam/MiniSequencer.py | 14 |
2 files changed, 12 insertions, 4 deletions
diff --git a/miniTamTam/KeyboardStandAlone.py b/miniTamTam/KeyboardStandAlone.py index 23824a2..a44d1a7 100644 --- a/miniTamTam/KeyboardStandAlone.py +++ b/miniTamTam/KeyboardStandAlone.py @@ -83,7 +83,7 @@ class KeyboardStandAlone: amplitude = 1, pan = 0.5, duration = 100, - trackId = track, + trackId = 0, decay = .1, instrumentId = Config.INSTRUMENTS[instrument].instrumentId, reverbSend = self.reverb, diff --git a/miniTamTam/MiniSequencer.py b/miniTamTam/MiniSequencer.py index 61dafcd..31650d7 100644 --- a/miniTamTam/MiniSequencer.py +++ b/miniTamTam/MiniSequencer.py @@ -64,16 +64,24 @@ class MiniSequencer: self.pitchs.append( note.pitch ) self.sequencer.append( note ) + def quantize( self, onset ): + if ( onset % 3 ) == 0: + return onset + elif ( onset % 3 ) == 1: + return ( onset // 3 ) * 3 + elif ( onset % 3 ) == 2: + return ( ( onset // 3 ) + 1 ) * 3 + def adjustDuration( self, pitch, onset ): if pitch in self.pitchs: offset = self.csnd.loopGetTick() for note in self.sequencer: if note.pitch == pitch and note.onset == onset: if offset > note.onset: - note.duration = ( offset - note.onset ) + 6 + note.duration = ( offset - note.onset ) + 4 else: - note.duration = ( (offset+(self.beat*Config.TICKS_PER_BEAT)) - note.onset ) + 6 - + note.duration = ( (offset+(self.beat*Config.TICKS_PER_BEAT)) - note.onset ) + 4 + note.onset = self.quantize( note.onset ) n = Note(0, note.trackId, self.id, note) self.notesList.append(n) self.id = self.id + 1 |