Beispiel #1
0
 def system_exclusive(self, data):
     """
     data: list of values in range(128)
     """
     sysex_len = writeVar(len(data) + 1)
     self.event_slice(
         chr(SYSTEM_EXCLUSIVE) + sysex_len + data + chr(END_OFF_EXCLUSIVE))
Beispiel #2
0
 def end_of_track(self):
     """
     Writes the track to the buffer.
     """
     raw = self.raw_out
     raw.writeSlice(TRACK_HEADER)
     track_data = self._current_track_buffer.getvalue()
     # wee need to know size of track data.
     eot_slice = writeVar(self.rel_time()) + fromBytes([META_EVENT, END_OF_TRACK, 0])
     raw.writeBew(len(track_data)+len(eot_slice), 4)
     # then write
     raw.writeSlice(track_data)
     raw.writeSlice(eot_slice)
Beispiel #3
0
 def meta_slice(self, meta_type, data_slice):
     "Writes a meta event"
     slc = fromBytes([META_EVENT, meta_type]) + \
                      writeVar(len(data_slice)) +  data_slice
     self.event_slice(slc)
 def writeVarLen(self, value):
     "Writes a variable length word to the file"
     var = self.writeSlice(writeVar(value))