def addTempo(self, offset, beats): """ Create a midi tempo meta event. beats - beats per second Return - packed midi string """ cmd = chr(0xff) + chr(0x51) + chr(0x03) self.delDup(offset, cmd) self.addToTrack( offset, cmd + intTo3Byte(60000000/beats) )
def addTempo(self, offset, beats): """ Create a midi tempo meta event. beats - beats per second Return - packed midi string """ cmd = packBytes((0xff, 0x51, 0x03)) self.delDup(offset, cmd) self.addToTrack(offset, packBytes(cmd, intTo3Byte(60000000 // beats)))
def addTempo(self, offset, bpm): """ Create a midi tempo meta event. bpm - beats per minute Return - packed midi string """ cmd = packBytes((0xff, 0x51, 0x03)) self.delDup(offset, cmd) self.addToTrack(offset, packBytes(cmd, intTo3Byte(60000000 // bpm))) tempoChanges.append([offset, bpm])