Author Topic: bunch of IT songs not playing in xmplay  (Read 294 times)

404notfound

  • Guest
bunch of IT songs not playing in xmplay
« on: 8 Nov '24 - 20:58 »
A couple of IT songs not making any sound in XMPlay.
The player appears to be advancing orders.
The files have very long patterns.
The files are likely org2xm XM files converted to IT.

https://files.catbox.moe/yowsv1.it#curly.it
https://files.catbox.moe/yc931o.it#jenka2.it

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: bunch of IT songs not playing in xmplay
« Reply #1 on: 11 Nov '24 - 12:22 »
The issue with those files is that their samples aren't enabled. If you're familiar with the IT format, the samples don't have bit 1 set in their header flags. They're silent in Impulse Tracker too because of that. I notice they can be fixed by loading and resaving them with OpenMPT though (perhaps other trackers too).

saga

  • Posts: 2777
Re: bunch of IT songs not playing in xmplay
« Reply #2 on: 11 Nov '24 - 21:11 »
Is there any particular reason XMPlay/BASS is honoring that flag? I think no other software besides Impulse Tracker does that, and relies entirely on having a valid sample length. I don't think Impulse Tracker can produce files that would contain valid sample data but the flag isn't set, so it would probably make sense to just ignore the flag.

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: bunch of IT songs not playing in xmplay
« Reply #3 on: 12 Nov '24 - 14:21 »
Yeah, perhaps the flag should just be ignored, but I'm wondering what the point of the flag was. Must've been some reason for it to be included in the spec? It looks like the flag check was added to XMPlay around June 2010. Unfortunately, I don't remember why and I can't find any forum posts about it. I guess there was an IT file that sounded different to Impulse Tracker.

saga

  • Posts: 2777
Re: bunch of IT songs not playing in xmplay
« Reply #4 on: 12 Nov '24 - 14:41 »
From my understanding, this flag simply exists because IT dumps its internal data structures almost verbatim into the files - so in a way it is similar to the "safe to ignore" cvt flags which IT uses for its internal sample loading process (they are in fact not ignored by IT when loading an IT module, so you can craft an IT file with big-endian delta-encoded sample data... :) ).
There was an oversight in old MPT versions that always set this flag, even for empty sample slots. This caused IT to seriously screw up when loading and re-saving such a file. So there are definitely files in the wild that have the flag set when they shouldn't, but I haven't come across any files where it was the other way around. Just to be sure, I will scan a dump of all IT files from TMA and ModLand to verify.

saga

  • Posts: 2777
Re: bunch of IT songs not playing in xmplay
« Reply #5 on: 12 Nov '24 - 21:12 »
Okay, so... First, confirming the MPT bugs: In sample mode, old MPT unconditionally sets the flag for each sample slot. In instrument mode, it sets the flag for each sample slot that is referenced by a sample. So practically speaking, an MPT-made module will sound the same whether the flag is respected or not, because it's only unset for unused samples.

Now for the more important part. Apparently IT has a bug somewhere so that it keeps the sample length set after deleting sample data. I found a few files where this is the case, but I was not able to reproduce the bug in IT yet. Maybe it was one of those files that you came across in 2010. Usually these would be unused samples, or the sample data pointer would point to the end of the file, so no sample data would be loaded anyway.
But here's some examples where the author didn't remove the unused samples from the pattern data:
Slightly annoying:
https://files.exotica.org.uk/modland/?file=pub/modules/Impulsetracker/Simply%20DJ/deep%20in%20dance.it
Rather annoying:
https://files.exotica.org.uk/modland/?file=pub/modules/Impulsetracker/Lord%20Jon%20Ray/astral%20projection.it
https://files.exotica.org.uk/modland/?file=pub/modules/Impulsetracker/Blackstar/classic%20illusions.it

There's probably more of them, but these are the ones I found in the ModLand and TMA collections. Still, it might be a good idea to ignore this sample flag for files that were clearly created with non-IT software. For example, the files in the initial post claim to be made with IT 2.14, but the "reserved" field is 0, so there is only a 1 in 2^32 chance that the file was created with IT 2.14. :)
« Last Edit: 13 Nov '24 - 21:43 by saga »

Ian @ un4seen

  • Administrator
  • Posts: 26172
Re: bunch of IT songs not playing in xmplay
« Reply #6 on: 13 Nov '24 - 18:00 »
Thanks for looking into it. Yep, checking that the "reserved" value is non-0 before checking the sample flag seems to work for the OP's files and the ones you found.

Let me know if you find that 1 in 2^32 file :)

saga

  • Posts: 2777
Re: bunch of IT songs not playing in xmplay
« Reply #7 on: 13 Nov '24 - 21:48 »
Given that the reserved value is IT's scrambled edit timer, and a value of 0 corresponds to about 56,000 hours spent in Impulse Tracker editing the file, I think it will take a while until we see such a file... ;D

BTW, I just updated the explanation about the IT bug above, in case it was confusing anyway: When deleting a sample, the bug causes the sample length to remain set to a non-zero value, but the "sample data present" flag is unset.

I should also mention that IT only stores the edit timer in the "reserved" field starting from IT 2.07 onwards, so the sample flag should probably always be respected if the "cwtv" value is 0x0206 or lower.