spessasus / SpessaSynth

MIDI SoundFont/DLS synthesizer library written in JavaScript.
https://spessasus.github.io/SpessaSynth/
Other
98 stars 12 forks source link

improve SF3 compression of default SoundFont #55

Closed mrbumpy409 closed 1 month ago

mrbumpy409 commented 1 month ago

The current SF3 compression settings used for the default SoundFont (GeneralUser GS v1.471) result in very noticeable audio artifacts. Some of the most severe distortions occur on short loops. In my previous testing of SF3 compression, I found the following compression settings necessary to avoid such distortions:

sf3convert -z -q 0.8 -a -1 source.sf2 destination.sf3

This sets the OGG quality to 0.8 and attenuates the samples by 1 dB to avoid the clipping that can occur when converting to a lossy format. Yes, this does result in a larger file size, but still considerably smaller than the source SF2, with no real perceivable difference in sound quality.

Here is an audio file for comparison, using the preset 000:008 Celeste. You will hear five ascending notes recorded on each of the following GeneralUser GS copies (v1.471):

  1. The SF3 bundled with SpessaSynth (4.7 MB)
  2. My SF3 compressed with the recommended settings above (9.7 MB)
  3. The uncompressed SF2 (29.8 MB).

In example 1, you can hear very obvious loop distortion, sounding as an inharmonic buzz. In example 2, you can only hear the faintest amount of loop distortion. In example 3, the loop buzzing is pretty much eliminated (it was never the most perfect loop to begin with).

Beyond the buzzing loops, I have noticed the sound quality is overall quite noticeably deteriorated compared to the uncompressed SF2. I realize that the whole point of the compression is to reduce the file size, and this is important for a web app for bandwidth reasons. So, I will be understanding of whatever choice you make.

spessasus commented 1 month ago

Hi Christian, thanks for the suggestion. I agree that the celesta sounds distorded in the bundled GU GS, so I'm thinking of the solution 2. (the attenuated version) with the v2.0.0 release. I've also added the credits to your soundfont within the "demo" button.

Thank you so much for testing my synth with this comprehensively, I'll try to fix #53 soon!

PS: Will SpessaSynth have a chance to appear on the GeneralUser GS compatible synth list? :)

mrbumpy409 commented 1 month ago

Hi Christian, thanks for the suggestion. I agree that the celesta sounds distorded in the bundled GU GS, so I'm thinking of the solution 2. (the attenuated version) with the v2.0.0 release. I've also added the credits to your soundfont within the "demo" button.

Thank you! :smile:

PS: Will SpessaSynth have a chance to appear on the GeneralUser GS compatible synth list? :)

Most definitely! It will be nice to have more than just FluidSynth and BASSMIDI (+derivatives) on the list. Thanks again for your excellent work on this synth!