expertsleepersltd / sf2_to_dex

Python tool to extract WAV files from .sf2 (SoundFont®) files in a format optimised for the disting EX SD Multisample algorithm
MIT License
27 stars 5 forks source link

chunk module deprecated #5

Closed rdean150 closed 1 month ago

rdean150 commented 1 year ago

Heads up - these scripts have a dependency on the chunk standard library module, which was just deprecated in the latest version of Python (3.11).

Python3.12, which will be released later this year (Q4 of 2023), is slated to be the last Python version that will contain the chunk library. Python has a 12 month release cadence between major versions, meaning that Python3.13 will be released in Q4 of next year, and it will not be able to run these scripts.
Python3.12 will be fully End-of-Life in October of 2028, at which point it will not even be possible to download any legacy version of Python that can run these scripts. (unofficial and potentially malware-infested archive repositories notwithstanding).

PEP-594 outlines the deprecation rationale and schedule.

A quick search for SoundFont sf2 seems to indicate that the file format is still seeing a decent level of usage in the wild, and I assume you intend support for Disting EX to continue beyond the end of next year, so it's probably worth appealing the deprecation decision to the Python Steering Committee. It looks like another community member got some traction appealing the deprecation of the aifc module.

Given the descriptions in that PEP, I strongly suspect that the devs who made those decisions have little-to-no experience working with audio data. This is their rationale for deprecating the sndhdr module:

The module only supports AU, AIFF, HCOM, VOC, WAV, and other ancient formats.

As if wav and aiff files are the modern equivalent of Betamax cassettes, as rare in the wild as LaserDiscs.

expertsleepers commented 1 year ago

Thanks. I have no idea how to go about appealing the decision though.

robotmitchum commented 7 months ago

Hello, I stumbled on your repository as I wanted to convert some free sf2 intruments to use in Kontakt, Decent Sampler or as SFZ in order to improve the programming. (Typically adding some advanced features like fake round-robins, effects, improve controls and so on...)

You can use the "chunkmuncher" module to replace the deprecated "chunk" module. It's exactly the same stuff which was duplicated and is maintained by another developer.

Also, the python3 version of this script (sf2dex3.py) does not work properly. It introduces clicks (made of incorrect binary data) at the beginning of some samples.

I encountered this problem with every single sf2 I tried.

So I fixed the original version of this script (sf2_to_dex.py) to make it compatible with python3 by doing only the bare minimum to make it work again and I changed the import so it uses the "chunkmuncher" module.

As I never publish anything on github, I am unsure of the procedure, but I can give you back my fixed version which works just fine if you are interested.

Anyway, thanks a lot for this, I learned a lot about working with binary data with it.

expertsleepers commented 7 months ago

Thanks, that would be great if you could send your version.

robotmitchum commented 7 months ago

Great, I am sending it to your email address right now. Check in your spam folder if you don't receive it.