Anybody know how Jukeblocks.io was able to read an Ableton ALS file contents in order to write a version with new arrangement?

Solution for Anybody know how Jukeblocks.io was able to read an Ableton ALS file contents in order to write a version with new arrangement?
is Given Below:

JukeBlocks.io is an incredible tool — I was hoping to play around with my own algorithms to do what it does but differently, for myself. The trick of course is being able to get into an Ableton.als file and alter it. Does it need to be decompiled, or is there any way to look inside and know what’s going on? Thanks!

If you want to develop something that can re-write or decode ALS files, do yourself a favour first.

Start by writing basic files from Ableton containing Midi, Audio and Return Tracks as well as Master Track of course.

Then rename those written files to gzip, decompress and sort out what they look like inside. You will find XML as often mentioned.

But it’s not enough to say its “just” XML because there are pointees and IDs everywhere in some scheme you have to figure out how this schemes works. Also automation is not written as you may know it from Midi specs. The IDs and parameter naming are just not directly in a logic order.
Then change from inside Ableton, save again and compare what has changed. Its the easiest way to decompose what informations falls into which part of the XML tree.

As far i did my research there are no complete specs for it and all the Github resources lack basic informations to start a project. So just writing and copying XML branches into a complete tree again will very likely end up in a corrupted file that will force your Ableton instance to kill its own process or do abandon the file you try to open.

Just reading un-gzipped ALS files is easy as well as parsing the containing XML tree.

Writing ALS files is a complete different task.

I wrote an ALS writer class that constructs a full Ableton Set (v10 & v11) out of Elektron Machines Database including used notes, samples, parameter automation as well as return tracks with ready made fx chains according to data. So yes, it is possible.

First, I tried using Ableton’s ALS-ExportKit (https://github.com/Ableton/ALSExportKit) for which I signed the license agreement, but it is basically closed source. Even if you signed it, there are only headers that tell you the export kit is incomplete. After discovering it can not write/export automation I opened issues in github and the reply was friendly but pointless. Basically telling they may consider automation in a future version in some time. So this pointed me in the right direction to stop searching for ready made API’s and to develop a solution that works for me but i had to discover how it works myself.

The way i did it was by slowly de-constructing the xml format, figuring out the ID scheme, pointee scheme and then writing gzip’ed XML of course. Opening them and making loading tests again and again and correcting bugs or missing stuff until I got it right.

The most important tool I used was File-Merge which you will find on almost any system, so you can compare files and i was using it for a while to figure out the different track xml trees and to compare different versions i saved at first. Also figuring out differences of Ableton 9, 10 and 11 ALS format. You will have to search for ID’s and Pointee’s to see how they work and interact, why some repeat and why some just increase their index value in the file.

Be warned, ALS files are gzipped for good reason as they can become quite large. So consider using some stream mechanism for writing the file otherwise you will very likely have memory issues and slow down your own processing significant. Luckely i found out that gzip is a compressing mechanism that can be written on the fly by compressing data blocks without re-reading the whole dataset.

Well, as i signed a contract, I can’t share the class which is written in C but i can encourage that it is worth thinking about just to go for it.

Hopefully this is enough information to answer your general question, namely, about parsing and understanding the Ableton .als format.

Jukeblocks.io may be based (it clearly does a lot more than Mark’s tool) on the work Mark Mossberg did for his python codebase ‘dawtool’ https://github.com/offlinemark/dawtool — Mark gave a great presentation about this topic at Audio Developer Conference 2020 covering reverse engineering aspects of .als and .flp files. His code might kickstart your experimentation around this!

See his presentation here is concerned primarily understanding internal timecodes especially for sets with variable BPMs and with tempo automation:

https://www.youtube.com/watch?v=AtLlPQHaxzg

Ableton .als files are just a zipped .xml file, by the way.

Interestingly, Bitwig 4 also has the ability to convert, to an extent, .als files into the bitwig format.