libopenmpt vs. libxmp

Started by mmontag, September 26, 2019, 06:50:10

Previous topic - Next topic

mmontag

Hi, I'm using libxmp in my project, https://mmontag.github.io/chip-player-js/ but considering libopenmpt.
Can anyone help outline the differences in library features? So far, I know:

- libxmp is smaller than libopenmpt (how much?)
- libxmp is written in C; libopenmpt is written in C++
- libxmp provides a "lite" option that supports only MOD, S3M, XM, and IT
- libxmp-lite compiles to about 260k WebAssembly binary

Curious to know a little more, such as differences in goals/philosophy or origins of the projects.

Saga Musix

Some notes:

  • The size difference mostly boils down to the usage of C++ and in particular the C++ standard library. Obviously we are not going to change anything about that - OpenMPT wouldn't be a fun hobby for me anymore if I had to rewrite it in C. However, serving libopenmpt WASM pre-compressed with Brotli yields less than 400kb of data transfer (about 30KB for libopenmpt.js.br and about 330KB for libopenmpt.wasm.br the last time I checked a couple of months ago), which I think is fairly acceptable given that these files are typically going to be downloaded only once and given the rich feature set they provide.
  • Speaking of rich feature set: One thing libopenmpt strives for which I haven't seen in other libraries is accurate (down to the correct encoding of high-ASCII characters depending on the file format or even tracker that was used to save a specific file) and complete metadata. Whereever available we try to provide as much information about the file as possible, including things such as editing timestamps and artist names.
  • A "lite" option won't decrease the size of libopenmpt because the huge majority of the resulting binary code comes from the common parts shared between all formats (and there is no clear distinctiong which common parts are required for which formats). I have tried this before and only supplying e.g. the MOD, XM, S3M and IT loaders will only reduce the size by a few KB - which is not worth it in my opinion.
  • libxmp supports many file formats but some loaders are rather poor. For that reason the author already removed support for AdLib formats, in order to focus on quality rather than quantity. libopenmpt also has a few remaining poor loaders (e.g. MED format) but they have been mostly eliminated one by one over the course of the last years.
  • libopenmpt tries to play files (in particular S3M, XM and IT) the way they were meant to be played by the author. That is, if it detects that a specific tracker (e.g. an old version of ModPlug Tracker which was less accurate than recent OpenMPT versions) was used to save the file, certainy playback quirks may be enabled or disabled. Most other libraries just try to play a file format in one specific way.
  • I think one of the most important differences between libxmp and libopenmpt these days is that libxmp has no support for stereo samples. You will find those in particular in IT files. libxmp will only play the left channel of such samples.
    » No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

    mmontag

    Hi Saga, thanks for the detailed response.

    Apples to apples then, libxmp-lite.wasm compresses to 130k gzip or 98k brotli.

    I'm already bundling some other engines (game music emu, fluidlite, and libadlmidi) that put me up around 400k gzipped. And that will only grow if I add support for psf/gsf/usf.

    That said, as soon as I come across a bunch of great music in mo3 or another interesting format, I'll probably move my project over to libopenmpt :)

    Saga Musix

    I might be biased but I'd rather prefer to have correct and fully-featured playback of the common formats (in particular IT and XM) than saving a few hundred KB. You will notice that libxmp will play pretty much all of my recent music considerably different from e.g. OpenMPT, XMPlay or SchismTracker, and of course I am not intentionally trying to make it incompatible with libxmp - it's just that it's not feature-complete for IT files. Lots of people make IT files in a similar manner these days so it's not just my music that will sound sub-optimal.
    » No support, bug reports, feature requests via private messages - they will not be answered. Use the forums and the issue tracker so that everyone can benefit from your post.

    mmontag

    Alright, I'll dig into it and try to see what I'm missing. Maybe there are some comparisons on Youtube already.