Giter Club home page Giter Club logo

Comments (8)

Geromatic avatar Geromatic commented on July 18, 2024

I will check if time is big enough lose for accuracy or affects the sync of the midi file.

from midi-unreal.

stani avatar stani commented on July 18, 2024

I played a file of 230 sec. and measured time between onStart and onStop. It plays about 240 seconds -> 10 sec longer. About 2 sec lost per minute. For something like a rhythm game it's pretty huge.

from midi-unreal.

stani avatar stani commented on July 18, 2024

I figured out that my way of calculating elapsed ticks is wrong if Tempo changes more that once. So, instead I introduced 2 variables: lastTempoTime and lastTempoTick, which are initially set to zero then updated every time the Tempo is changed (set to time and tick of the Tempo event). With that elapsed ticks are calculated this way:

mTicksElapsed = lastTempoTick+ msToTicks(elapsedTime - lastTempoTime, mMPQN, mPPQ);

It seems to work well.

from midi-unreal.

Geromatic avatar Geromatic commented on July 18, 2024

I have found a workaround that doesn't require much change. I had to apply a 4% increase in PPQ to get a more accurate playback. I tested this on a 16 minute song and the result was 1 second off the original time [using Media player to check the midi time]. Other songs I tried get like a total of 1 second off the original total time.

double MidiUtil::msToTicks(long ms, int mpqn, int ppq) {
return ((ms * 1000.0) * (ppq * 1.04)) / mpqn;
}

so I don't think its the tempo change but rather slower tick playback

Is is possible to send me the changes on git or through email so I can check vs my temp solution

from midi-unreal.

stani avatar stani commented on July 18, 2024

Ok, I added my changes. There is also couple of other things, like GetMidiNotes (access to notes for BP) and ProcessTo (like Process but time is controlled externally).

from midi-unreal.

Geromatic avatar Geromatic commented on July 18, 2024

found issues with your workaround...found 1 midi that jumps forward while playing, another does not end properly.

http://www.midishrine.com/oter/ffmix1.mid [skips]

from midi-unreal.

Geromatic avatar Geromatic commented on July 18, 2024

I introduced a variable that lets the user decide the speed playback

from midi-unreal.

Geromatic avatar Geromatic commented on July 18, 2024

I have fixed up the timing issue. I have removed the long to double conversion

from midi-unreal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.