Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incorrect tempo change handling #141

Closed
derselbst opened this issue Jul 10, 2015 · 3 comments
Closed

incorrect tempo change handling #141

derselbst opened this issue Jul 10, 2015 · 3 comments

Comments

@derselbst
Copy link
Member

Having a lot of tempo changes throws fluidsynth off-timing somewhy (compared to timidity and audacity midi parsing).

Attached file is one case where it happens. file1.midi has repeated tempo change tags that all change it to the exact same value. file2.midi has just the first of them. Effectively, they should be synthesized to the same audio, but in practice file1 is longer.

Reported by: velochy

Original Ticket: fluidsynth/tickets/143

@derselbst
Copy link
Member Author

derselbst commented Jul 2, 2017

Here's the problem:

player->cur_ticks = (player->start_ticks
+ (int) ((double) (player->cur_msec - player->start_msec)
/ player->deltatime));

It does a floating point calculation of the time diff between now and the last tempo change event. The result is then casted to int, every such cast results in an error. For file1.mid start_msec gets updated frequently and the error seems to increase, as start_msec is nearly the same as cur_msec.

Currently dont know how to fix this properly.

@derselbst derselbst removed the 1.0 label Jul 3, 2017
derselbst added a commit that referenced this issue Aug 18, 2017
@derselbst
Copy link
Member Author

For 1.1.7 the time diff after about 1.5 minutes of playback is about 0.15 seconds between the two files. For 1.1.6 the diff was 0.26 seconds. I dont think we can get it any better without rewriting fluid_player and I dont see this to happen soon. Closing for now.

@derselbst
Copy link
Member Author

Here are the test files for later reference.
testfiles.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants