libxmp / libxmp

Libxmp is a library that renders module files to PCM data.
300 stars 69 forks source link

"sleeping waste" has broken PWM playback? #717

Open SergioFLS opened 3 months ago

SergioFLS commented 3 months ago

Using current master, version 4.6.0 and Xmp for Android v4.12.0 (which reportedly uses libxmp 4.4.1).

When I play meo-sleeping_waste.mod (https://modarchive.org/module.php?68014) on openmpt123, there's a PWM effect on the fourth channel playing at around 41 seconds into the song. On the listed libxmp versions I've tried, the wave only seems to be a pulse wave that doesn't change.

sezero commented 3 months ago

CC: @AliceLR

nwoeanhinnogaehr commented 2 months ago

It's because the module changes samples without retriggering the note. Protracker 2 and 3 differ in the handling of this - what you are looking for is what Protracker 2 does. Personally I'd also like to see xmp support this. As far as I'm aware there are not any Protracker 3 modules that break when samples changes without retriggering are allowed, but I may be wrong.

Maybe there's some way to fix this by manually setting quirks?

AliceLR commented 3 weeks ago

As far as I can tell libxmp doesn't do much when playing MODs when an instrument number isn't accompanied by a note. It should be possible to support this when Protracker quirks are active (which libxmp applies to this module, but unfortunately the tracker ID routine is hit-or-miss for others).

As is typical with changing anything related to M.K. MODs I will need to gather some more data before patching this ):

TheEssem commented 2 weeks ago

Plenty of 4mat's Protracker modules have this issue, including but probably not limited to:

nwoeanhinnogaehr commented 2 weeks ago

Interestingly I noticed that 4mat-menu1.mod is identified as Fast Tracker M.K., and my understanding is that this will disable Protracker quirks (certainly it disables EFx at least). A couple more affected mods which are identified as Protracker M.K.:

By the way, there are also some mods, e.g. http://modland.com/pub/modules/Protracker/Maktone/sleepless%20nights!.mod which are identified as Fast Tracker M.K. but contain EFx effects, but maybe I should leave that for another issue :)

AliceLR commented 2 weeks ago

Interestingly I noticed that 4mat-menu1.mod...

By the way,...

All of that would be due to the tracker ID routine, which usually does a good job and other times completely hallucinates things. M.K. MODs don't have any real tracker fingerprinting so the best libxmp can do is guess based on other things.

EFx should probably rule out Fast Tracker but also sometimes people would just put useless effects in old MODs to spell out "signatures" and similar, so who knows what a false positive on that check would break (here is an example of the cursed amount of work this routine can cause). edit: I recommend a separate issue for these misidentified modules so they don't get lost.