Compressed soundfont banks

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!
Posts: 41
Joined: 6 Nov 2015 - 12:32
Compressed soundfont banks

Hi, my second post and my second wish.
Would it be possible to add the option of using compressed soundfont banks? Some banks when uncompressed are huge and take a lot of space in the hard disk drive. I have noticed that Spider Pro handles soundfonts directly in format sfpack. Another option would be the possibility of handling soundfonts compressed with zip, rar or 7zip and decompressing the soundfonts on the fly, of course with a single sf2 file in each compressed file.
Thanks.

Posts: 1972
Joined: 25 Mar 2012 - 01:19
Re: Compressed soundfont banks

I've already thought about something like this in my tests, but the results were not so good.
Do we really save disk space could by directly handling compressed soundfont?

AFAIK there's no library that could directly use compressed files, so they must be uncompressed (behind the scenes) before their use.
Let's take a LibreOffice .odt file as an example: it's a ZIP archive (with .odt extension) and LibreOffice Writer unpacks and repacks it when needed.
So to open an .odt file we still need some disk space to uncompress it
That's acceptable because the mean size of a document is a few Megabytes.

Unpacking a large-size SF (say more than 1GB uncompressed) will requires a lot of time and disk space.
This will increases VMS startup time, required to unpacking the SF to a temp location.

The file must be deleted after its use: leaving it around is a nonsense, because it will waste disk save.

To make it really useable, SF should be unpacked to memory only, but someone won't be happy about high VMS memory usage.
Or, again, dynamically unpack only the required portions when necessary; sadly this will add unacceptable latency to the synth.

Till now I considered SF2 files compressed in a container, like ZIP/7Z/RAR/SFPACK/SFARK.

There are "plain" SF where the contained samples are lossy/lossless compressed with codecs like MP3, OGG or FLAC.
This way the overall SF2 file size is reduced and the file must not be extracted to be used; it only requires the synth to be able to uncompress the sample before playing it.
BASS libraries already support compressed samples, but I was not able to find such a compressed SF2 file.

If you are able to complete this search for me I'll try to add this feature to the next VMS2 version.

Posts: 41
Joined: 6 Nov 2015 - 12:32
Re: Compressed soundfont banks

Although I have used midis for years I got more interested in midis and soundfonts quite recently and I am a novice in all this stuff.
I know that compressing/uncompressing takes time but I only use midis to listen to music and I have a potent computer (i7 with 16GB of RAM), so for me it wouldn't be a problem to wait some seconds. So, it seemed like a good idea to implement it as a possiblity with a caption saying that it would increase load charges. It could be interesting if you want to try new soundfonts. I would leave uncompressed the sf2 that I use the most and compressed the rest.
I looked at the readme file of the bassmidi library (I am curious) and I read there that it included some support about sfpack but I don't know or understand anything more.
And I read something about the sf3 format that uses Musescore 2.0. MuseScore version 2.0 is shipped with the SoundFont FluidR3Mono_GM.sf3 (12.6 MB).
There is some info here about a tool to convert from sf2 to sf3 http://sourceforge.net/p/tuxguitar/support-requests/6/

But I don't know more. Like I said, I know nothing about music or programation.

Posts: 41
Joined: 6 Nov 2015 - 12:32
Re: Compressed soundfont banks

Ouch. I mixed up sf2pack and sfpack.
Bassmidi can handle sf2packs that are sf2 where the wavs in the soundfont are converted to a loussy format. Bassmidi includes an exe to do the conversion. Spider Pro and the midi plugin in XMPlay can use sf2pack files too. However, none of them can use files in sfpack format. In sfpack the files are compressed and can be uncompressed back to its original format without loss.

Posts: 41
Joined: 6 Nov 2015 - 12:32
Re: Compressed soundfont banks
coolsoft wrote:

BASS libraries already support compressed samples, but I was not able to find such a compressed SF2 file.

If you are able to complete this search for me I'll try to add this feature to the next VMS2 version.

Alright, instead of looking for a font already compressed in sf2pack format, I have taken a sf2 font and I have compressed it myself.
To compress the font (using lossless FLAC) I have downloaded 3 files from Un4seen web: The BASS library, and the addons BASSMIDI and BASSFLAC. From those zip files I have needed to use the next ones:
sf2pack.exe
bass.dll
bassmidi.dll
bassflac.dll
Of course, if I used a different codec instead of FLAC I would have needed different libraries.

I have compressed the soundfont FluidR3_GM. Compressed with sf2pack using FLAC it becomes a 72,2 MB (only 1 MB more than compressed with sfark). I have tried the compressed sf2pack font with Spider Pro and plays well. I have tried it too with XMPlay but in this case I have needed to add too the FLAC plugin in addition to the MIDI plugin. It plays well too. I didn't notice any delay in loading the font.

Next one I have uncompressed the Fluidr3_GM.sf2pack using the sf2pack tool from the BASS library. To be able to do that I have needed to get the file flac.exe that I have downloaded from the official web of FLAC  https://xiph.org/flac/download.html I downloaded the FLAC for Windows command line tools. I just had to copy it to the same folder than sf2pack.exe. The uncompressed file that I got was bit to bit identical to the original FluidR3_GM.sf2 file (I checked the checksums).

The conversion between sf2 and sf2pack and back is quite quick, so that would be an excellent way of storing the soundfonts that I downloaded.
So, if you have the time, I think that it would be not very difficult to add support for sf2pack.

Btw, I have uploaded this compressed FluidR3_GM.sf2pack font together with the exes and dlls used to do the conversion. I don't know if I can publish here the link or I could send it to you in a private message if you want it.

Well, that's all.

Posts: 41
Joined: 6 Nov 2015 - 12:32
Re: Compressed soundfont banks

I have continued looking at this subject. This time I have been poking out about wavpack, that is the other codec (in addition to FLAC) that can be used to compress sf2pack files.
To compress sf2 into lossless and lossy sf2pack you need the file wavpack.exe. I have downloaded it from the official webpage, here. You need to use the win32 bits version (in all the cases you need to download the 32bits exes or dlls of all the files because there is not 64bits version of sf2pack.exe).

To decompress the sf2pack back to sf2 you need the library basswv.dll. You can download it from the section add-ons of BASS in http://www.un4seen.com/
IMPORTANT: With these files you only can decompress sf2pack files that have been compressed using the lossless option of wavpack. When decompressed, the resultant file is identical to the original not compressed sf2 file. If you try to decompress sf2pack files, that were compressed using lossy options of wavpack, you will get an error message.

I have tried to use the lossless wavpack version and the 3 lossy versions of the sf2pack font with Spider Pro and XMPlay. It works out of the box with Spider Pro, but again to make it work with XMPlay you need to install a new XMPlay plugin, in this case the xmp-wv (wavpack) plugin from un4seen.com

--

And it seems that I made a mistake in the previous post talking about FLAC. Flac.exe is needed to compress the font and you need too bassflac.dll to decompress it.

Posts: 1972
Joined: 25 Mar 2012 - 01:19
Re: Compressed soundfont banks

Thanks for the detailed reporting of your tests.

By reading them I see that managing compressed SF2 files is not so easy.
It will add some more "uncertainty" to a stable situation; plain SF2 are actually played without any issue, compressed SF2 will require the right decoder (you mentioned FLAC and WAVPACK, but there's also MP3 and OGG) with (maybe) the right version and bitness (x86/x64).
I mean: if such feature will land to VirtualMIDISynth, it should be done in an "absolutely foolproof" way.

It is a lot of work...

NOTE: I don't remember if placing the right bassXXX.dll plugin (where XXX is flac, mp3, ...) in the same folder of bassmidi.dll is sufficient for it to decode compressed samples on the fly.
If yes, well, advanced users like you could play compressed soundfonts nearly out of the box or, maybe, I could prepare some kind of additional plugin setup to distrubute such codecs.
It worths a try...

Posts: 41
Joined: 6 Nov 2015 - 12:32
Re: Compressed soundfont banks

I don't think VMS needs mp3 or ogg to play sf2pack files.

Sf2pack uses 5 different ways of compressing sf2.
1 - lossless using FLAC. It needs bassflac.dll and flac.exe.
2 - lossless using WAVPACK. It needs basswv.dll and wavpack.exe
3 - lossy High Quality using WAVPACK. It needs basswv.dll and wavpack.exe
4 - lossy Medium Quality using WAVPACK. It needs basswv.dll and wavpack.exe
5 . lossy Low Quality using WAVPACK. It needs basswv.dll and wavpack.exe
In addition to that bass.dll, bassmidi.dll and sf2pack.exe (all the dll and exe in 32 bits). That is for compressing and decompressing sf2pack. And I could write a tutorial about it.
But I don't what would need VMS to be able to use sf2pack files.

Posts: 1
Joined: 26 Feb 2018 - 12:47
Re: Compressed soundfont banks

hy can  i have your mail i am interested in bassmidi flac.  my tools to convert sf2 to sf2pack doesnt work

or can u load a tutorial in youtube.

by