libmidi.utils.time
MIDI time utils.
Functions
|
Convert beats per minute to MIDI file tempo. |
|
Convert absolute time in seconds to ticks. |
|
Convert MIDI file tempo to BPM. |
|
Convert absolute time in ticks to seconds. |
|
Convert messages to absolute time. |
|
Convert messages to relative time. |
- libmidi.utils.time.bpm2tempo(bpm)
Convert beats per minute to MIDI file tempo.
Returns microseconds per beat as an integer:
240 => 250000 120 => 500000 60 => 1000000
- libmidi.utils.time.second2tick(second, ticks_per_beat, tempo)
Convert absolute time in seconds to ticks.
Returns absolute time in ticks for a chosen MIDI file time resolution (ticks per beat, also called PPQN or pulses per quarter note) and tempo (microseconds per beat).
- libmidi.utils.time.tempo2bpm(tempo)
Convert MIDI file tempo to BPM.
Returns BPM as an integer or float:
250000 => 240 500000 => 120 1000000 => 60
- libmidi.utils.time.tick2second(tick, ticks_per_beat, tempo)
Convert absolute time in ticks to seconds.
Returns absolute time in seconds for a chosen MIDI file time resolution (ticks per beat, also called PPQN or pulses per quarter note) and tempo (microseconds per beat).