Mod Archive Forums Mod Archive Forums
Advanced search  

News:

Please note: Your main modarchive.org account will not work here, you must create a forum account to post on the forums.

Pages: [1]   Go Down

Author Topic: The Counting Riddle (sample offset question)  (Read 12041 times)

0 Members and 1 Guest are viewing this topic.

Steffest

  • New User
  • Offline Offline
  • Posts: 11
    • View Profile
    • Online Tracker
The Counting Riddle (sample offset question)
« on: June 16, 2017, 12:15:59 »

Hey,
I'm in the process of writing my own web-based tracker and have reached the muddy waters of tracker-variations.

My Question is about the "9" sample offset effect, especially related to special cases when notes and sample number are omitted.
I created a little demo mod that behaves differently in different players.

It's located at http://www.stef.be/bassoontracker/demomods/test/sampleoffset.mod

The sample is a voice counting from 1 to 4, depending on the sample offset and the handling of special cases, you get another sequence in different players .

I tested it on multiple trackers and there are 3 different ways the sample offset is handled:
  • counting is heard as  2-3-2-3-3-4-4
    • Protracker 1.3 - Amiga
    • Protracker 2.3d - Amiga and the Windows Clone
    • OpenMPT
  • counting is heard as 2-3-2-3-2-3-2-3
    • Protracker 3.15 - Amiga
    • Protracker 4 - Amiga
    • Milkytracker (even in Protracker 2 mode)
  • counting is heard as 2-3-2-3-1-2-2-3
    • FasttrackerII - DOS
    • Milkytracker (in Fasttracker mode)

The problem is: I understand the 2nd and the 3th way, but I can't get my head around the logic of the first way (of Protracker 1, 2 and OpenMPT)
especially the note on row 32: this doesn't have a sample number, nor an effect but somehow the previous 9 effect gets applied twice? (the sample starts playing at "three")
Then after that, at row 48, no sample number and "900": you hear "four"? why?

My own code follows Fasttracker here as this seems the most logical implementation (http://www.stef.be/bassoontracker/?file=demomods%2Ftest%2Fsampleoffset.mod)
but most .mod files seem to expect the PT2 way so I would like to get that right.

And even more a mystery: How would you know what playback variation the .mod files expect?

Anyone who has dug deep into this and wants to shed a light?

Update:
Oh, look at that, I found a 4th way ...
XMPlay with the the "PT1" playback mode does "2-3-2-3-2-3-3-4"
How balls-on weird is that?
puzzling ...

 




« Last Edit: June 16, 2017, 12:56:21 by Steffest »
Logged

Steffest

  • New User
  • Offline Offline
  • Posts: 11
    • View Profile
    • Online Tracker
Re: The Counting Riddle (sample offset question)
« Reply #1 on: June 16, 2017, 13:52:14 »

Small update, before someone says "There's a bug in PT1 and 2 that adds offsets in the 9-effect when no sample number is given".

Yes, I though so too, but not exactly: here's a more simple example with just 2 notes:

http://www.stef.be/bassoontracker/demomods/test/sampleoffsetb.mod

If the offset is added, then you would hear "2-3" not "2-4" like you do now on PT1 and PT2, so somehow the offset is tripled.

Still ... puzzling ...


 ???



Logged

Nikku4211

  • Rising Star
  • *
  • Offline Offline
  • Posts: 152
  • Also known as Nikku4212
    • View Profile
Re: The Counting Riddle (sample offset question)
« Reply #2 on: June 16, 2017, 19:15:25 »

OpenMPT needs to support all of these.
Logged

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: The Counting Riddle (sample offset question)
« Reply #3 on: June 17, 2017, 18:04:53 »

OpenMPT needs to support all of these.
No.

Steffest: PT2.3 is messy but its behaviour is by far the most exploited behaviour (that is, some tunes rely on it, but I don't know of any tunes relying on e.g. PT3's behaviour).
Maybe it would help you read my description here:
https://wiki.openmpt.org/Development:_Test_Cases/MOD#ptoffset.mod
If that still doesn't help, read OpenMPT's Snd_fx.cpp, look in the function CSoundFile::SampleOffset for SONG_PT_MODE. This deals with the PT1/2 quirks.
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker

Nikku4211

  • Rising Star
  • *
  • Offline Offline
  • Posts: 152
  • Also known as Nikku4212
    • View Profile
Re: The Counting Riddle (sample offset question)
« Reply #4 on: June 17, 2017, 20:27:26 »

@Sagamusix

OpenMPT needs to support all of these in case some modules exploit each of these sample offset bugs.
« Last Edit: June 19, 2017, 23:43:13 by nikku4211 »
Logged

Steffest

  • New User
  • Offline Offline
  • Posts: 11
    • View Profile
    • Online Tracker
Re: The Counting Riddle (sample offset question)
« Reply #5 on: June 19, 2017, 10:27:18 »

Aha!

Thanks Saga Musix,
Without a doubt you have the deepest technical tracker knowledge on the planet, but of course you already knew that :-)

To boil it down to a simple ruleset for my own peace of mind:

For PT1 and 2 playback

  • if a 9 command is present, advance the sample offset and set the start of the sample
  • advance the sample offset again (but don't set start)
  • at the next note, when no sample number is given, don't reset the sample offset (and do reset the offset otherwise) then set start of the sample and apply effects

That's why the offset gets tripled in some cases on notes with no sample number and a repeating 9 command.

The way XMPlay in PT1 mode handles this is a small bug IMHO, as I haven't seen this behaviour on any other player on any other platform.


 
Logged

Saga Musix

  • TMA Moderator
  • Top Poster
  • ****
  • Offline Offline
  • Posts: 2571
  • I love OpenMPT! And Modules! And TMA! And Pie! :>
    • View Profile
    • Saga Musix - free module music and more!
Re: The Counting Riddle (sample offset question)
« Reply #6 on: June 19, 2017, 14:17:23 »

Quote
That's why the offset gets tripled in some cases on notes with no sample number and a repeating 9 command.
To be even more precise, it cannot only get tripled, but it can advance indefinitely (up to the end of the sample) if no instrument number is present. So a series of 901 effects with no instrument number will slowly sweep through the whole sample.
Logged
» My TMA artist profile
» Visit my music site: https://sagamusix.de/ [de, en]
» Visit my programming website: https://sagagames.de/ [de]
» Open ModPlug Tracker
Pages: [1]   Go Up