IAGOnGithub / gba-mus-ripper

A fork of a forked version of GBA Mus Ripper, made with fixes for pokeemerald in mind
MIT License
1 stars 0 forks source link

Some Ripped Soundfonts Have Invalid Generators #1

Closed IAGOnGithub closed 1 month ago

IAGOnGithub commented 2 months ago

This issue was copied from upstream.


I am attempting to rip the soundbanks from Pokemon Emerald (pokeemerald.gba as produced from pret's decomp project) and use them with Fluidsynth (x86_64 GNU/Linux) but encounter warning messages such as this: $ fluidsynth soundbank_0000/soundbank_0000.sf2 soundbank_0000/song0351.mid

fluidsynth: warning: Instrument 'EveryKeySplit @0x675': Some invalid generators were discarded
fluidsynth: warning: Instrument '0x676a90 key split': Some invalid generators were discarded
fluidsynth: warning: Instrument '0x676ac0 key split': Some invalid generators were discarded
fluidsynth: warning: Instrument '0x676ae4 key split': Some invalid generators were discarded
fluidsynth: warning: Some invalid sample loops were sanitized! If you experience audible glitches, start fluidsynth in verbose mode for detailed information.

Running with --verbose reveals that notes corresponding to instruments with invalid generators are duplicated multiple times, sometimes more than 70 times.

The generated soundfonts seem to work fine and sound correct when using other synthesizers, such as CoolSoft's VirtualMIDISynth on Windows. Note that I ripped the soundfonts as individual banks with the -sb flag.

IAGOnGithub commented 1 month ago

Resolved. Key split and every key split instruments did not place their keyRange generators as the first one in the zone; something that is technically required by the spec. Since fluidsynth is pedantic, it rejects the generators and they ended up sounding like garbage. I implemented the fix in a really stupid way, but it seems to be working fine...