How to correctly convert MIDI ticks to milliseconds?

后端 未结 2 1450
被撕碎了的回忆
被撕碎了的回忆 2021-02-13 18:36

I\'m trying to convert MIDI ticks/delta time to milliseconds and have found a few helpful resources already:

  1. MIDI Delta Time Ticks to Seconds
  2. How to conve
2条回答
  •  难免孤独
    2021-02-13 19:22

    You might want to increase the frame rate. On my system, increasing clock.tick(30) to clock.tick(300) gives good results. You can measure this by printing how much your timing is off:

    print self.t0[self.event_id].text, millis - self.now - deltaMillis
    

    With 30 ticks the cues are lagging 20 to 30 millisecond behind. With 300 ticks they are at most 2 milliseconds behind. You might want to increase this even further.

    Just to be safe you should run python with the -u switch to prevent stdout from buffering (this might be unnecessary, since lines end with newline).

    I have a hard time determining the timing, but judging from the "Ah ha ha ha"'s it seems to be correct with these changes.

提交回复
热议问题