python-midi icon indicating copy to clipboard operation
python-midi copied to clipboard

When I generate midi with my script, the notes slow down exponentially when played

Open LodenRietveld opened this issue 8 years ago • 4 comments

I wrote a script to generate drum patterns that I use frequently, but when I try to play the midi files I generated, they slow down instead of keeping the same pace. I can't find out if I made an error or if I just don't understand the way midi is in encoded and it's very frustrating.

This is my code: mid.txt

LodenRietveld avatar Sep 21 '16 20:09 LodenRietveld

It sounds like you have your tick counts in absolute when they need to be relative. I'll take a look at the code in a bit, but that's my guess for the moment.

On Sep 21, 2016 16:23, "Loden Rietveld" [email protected] wrote:

I wrote a script to generate drum patterns that I use frequently, but when I try to play the midi files I generated, they slow down instead of keeping the same pace. I can't find out if I made an error or if I just don't understand the way midi is in encoded and it's very frustrating.

This is my code: mid.txt https://github.com/vishnubob/python-midi/files/485982/mid.txt

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vishnubob/python-midi/issues/96, or mute the thread https://github.com/notifications/unsubscribe-auth/AOVJr9oFMuvz_oP-WGKTBW0dR1YEo_7Oks5qsZJPgaJpZM4KDPPo .

semininja avatar Sep 21 '16 20:09 semininja

seconded

vishnubob avatar Sep 21 '16 20:09 vishnubob

yeah I changed it too, but it still happens with pattern/track.make_ticks_rel()

LodenRietveld avatar Sep 21 '16 21:09 LodenRietveld

Try creating the tracks using

track = midi.Track(tick_relative=False)

and remember that pattern.make_ticks_rel() has to be used after you added every event, including EndOfTrack events.

MaurizioB avatar Sep 22 '16 03:09 MaurizioB