Permalink
Browse files

timelyne: Hax in drums.

  • Loading branch information...
1 parent 5dd3bce commit 80279f4c0e7701c0f2b16355842ae2ad38d736ac @MostAwesomeDude committed May 2, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 lye/timelyne.py
View
8 lye/timelyne.py
@@ -44,6 +44,7 @@ class Timelyne(object):
tempo = 120
ticks_per_beat = 120
+ _drum_channel = None
_previous_lynes = None
def __init__(self, library):
@@ -85,6 +86,11 @@ def directive(self, d):
def set_instruments(self, instruments):
for i, instrument in enumerate(instruments):
+ if instrument == "drums":
+ self._drum_channel = i
+ print "%d: Drums"
+ continue
+
instrument = find_instrument(instrument)
print "%d: Instrument %s" % (i, instrument)
self.channels[i].append((INSTRUMENT, instrument))
@@ -135,6 +141,8 @@ def to_midi(self):
f.addTempo(track, 0, self.tempo)
for channel, l in enumerate(self.channels):
+ if self._drum_channel == channel:
+ channel = 9
for t, data in l:
if t is INSTRUMENT:
f.addProgramChange(track, channel, time[channel],

0 comments on commit 80279f4

Please sign in to comment.