rustysynth icon indicating copy to clipboard operation
rustysynth copied to clipboard

End of track should count in midi length

Open sevonj opened this issue 8 months ago • 2 comments

Context:

To repeat the experiment from https://github.com/sinshu/meltysynth/issues/55, I wrote a very quick tool to render a midi both with rustysynth and fluidsynth.

https://github.com/sevonj/rustyfluidcomp

ufo-sound.zip

Problem:

  • ~Rustysynth does not include end of track message in the midi file length.~
  • end_of_sequence() doesn't account for note release duration.

The latter is less important, but still nice to have. Both of these count when rendering with fluidsynth:

screenshot

Image

Proposed changes:

Provide method to check if Synthesizer still has a voice playing.

sevonj avatar Apr 19 '25 13:04 sevonj

RustySynth's MIDI parser says that an EoT message is inserted at the 4-second mark (a channel number of 255 is interpreted as EoT), but does that mean it is incorrect? 🤔

Below is the list of events when the MIDI file is loaded using the current MIDI parser in RustySynth:

Message { channel: 0, command: 144, data1: 69, data2: 96 }, time=0.625
Message { channel: 0, command: 128, data1: 69, data2: 0 }, time=2.5
Message { channel: 255, command: 0, data1: 0, data2: 0 }, time=4.0

sinshu avatar Apr 19 '25 14:04 sinshu

It appears that I didn't pay attention and made a mistake. Removing the release reduced the length of FS render to 6s, and and I assumed that this was where left the end mark.

sevonj avatar Apr 19 '25 15:04 sevonj