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] 2   Go Down

Author Topic: Zone 66 music conversion help  (Read 26918 times)

0 Members and 1 Guest are viewing this topic.

Malvineous

  • New User
  • Offline Offline
  • Posts: 10
    • View Profile
    • http://www.shikadi.net
Zone 66 music conversion help
« on: July 13, 2014, 14:02:23 »

Hi all,

I'm working on a conversion utility for the music in the DOS game Zone 66.  I have successfully reverse engineered the file format (documented here) and converted it to ScreamTracker S3M format.  (I selected this format because it was one of the few that support both sampled and Adlib instruments.)

However, there are still a few unknowns and I'm wondering whether anyone here with a bit of tracking experience can offer some suggestions, as the format seems to share a lot of things with its contemporaries.

  • The sampled instruments have their centre frequency as 33075Hz.  This is a number I guessed by listening, but it seems a bit high to me for a song from the early 90s.  The notes seem to be played in very low octaves, so I am wondering whether the song needs to be transposed and the frequency lowered.  Some of the pitches don't quite match what the game sounds like, but I've been listening to both correct and incorrect versions of the songs for so long now I can't really tell any more which is right and which isn't...!
  • The "speed" is the only figure copied directly from the source file.  To play at the correct rate, the "tempo" has to be set to 144 or so.  This is another magic number which I came up with by twiddling until the drum loop in the title sequence looped fairly smoothly.  Is there something special about a tempo of 144? (0x90)  Is there a well known tempo value close to this that is probably more correct?
  • Has anyone ever created a song that uses both Adlib and sampled instruments?  When I play these files in ScreamTracker the Adlib notes seem to play too soon relative to the sampled ones, but when I use SchismTracker they are fine.  But then SchismTracker seems to mangle some Adlib notes so I'm not sure.  Just looking for feedback as to whether there are any known issues with trackers/players in this respect.
  • Some of the Adlib notes seem to play very quietly compared to the sampled ones, but this only seems to affect ScreamTracker.  SchismTracker seems ok.  Not sure which way is better...

If you'd like to take a look at the files, here are z66title2.s3m and  z66ep1v2.s3m.  If you're not familiar with the game, some recordings I made are available in Ogg Vorbis at VGMPF (the first two tracks - 101 Theme and 102 Foreign Shores - match the .s3m files.)

Any feedback would be much appreciated!
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: Zone 66 music conversion help
« Reply #1 on: July 13, 2014, 14:34:44 »

The sampled instruments have their centre frequency as 33075Hz.  This is a number I guessed by listening, but it seems a bit high to me for a song from the early 90s.  The notes seem to be played in very low octaves, so I am wondering whether the song needs to be transposed and the frequency lowered.
Well, the fact that the low octaves make up for the high sampling rate pretty much tells you already that your assumption of 33075 being the middle-C frquency is wrong. The original tracker that was used to create the songs (and thus, the CDFM format) may have had a completely different idea of what middle-C is than ST3 had - this is not a rare thing, e.g. C-2 in ProTracker is C-4 in ScreamTracker/Fasttracker, which in return is C-5 in Impulse Tracker.
Incidentally, 33075 is exactly two octaves above ProTracker's middle-C frequency, so you can safely assume that the octaves found in those files are ProTracker octaves and need to be transposed upwards by two octaves (and the sample frequency needs to be divided by 4) to map the CDFM middle-C to ScreamTracker's middle-C.

Quote
The "speed" is the only figure copied directly from the source file.  To play at the correct rate, the "tempo" has to be set to 144 or so.  This is another magic number which I came up with by twiddling until the drum loop in the title sequence looped fairly smoothly.  Is there something special about a tempo of 144? (0x90)  Is there a well known tempo value close to this that is probably more correct?

I'm not sure about that one, but you may know that the CDFM format is somewhat related to 669 (made by the same person), which also has some magic numbers regarding tempo and speed which are different (tempo 78, speed 4) from those usually found in ProTracker-like formats (tempo 125, speed 6). It may simply be an idiosyncrasy he came up with while developing his player routines. One thing that could also come into play are PAL vs NTSC timing differences here.

Quote
Has anyone ever created a song that uses both Adlib and sampled instruments?  When I play these files in ScreamTracker the Adlib notes seem to play too soon relative to the sampled ones, but when I use SchismTracker they are fine.
I wouldn't be surprised if that's a DOSBox issue. I can probably confirm this on a real machine if you really want it, though.

Quote
Some of the Adlib notes seem to play very quietly compared to the sampled ones, but this only seems to affect ScreamTracker.  SchismTracker seems ok.  Not sure which way is better...
In the intro tune I'd even say that some of them are too loud in ScreamTracker, not too quiet. I'm sure this can depend on factors such as if ScreamTracker uses stereo or mono output.

BTW: Your updated conversions seem to lack the "pattern jump" command in the last patterns to jump to the correct restart position.

Thanks for the conversions, btw. I've been searching for this soundtrack in a "normal" mod format for years, I even asked CCCatch if he still has the files, and while he said that he'd have to look at his parents' place, I haven't heard back from him since then.
« Last Edit: July 13, 2014, 14:42:32 by Saga Musix »
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

Malvineous

  • New User
  • Offline Offline
  • Posts: 10
    • View Profile
    • http://www.shikadi.net
Re: Zone 66 music conversion help
« Reply #2 on: July 13, 2014, 15:46:59 »

Well, the fact that the low octaves make up for the high sampling rate pretty much tells you already that your assumption of 33075 being the middle-C frquency is wrong. The original tracker that was used to create the songs (and thus, the CDFM format) may have had a completely different idea of what middle-C is than ST3 had - this is not a rare thing, e.g. C-2 in ProTracker is C-4 in ScreamTracker/Fasttracker, which in return is C-5 in Impulse Tracker.

Aha, that's what I am missing!  Sorry, despite listening to mods for years, this is my first attempt at actually trying to work with them!  I didn't realise the idea of what middle-C is varied so much.  Suddenly explains why the Halloween Harry/Alien Carnage songs were all a couple of octaves too low...

Quote
Incidentally, 33075 is exactly two octaves above ProTracker's middle-C frequency, so you can safely assume that the octaves found in those files are ProTracker octaves and need to be transposed upwards by two octaves (and the sample frequency needs to be divided by 4) to map the CDFM middle-C to ScreamTracker's middle-C.

While this makes perfect sense, it raises more questions!  I transposed the notes up by two octaves and set the frequency to 8268 and it sounds really good.  I tried 8363 too but it was off-key, so is 8268 a ProTracker default?  I can't seem to find a mention of this at present.

However this now transposes all the Adlib instruments up by two octaves!  I put an exception in the converter to only transpose notes on the sampled channels and this seems to produce the right output, but does seem a bit weird the two instrument types would use different middle-C notes.  See what you think: z66ep1v3.s3m z66title3.s3m.  Perhaps I should be transposing Adlib notes too but adjusting the middle-C frequency for those instruments?  But by only transposing the sampled notes they all end up around similar octaves so maybe this is best...  (Incidentally if you know of any documentation explaining how the ST3 middle-C frequency is applied to Adlib instruments I could really use it!)

Quote
I'm not sure about that one, but you may know that the CDFM format is somewhat related to 669 (made by the same person), which also has some magic numbers regarding tempo and speed which are different (tempo 78, speed 4) from those usually found in ProTracker-like formats (tempo 125, speed 6). It may simply be an idiosyncrasy he came up with while developing his player routines. One thing that could also come into play are PAL vs NTSC timing differences here.

Oh wow that's amazing, I had no idea!  For some reason I assumed .669 was an old format from the Amiga, I didn't realise it was a PC tracker!  And by Renaissance!  Feeling stupid now :-)  At least it helps explain some magic numbers.

Quote
I wouldn't be surprised if that's a DOSBox issue. I can probably confirm this on a real machine if you really want it, though.
Oh thanks for the offer, you could be right there.  I do have a few DOS machines around so I'll save you the effort and try it next time one is plugged in.

Quote
In the intro tune I'd even say that some of them are too loud in ScreamTracker, not too quiet. I'm sure this can depend on factors such as if ScreamTracker uses stereo or mono output.

Yes I thought the same thing about the intro tune, but some of the others are really quiet.  Have a listen to z66ep3v3.s3m, the "twinkly" Adlib is so quiet.  Maybe the 0-15 volume doesn't translate linearly to S3M's 0-63?  Not sure how you would go about testing that...

Quote
BTW: Your updated conversions seem to lack the "pattern jump" command in the last patterns to jump to the correct restart position.

Thanks for the conversions, btw. I've been searching for this soundtrack in a "normal" mod format for years, I even asked CCCatch if he still has the files, and while he said that he'd have to look at his parents' place, I haven't heard back from him since then.

Oh you've seen my earlier attempts?!  They were hacky as I had to hard-code the offsets of each pattern, but now I have rewritten everything from scratch to handle patterns correctly.  Once I've gotten everything sorted I'll gladly put up a link to the fully converted soundtrack if you'd like.

The pattern jump I added by hand previously but I'm in two minds whether I should put it in automatically.  It complicates the conversion because you could theoretically have the last pattern played twice, but you would only want the jump command the second time the pattern was played.  So you'd have to duplicate the pattern just to add the jump command, which no longer matches the original song...  I think I will leave it out and it's something that can be added by hand along with titles for a "curated" conversion.
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: Zone 66 music conversion help
« Reply #3 on: July 13, 2014, 16:13:20 »

While this makes perfect sense, it raises more questions!  I transposed the notes up by two octaves and set the frequency to 8268 and it sounds really good.  I tried 8363 too but it was off-key, so is 8268 a ProTracker default?  I can't seem to find a mention of this at present.
8287 would be the default for PAL machines. I think 8363 comes from NTSC, and you must be aware here that some formats (even on PC) use the PAL constant as a base, others use the NTSC constant. Frequency calculation in Screamtracker is for example slightly different than what you would do in a classic ProTracker module. Which calculations is the exactly correct one can of course only be figured out by having the original tracker, or by directly comparing the game's audio output with a render from e.g. ST3.

However this now transposes all the Adlib instruments up by two octaves!  I put an exception in the converter to only transpose notes on the sampled channels and this seems to produce the right output, but does seem a bit weird the two instrument types would use different middle-C notes.
Well, as said, concepts are all but standardized between trackers, so it's possible that PCM middle-C doesn't match up but OPL interpretation is the same? I'm not really familiar with OPL instruments in ST3 so I don't even know if they have a concept of a variable middle-C pitch.

(Incidentally if you know of any documentation explaining how the ST3 middle-C frequency is applied to Adlib instruments I could really use it!)
Would the original ASM mixer code be of help? :)

Yes I thought the same thing about the intro tune, but some of the others are really quiet.  Have a listen to z66ep3v3.s3m, the "twinkly" Adlib is so quiet.  Maybe the 0-15 volume doesn't translate linearly to S3M's 0-63?  Not sure how you would go about testing that...
Yeah, it's probably yet another thing that could only be confirmed with the original tracker. Or maybe you could create a test music file to replace the original music file and see how it translates things in-game?

Oh you've seen my earlier attempts?!  They were hacky as I had to hard-code the offsets of each pattern, but now I have rewritten everything from scratch to handle patterns correctly.  Once I've gotten everything sorted I'll gladly put up a link to the fully converted soundtrack if you'd like.
Sure, that would be cool. I think I saw your first attempts on the SchismTracker board, and even pointed out some errors back then which have been fixed in the meantime.

The pattern jump I added by hand previously but I'm in two minds whether I should put it in automatically.  It complicates the conversion because you could theoretically have the last pattern played twice, but you would only want the jump command the second time the pattern was played.  So you'd have to duplicate the pattern just to add the jump command, which no longer matches the original song...  I think I will leave it out and it's something that can be added by hand along with titles for a "curated" conversion.
Yeah, I do understand the difficulty of doing this programatically. I just assumed that you did it that way before since neither in the intro nor the level 1 music you'd have to duplicate any patterns.
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

Jay

  • Newbie
  • Offline Offline
  • Posts: 59
    • View Profile
Re: Zone 66 music conversion help
« Reply #4 on: July 29, 2014, 03:43:33 »

Thanks for doing this! I've wanted to poke around with these tunes in module form for ages as well. Really cool to see how they're made; definitely post some updates here when you've got them!

Has anyone ever created a song that uses both Adlib and sampled instruments?  When I play these files in ScreamTracker the Adlib notes seem to play too soon relative to the sampled ones, but when I use SchismTracker they are fine.  But then SchismTracker seems to mangle some Adlib notes so I'm not sure.  Just looking for feedback as to whether there are any known issues with trackers/players in this respect.

They seem to play fine on my setup, no apparent timing problems... I'm using a GUS for digital playback and an SB for FM (ST3 can use both at the same time if they are installed together - theoretically this should work under Dosbox too, but who knows.) I also tried in 'pure' SB mode and didn't hear any problems.

Foreign Shores (z66ep1v3.s3m) has an FM snare layered with a sampled snare - they should (and do) hit at exactly the same time. Best test I could think of.

I can record the output from my machine for you if it helps. Let me know.

Old OPL2 chips on SB cards are notoriously slow to respond but I didn't think that extended to *music timing*... I'm using an AWE64 with Creative's CQM FM chip.

I think Manwe/Sands has some tracks up on Youtube using simultaneous FM+samples.
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: Zone 66 music conversion help
« Reply #5 on: July 29, 2014, 13:52:43 »

To be precise, old SoundBlasters are very slow to respond in general. Not just the OPL chip, but pretty much any communication.
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

Malvineous

  • New User
  • Offline Offline
  • Posts: 10
    • View Profile
    • http://www.shikadi.net
Re: Zone 66 music conversion help
« Reply #6 on: July 29, 2014, 16:28:01 »

8287 would be the default for PAL machines. [...] Which calculations is the exactly correct one can of course only be figured out by having the original tracker, or by directly comparing the game's audio output with a render from e.g. ST3.

Interesting.  I'm guessing from the octave thing I should probably stick with ProTracker constants for the time being.

Well, as said, concepts are all but standardized between trackers, so it's possible that PCM middle-C doesn't match up but OPL interpretation is the same? I'm not really familiar with OPL instruments in ST3 so I don't even know if they have a concept of a variable middle-C pitch.
Would the original ASM mixer code be of help? :)

I was about to say: Yes! Definitely!  ...but ASM?  Hmm...that could take a while to decipher, unless it just happens to be heavily commented.  ST3 does adjust the note pitch if you alter the middle-C pitch for an OPL instrument.

Yeah, it's probably yet another thing that could only be confirmed with the original tracker. Or maybe you could create a test music file to replace the original music file and see how it translates things in-game?

Well I have now written my own player, and it is able to play these "quiet" notes at the correct volume.  I think the reason they are quiet is due to a bug in the OPL volume handing part of SchismTracker, as I also discovered that the reason some OPL notes go funny is because they are being faded out and SchismTracker seems to update the wrong OPL register when changing the volume of an active note.  (Perhaps it updates both the carrier output level and the modulator output level, whereas only the carrier should be changed.)  So I'm confident now I am handling the volume correctly.

Thanks for doing this! I've wanted to poke around with these tunes in module form for ages as well. Really cool to see how they're made; definitely post some updates here when you've got them!

Will do!  I've just done some reverse-engineering on the GUS variant since some of the GUS songs are quite different to the SB/AdLib ones, and I have gotten a preliminary converter working.  Still unsure how the speed values are calculated (they almost look like BPM figures but not quite) and there seem to be two different delay commands I'm not sure how to handle yet, but it's coming along nicely.  Here's a sample if you're curious: z66title-gus-beta.s3m.  Still have a few volume issues here too, and I'm sure the delay values aren't quite right either.  Any feedback is welcome if you can hear/see what the issue could be!

They seem to play fine on my setup, no apparent timing problems... [...] Foreign Shores (z66ep1v3.s3m) has an FM snare layered with a sampled snare - they should (and do) hit at exactly the same time. Best test I could think of.
I can record the output from my machine for you if it helps. Let me know.

Glad to hear it!  Thanks for the feedback.  Sounds like everything is good as far as sync goes then.  Thanks for the offer of the recording but I'm happy to take your word for it :-)
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: Zone 66 music conversion help
« Reply #7 on: July 30, 2014, 14:37:09 »

I suspect that the different pattern format for GUS tunes might be using the GUS' internal interrupt timer for counting. You may want to read up on the GUS timers to see if that makes sense.
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

Malvineous

  • New User
  • Offline Offline
  • Posts: 10
    • View Profile
    • http://www.shikadi.net
Re: Zone 66 music conversion help
« Reply #8 on: August 08, 2014, 12:08:53 »

Thanks for the tip.  I've looked at the GUS timers but nothing really obvious stood out, however upon closer inspection all GUS files have the same value for the tempo byte (but they still run at different speeds) so I'm wondering whether that byte is not actually tempo - some more investigation is needed I think.

I did however figure out that the volume is not linear but logarithmic, so this tweak now makes the GUS songs sound very close to correct: z66title-gus-beta2.s3m

There are still a few commands I'm unsure of - both of them seem to be delays but I'm not sure how they should be handled (I'm currently ignoring one entirely which can't be right) so I'll post back if I have any luck.  Might still be related to the GUS timers after all, so I'll keep that one in mind.
Logged

Malvineous

  • New User
  • Offline Offline
  • Posts: 10
    • View Profile
    • http://www.shikadi.net
Re: Zone 66 music conversion help
« Reply #9 on: August 20, 2014, 04:52:09 »

Ok I think I have gotten this as good as done.  The tempo value seems completely unused in the GUS songs, and instead they have a command at the start of each (and every) pattern that sets the speed.

I've converted all those files now, so here's a download for anyone who's interested:

Zone 66 full soundtrack in .s3m format

The Adlib songs only have OPL instruments and will play correctly in AdPlug.  The GUS songs only have sampled instruments and will play correctly in any .s3m player.  The Sound Blaster songs have both OPL and sampled instruments, so most players will be missing half the instruments, except for the small number of players that support both.  Those songs marked as both Adlib and Sound Blaster just have the sampled instruments dropped in Adlib mode, so if you play them with AdPlug then it will ignore notes played with sampled instruments and so you'll hear the song in Adlib mode.

The Amnesia demo also used the same format for its music, so I have ripped and converted those songs too in case anyone is interested:

Amnesia full soundtrack in .s3m format

amnesia5.s3m only has OPL instruments so will be fine in AdPlug, while the others all have OPL and sampled instruments.

I hope these conversions are as close to perfect as is possible, but if you notice any differences (and can give me specific feedback about what's wrong) do let me know.

I did have to modify a couple of files from both sets which had the final pattern used multiple times.  I duplicated this so I could add a loop command to the end of the song, to make it loop correctly.  I've made a note in the instrument names for the songs where I had to do this.  I also noticed that at least one song has some unused patterns in it which is kind of exciting to find!

I hope someone finds these useful :-)  Thanks for all the help in getting me to this point, I really appreciate it!
Logged
Pages: [1] 2   Go Up