Cantabile Development Blog

Follow the development of music software Cantabile

Articles | Full Index | RSS Feed


Session Zipping

Something I've been working on for a while now, but never mentioned here is Cantabile's new file format.

In Cantabile 1.2 the session files are simple text files in a format almost identical to an ini file. I like using text files as a file format because it allows easy inspection and even editing with nothing more than a text editor. Also, unlike binary files versioning is much easier as new settings can be added without disrupting everything else.

The downside is that saving plugin banks is very inefficient. At the moment, these are hex encoded which doubles the storage space required on disk. Worse, internally these hex encoded strings are manipulated in unicode - quadrupling the size of the original bank. Oh, and the original bank is still in memory too - that makes it 5 times larger! Not to mention the plugin probably has it's own copy of the data as well. Yikes.

For most plugins this is a not a problem as the bank sizes are quite small. There are however a few plugins that save audio data in their banks and Cantabile just about explodes when that happens.

So I was thinking about all this when I read that Microsoft uses zip files as a file format for office 2007 documents. The more I thought about it, the more I realised this is a brilliant idea - a session file is a zip file, but with .cantabile extension. Inside the zip is:

  • A content.ini file that contains the bulk of Cantabile's own settings.
  • Separate .fxb files (also in the zip) that contain the saved state of each plugin.
  • A couple of other binary streams that have .bin extensions and aren't of much interest outside Cantabile.

The content.ini file is still a text file, but instead of traditional ini file is uses the same heirarchial syntax that I designed for skin layout definitions. I considered using XML but it's very verbose, I'm not a big fan of it and I couldn't think of a compelling reason why this would be useful.

The benefits of using zip files as a file format are obvious:

  • Anyone can change the file extension to zip and use standard tools to take a peek what's inside. If you're feeling game you could even manually edit it.
  • The banks of all plugins are just sitting there as .fxb files.
  • It's all contained in a single file and I've implemented it so that it reads and writes directly in zip format - there's no temp files or any other messiness.
  • The files are now smaller than the sum of the contained banks as it's all compressed.
  • It's still very extensible for the future, easily allowing me to add new settings.

The downside is just one - I might need to remove support for fast session switching. I could continue to support it but the load code for that is messy enough without having to deal with zip complications. Also, I've got a better solution for what fast session switching is intended solve anyway (more on that later).

Finally, I should mention that Cantabile will of course still load version 1.2 session files, but it probably won't support saving them.

Now back to that audio player...

Posted on May 12, 2008

Share This

Posted on May 13, 2008

Gianluca says:

Be careful, fast session switching is a crucial aspect in living use. The recall of a performance via a program change is one of the must important aspect when you play live. You have no time to work with mouse and list of songs. And more can become dangerous if you consider some error. One program change sent by the master controller must recall all configuration, routing, VST, file audio for bases and file midi for sequences for every song you go to play. Then you just have to push start play button and put your hands on the keyboards without other worries.

Cheers,

Gianluca

Leave A Comment

All comments will be reviewed for spam before being displayed.