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

fluidsynth command fills up file system when playing blinding_lights.mid #1233

Closed
bclark288 opened this issue Apr 13, 2023 · 6 comments · Fixed by #1236
Closed

fluidsynth command fills up file system when playing blinding_lights.mid #1233

bclark288 opened this issue Apr 13, 2023 · 6 comments · Fixed by #1236
Labels
Milestone

Comments

@bclark288
Copy link

FluidSynth version

Execute fluidsynth --version and provide the output.
FluidSynth runtime version 2.3.2
Copyright (C) 2000-2023 Peter Hanappe and others.
Distributed under the LGPL license.
SoundFont(R) is a registered trademark of Creative Technology Ltd.

FluidSynth executable version 2.3.2
Sample type=double

Describe the bug

Provide a clear and concise description of the current situation, e.g. how the bug manifests.
When I run the command
/opt/homebrew/bin/fluidsynth -F ./blinding_lights.wav -T wav /usr/local/share/sft/FluidR3_GM_GS.sf2 ~/Downloads/blinding_lights.mid
the command writes data to the file blinding_lights.wav until the file system fills up.

Expected behavior

Provide a clear and concise description of what you expected to happen.
the command should only write 35 seconds of a wav file.

Steps to reproduce

Please explain the steps required to duplicate the issue, esp. if you are able to provide a sample application. E.g. how to start fluidsynth, what shell commands to enter, what midi events to send, etc.
Run the specified command with the attached (zipped) midi file.

Additional context

If you are able to illustrate the bug with an example, please provide simple
source code below or as attached file. List any other information that is relevant to your issue, e.g. stack traces, related issues, build logs, suggestions on how to fix, links to related discussions at fluid-dev, etc.

insert code snippets, soundfonts or anything relevant here, or attach it as extra file(s) if it's too much

blinding_lights.mid.zip

@bclark288 bclark288 added the bug label Apr 13, 2023
@derselbst
Copy link
Member

the command should only write 35 seconds of a wav file.

Well, it's not that simple.

Fluidsynth's MIDI player will stop once all End-of-MIDI-track (EOT) events have been processed. The provided MIDI file specifies the EOT event of the first MIDI Track with a delta-time of 134,050,688 ticks - this is what the byte sequence 0xBF 0xF5 0xE7 0x00 in the file at offset 0xED says.

grafik

Therefore, rendering should terminate gracefully after about 26,6 hours provided my calculations are correct. Unfortunately, this doesn't happen. Instead, I can observe player->cur_ticks to go up to somewhere 121,873,438 ticks and then drops back to zero again, leading to the endless rendering that you are complaining about.

I'll see what can be done to yield the 26 hours behavior requested by your MIDI file.

In any case: Your MIDI file is broken. Admittedly, it's pretty hard to spot that as none of the MIDI editors I've checked seem to honor the EOT event.

@derselbst derselbst added this to the 2.3 milestone Apr 14, 2023
@derselbst
Copy link
Member

Ok, it's quite simple: fluid_synth_get_ticks() is the timing source for the player. Once it went up to 2^32 it'll overflow and therefore the player->cur_tick starts from zero again. I'll try to detect this in the player and stop rendering immediately with an error message.

@bclark288
Copy link
Author

bclark288 commented Apr 14, 2023 via email

@derselbst
Copy link
Member

Those meta events seem to be standard copyright, marker and lyrics events. Unfortunately, there seems to be no hint which application has created this file.

@bclark288
Copy link
Author

Hi Tom,
I noticed that the track that contained the delta time of 134,050,688 ticks has nothing but meta messages and therefore nothing that fluidsynth would need to render. Do you think it's possible to check for that condition (i.e. nothing to render on a track?) when rendering?

@derselbst
Copy link
Member

derselbst commented Apr 23, 2023

The MIDI player does not ignore those events. On the contrary, it passes all meta events to a potentially user-provided callback function, allowing users to display lyrics or otherwise process these. It could be that more events (even audible ones) are to follow after such a long wait time, we cannot just cut it off, sry.

I've opened a PR that makes the player terminate when the internal ticks overflow, see above.

I'd advise you to fix the MIDI by editing the file. Either in a HEX editor or by importing the MIDI in some MIDI app and exporting it again.

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

Successfully merging a pull request may close this issue.

2 participants