I am building a Python library where in one component I want play certain instrument sounds with FluidSynth. My goal is to bundle an sf2 file with my library to make it self contained. I am currently using the sf2 sound font file from the Debian source package fluid-soundfont, since it is free. The file contains a lot of different sound fonts and is roughly ~133MB in size. I only need a small subset of the sound fonts contained in the fluid-soundfont package. This makes my library unnecessarily large and is also a problem with PyPI, because the have a maximum library size. The goal is to extract a subset of n sound fonts from the fluid-soundfont sf2 file.
I have to say I am not very familiar with the sf2 file format and so far I haven't dig deep into the file format and before I attempt to write a component myself to solve my problem, I wanted to ask if anyone is aware of library to achieve something like this (must be open source, but language is not important)? So far my research was not successful. I only found some libraries to parse sf2 files and export parts of it as wav file, but not as a dedicated sf2 file.