ModPlug Central

OpenMPT => Technical Documents => Topic started by: Saga Musix on February 19, 2013, 14:44:31

Title: IT-compressed samples
Post by: Saga Musix on February 19, 2013, 14:44:31
So, OpenMPT recently got support for saving IT-compressed samples in IT and MPTM files (since v1.21.01.15). Since it is experimental and will break older versions of OpenMPT in some way or another, it is not enabled by default. Here's what you need to know about IT compression:

You can change the following settings in the Advanced Settings (https://wiki.openmpt.org/Manual:_Setup/Advanced):
(https://sagagames.de/ithumb/show/it_compressiong.png)
Misc.ITCompressionMono=x: Enables IT-compressed mono samples when saving IT/MPTM files. x is a combination of format flags: Normal IT = 1, Compatible export IT = 2, MPTM = 4. Add the numbers up to enable saving in the formats you want to (e.g. 6 will save IT-compressed samples in compatible ITs and MPTM files).
Misc.ITCompressionStereo=x: Enables IT-compressed stereo samples when saving IT/MPTM files.

Since various applications (like all versions of OpenMPT prior to 1.21.01.15) have trouble reading stereo samples, there are two options for mono and stereo samples. If you want to write a tune that plays correctly in the following software, don't enable stereo compression:

Also, due to how (Open)MPT previously decoded IT-compressed samples, older versions (again, all versions prior to 1.21.01.15) will fail to load the extended instrument and song settings if there are any compressed samples. This means that if you use any OpenMPT hacks (this does not include the original MPT hacks like VST plugins or channel / pattern names) in your song, they will not load properly in older versions. Obviously, this doesn't matter if you are using compatibility export, because then these options are gone anyway.

Summary: I'd suggest the values ITCompressionMono=7 and  ITCompressionStereo=6 for backwards compatibility with a large number of software while still maintaining small file sizes.

Oh, and there's one good thing about this, too: GreaseMonkey's IT compression code (which I have translated from Python to C++ for OpenMPT) actually compresses samples slightly better than the original Impulse Tracker did!
It's also worth mentioning that e.g. zipping an IT-compressed file will still produce smaller results than just zipping the uncompressed file, which isn't all that common when applying more than one compression algorithm on some data.

Note: To increase compatibility with some of these less compatible trackers and players, OpenMPT will only write IT2.15-compressed samples if the IT file has a required IT version number of 2.15 or higher. This is only the case when at least one instrument uses a filter envelope (a feature added in IT2.15). So for slightly better compression ratios, make sure that at least one instrument has a filter envelope. If the envelope just consists of two points at the maximum value, no filtering will actually happen so it won't modify the sound.