Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with modules playback. #85

Open
system64MC opened this issue Aug 5, 2024 · 15 comments
Open

Problems with modules playback. #85

system64MC opened this issue Aug 5, 2024 · 15 comments
Labels
external bug Problem of external library affected the MixerX (Should be fixed at the external library side)

Comments

@system64MC
Copy link

system64MC commented Aug 5, 2024

Hi. I encountered some problems with tracker modules playback.

The first one is lowpass filter sounding different if the sample rate is under 50kHz or above 50kHz. You can try playing the goddess.mptm through OpenMPT and SDL-Mixer-X. Try with 44100Hz to notice the problem. Note that if I comment "include(music_xmp)" in the CMakeLists.txt, that fixes the issue. So this is likely a problem with libxmp.

The second one is the playback speed. With the magica.mptm module, it goes faster than expected at some point (you also can compare with OpenMPT)

The third problem is the OPL3 not working. You can try with the th06_04.mptm module.

Possible solution : Maybe using libOpenMpt for module playback would solve the problem? Or letting the user choosing between libopenmpt, libxmp or libmodplug?

Here are the test files :
Archive.zip

@Wohlstand
Copy link
Member

include(music_xmp)

You should don't do this as you can just disable the libXMP using CMake's arguments -DUSE_XMP=OFF. Currently there are two libraries supported - libModPlug and libXMP. The libXMP is more prefereable because it has better support of various formats and is actually maintained thing while libModPlug is not maintained for a while, just by me and other folks to maintain build compatibility with various compilers and environments.

The third problem is the OPL3 not working. You can try with the th06_04.mptm module.

It's because no suitable OPL3 emulator is used here. At the libXMP repository is a suitable task exists regarding the OPL3 support.

Possible solution : Maybe using libOpenMpt for module playback would solve the problem? Or letting the user choosing between libopenmpt, libxmp or libmodplug?

I did some attempts, and: libOpenMpt is extremely heavy thing, additionally, it's tricky or even impossible to properly build it on some platforms. In static builds it adds extra 5 or more MB of binary file size, which is a pain for low-end platforms, and therefore it can be supported optionally only.

@Wohlstand
Copy link
Member

But, I could try to add the libOpenMPT module but it will be disabled by default (as ffmpeg is) because of dependencies.

@Wohlstand
Copy link
Member

P.S. You really should report your problem to the official libxmp repository here: https://github.com/libxmp/libxmp/

@system64MC
Copy link
Author

system64MC commented Aug 5, 2024

Alright, thanks! I will report those issues in the libxmp repo.
I think libOpenMPT disabled, but can be optionnaly enabled is a good compromise. However, the size of the lib is big, but would it be also heavy, performances-wise?

Edit: reported the problems as you said : libxmp/libxmp#755

@Wohlstand
Copy link
Member

but would it be also heavy, performances-wise?

About the performance, I didn't benchmarked these things yet. To confirm that, it's need to make a separated benchmark tool that will decode the same file by different libraries and measure the time they will spend to perform the work.

@system64MC
Copy link
Author

Benchmarking is quite an hard thing to do
Also thank you a lot for this incredible improvement of SDL Mixer. Despite of the small problems in libgme and with my mptm modules, it's an excellent library. I'm considering using it in my game framework.

@system64MC
Copy link
Author

Talking about modules, did you had a look at https://github.com/adplug/adplug?tab=readme-ov-file? It can play modules such as a2m (Adlib Tracker 2à and RAD (Reality Adlib Tracker) and more. It's licensed under LGPL.

@Wohlstand
Copy link
Member

Playing of fully OPL based modules is possible to implement on the side of libADLMIDI library which is actually a MIDI synthesizer based on OPL3 emulation, however, right now it's licensed under GPLv3 until author of inherited files will grant me LGPL or I will replace them with my own.

@Wohlstand
Copy link
Member

What about the AdPlug, it seems needs to be fully modified to standalone library rather than a plugin for players.

@sagamusix
Copy link

sagamusix commented Aug 6, 2024

I did some attempts, and: libOpenMpt is extremely heavy thing, additionally, it's tricky or even impossible to properly build it on some platforms. In static builds it adds extra 5 or more MB of binary file size,

That is more than double the size of what I would expect of a full libopenmpt build. Which platform is that on? And which platforms do you have issues building libopenmpt on?

About the performance, I didn't benchmarked these things yet.

You don't have to take my word for it, but OpenMPT mixing routines haven't changed much in over 20 years. You can still play heavy modules on a Pentium 2 with the same performance as ModPlug Tracker did back then. Obviously, this depends on the chosen resampling quality though (using 8-point interpolation on an old machine is not a good idea no matter which module player you use), and whether the module uses other optional features such as DSP plugins.

@Wohlstand
Copy link
Member

@sagamusix, I built it as a static library for the x86_64 Linux locally, and additionally I verified the build on other things. To make the suitable integration into my build trees, I crafted my own CMake build, otherwise, default one (autotiols) is a pain for cross-platform build (At the moment when I did such experiment). It fails to build on MSVC compilers, but successfully builds everywhere also, MinGW and on other operating systems.

Anyway, there is a long time passed after that experiment, and I should get another shot on this with the latest code.

@system64MC
Copy link
Author

This is quite promising! I don't know much about MSVC, I mostly use gcc and MinGW to be less dependent of Visual Studio. In fact, I work on Linux.

@Wohlstand
Copy link
Member

On my end I had a goal to make the package that will build everywhere including MSVC that I don't like by myself because it supports modern C++ standards worse than GCC and CLang.

@sagamusix
Copy link

Do you mean that you had issues building with MSVC using autotools (that is not a supported configuration on our side) or when using CMake? The latter should not be a problem at all.

Here's some instructions how to integrate libopenmpt into any build system: https://github.com/OpenMPT/openmpt/blob/master/doc/libopenmpt/gettingstarted.md#building-libopenmpt-with-any-other-build-system

@Wohlstand
Copy link
Member

Wohlstand commented Aug 8, 2024

No, the building issue that code has several incompatible places that needs a polishing. Anyway, that might be no longer actual as I did that test a while ago.

@Wohlstand Wohlstand added the external bug Problem of external library affected the MixerX (Should be fixed at the external library side) label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external bug Problem of external library affected the MixerX (Should be fixed at the external library side)
Projects
None yet
Development

No branches or pull requests

3 participants