vsariola / sointu

Fork of 4klang that can target 386, amd64 and WebAssembly. Tools run on Windows, Mac & Linux
MIT License
240 stars 15 forks source link

Load 4klang instruments and patches #88

Closed LeStahL closed 1 year ago

LeStahL commented 1 year ago

Loading / importing 4klang .4ku, .4kp and .4ki binary files into sointu would be a nice feature - as it enables switching from 4klang to sointu without having to remodel all the instruments manually.

Would you be interested in accepting a PR that adds this? If yes, I'd be up for writing it. :)

vsariola commented 1 year ago

Sure, why not! I remember thinking of this and what stopped me from doing this was:

https://github.com/hzdgopher/4klang/blob/4cc9497b3354dc32a6d50352c8554401facfca1b/4klang_source/Go4kVSTi/source/GoSynth/Go4kVSTiCore.cpp#L1197

I wasn't sure how much legacy instruments are around; whether I should support them or just the latest version of patches/instruments. Also, it takes some time to figure out how to interpret every 4klang unit; what is the meaning of each parameter "slot" in 4klang vs. what parameters they are in sointu.

If the goal is just to have some nice presets/examples, one option is to write quick and dirty scripts (python, or whatever is a good weapon of choice here) to read 4klang instruments and save them as sointu .json. Then only commit those presets in the sointu repo, under examples/instruments or maybe even examples/songs.

What do you think?

LeStahL commented 1 year ago

I think both importing over the ui directly (by selecting file>import) and having a command line converter tool would be cool. I think the Python converter you suggest would be a convenient starting point, to gather all the info about the binary formats (I have made good experiences with construct, https://construct.readthedocs.io/en/latest/intro.html). Would be nice to have the file format version migrations that 4klang does in the script as well, so sointu only needs to support the current version of the file format. I'll look into it.

I guess I should add tests for the converter code (render original files with 4klang and converted files with sointu, compare byte-wise).

vsariola commented 1 year ago

If you are really going for it, even a short text document listing what are the meanings of each slot for each unit type would be a good starting point. The file format in principle is very easy, but figuring out what each unit type stores in each slot in 4klang takes a bit more effort.

virgill1974 commented 1 year ago

Hope this will happen someday <3

LeStahL commented 1 year ago

I created a draft MR with a python tool that is able to load 4kp/4ki/4ku. Next step is to write code that translates the construct to the sointu yaml format.