sfztools/sfizz

wav produced by sfizz_render sounds like sustain pedal on

Closed this issue · 2 comments

Test sfz: https://github.com/sfzinstruments/karoryfer.meatbass
specifically https://github.com/sfzinstruments/karoryfer.meatbass/blob/master/Programs/arco_looped_basic_map.sfz
same results with another sfz: https://web.archive.org/web/20170119182726/http://patcharena.com/free-sampled-lush-strings-ensemble-instrument-warm-strings-sfz/

Test midis: any from mutopiaproject.org
for example, for midis generated during or after 2010, https://www.mutopiaproject.org/ftp/BachJS/BWV1004/bwv-1004_1/bwv-1004_1.mid
for example, for midis generated before 2010, https://www.mutopiaproject.org/ftp/LisztF/S.172/liszt-consolation-no4/liszt-consolation-no4.mid
midis generated by current Lilypond and Musescore behave like the midis on Mutopia from during or after 2010

Running on Ubuntu Unity 20.04 in a UTM virtual machine on M1 MacBook Air 2020
Run sfizz_render from the bash command line

Symptoms: Playing midis generated by Lilypond during or after 2010, sfizz_render does not recognize the ends of notes but holds notes down for the length of the sample (or loops the sample many times before letting go, resulting in a tone cluster of notes that have been played).
Using the same sfz on midis generated by Lilypond before 2010, sfizz_render plays them as expected (cuts off each note at the end of the note).

Reviewing the Lilypond version history, it looks like 2.12 was released December 2008 and the next version, 2.14, was released June 2011.
Reviewing the changelog at the time: http://lilypond.org/doc/v2.14/Documentation/changes/
but I'm not seeing anything relevant there:

"MIDI output has been improved

the option \set Score.midiChannelMapping = #'voice puts each voice on its own midi MIDI channel
the option \set Score.midiChannelMapping = #'instrument puts identical instruments on the same MIDI channel. This means that e.g. for a full orchestral score there are always 16 (15 plus percussion) differently sounding instruments available, unrestricted by the number of staves or voices. (Some MIDI players will cut off notes, however, if two voices play the same pitch simultaneously on the same channel.) This option also stores each voice in a separate track in the MIDI file.
the default, \set Score.midiChannelMapping = #'staff, assigns one MIDI channel per staff. This setting allows instrument changes (implemented as MIDI program changes) to re-use single MIDI channel.
dynamics are now rendered as note velocities, no longer as midi volume. This improves the sound on [high end] midi renderers. "

Used the midicsv utility to view a representation of the midi files. The difference between the two kinds of files is that one file contains the binary equivalent of "Note_off_c" after each note and one file does not. I'm not sure how I might automate turning one kind of file into the other or whether sfizz could be made more permissive.

After 2010 the files use note-on messages with velocity 0 to fake note-offs. It's pretty common in midi, I'm not sure why I didn't directly put it in sfizz-render. I'll put out a pull request shortly.