How can voices sound different in Keen 4-6

This is where you can post your Commander Keen related stories, artwork, or other stuff that is related to Commander Keen but otherwise doesn't belong in another forum.
Post Reply
NY00123
Vorticon Elite
Posts: 507
Joined: Sun Sep 06, 2009 19:36

How can voices sound different in Keen 4-6

Post by NY00123 »

Here's something I've figured out... some of you have probably noticed it before, mainly if you've played some level pack or MOD with alternate music.

Just try doing the following:

1. Launch one of the games Keen 4-6, start the first level with music and sound effects turned on (Adlib/SB). Press 'enter' once so you can see all details about Keen's status and location. You should hear a certain sound effect when they appear. Press 'enter' again to get back to the game itself. You'd hear another sound.

2. Quit the game and re-launch it. This time, make sure music is turned off BEFORE you start playing anything (including a demo playback). Now do as in part 1 (get into a level and press 'enter' twice). Can you hear how does it sound different now?

3. Finally, here's when some of you have probably already noticed it.
You can repeat part 2, just with some MOD or level pack coming with alternate music tracks, and the music turned on.
An example for a relevant MOD you can check is "Keen 7: The Keys of Krodacia". The relevant sound effects should be heard like in part 2.

I can tell that there are a few other sound effects which are affected by that. Maybe all of them are affected but one may not always notice a difference.

What I guess from this, is that the original in-game IMF files have something in their beginnings which causes a change with how certain voices are being heard.
This change appears to be permanent: In order to 'restore' sounds to the 'unusual' way (as with some MOD, level pack, or music turned off), you should restart Keen and follow one of parts 2 and 3.
NY00123
Vorticon Elite
Posts: 507
Joined: Sun Sep 06, 2009 19:36

Post by NY00123 »

And here's something I've figured out which appears to be related.

For all IMF music files as extracted from the original games without modification, the first 450 bytes appear to be almost identical, with the exceptions of the first two bytes telling the length of the IMF data, and a few other bytes which seem to vary.

On the other hand, when checking out the IMFs from the MODs "Keen 7: The Keys of Krodacia" and "Keen 8: Dead in the Desert", they don't have that common series of bytes.

So, as an experiment, I've added these 450 common bytes (or 448 if we exclude the first 2 bytes of each file) to the beginnings of Keen 8's IMF files. I've also adjusted the first 2 bytes of each file telling the data length (set to filesize-2). Then I've re-imported, and tested it a bit in game.

I've actually had a hang once, heh. That could be the result of some mistake done in the way of patching, or some IMF file becoming a bit too big.
When it worked, a few in-game sound effects have actually got 'restored' to the original form, as you hear in the original games (assuming music is turned on).

So, looks like these 448 bytes have some affect on how you hear sound effects, and it's permanent once you play a single IMF track with these bunch of bytes, until you quit.

I have no real understanding of how does it all work, but I guess it has something to do with the actual OPL synth.

Maybe that tool used to convert MIDI to IMF can add these bytes, just if we want to 'preserve' the old sound effects. Although you can always get the 'wrong' sound effects by having the music turned off all the time...
NY00123
Vorticon Elite
Posts: 507
Joined: Sun Sep 06, 2009 19:36

Post by NY00123 »

OK, here are a few files that you can try out...

Basically I've stripped out data from IMF music tracks and modified things a little.
You do need the relevant Keen game, version 1.4, to run the relevant "mini-modification". See the README.TXT file for details.

Edited tracks, Keen 4: http://ny.duke4.net/files/keen/keen4voc.zip
Edited tracks, Keen 5: http://ny.duke4.net/files/keen/keen5voc.zip
Edited tracks, Keen 6: http://ny.duke4.net/files/keen/keen6voc.zip
User avatar
Malvineous
Shikadi Webmaster
Posts: 382
Joined: Wed Oct 31, 2007 21:48
Location: Brisbane, Australia
Contact:

Post by Malvineous »

This is probably caused by the way the game uses the OPL synth. The synth itself has nine channels, which means only nine notes can be playing at the same time (each channel can have a different instrument but can only play one note at a time.)

Because Keen has Adlib sound effects, it must use one or more of these channels purely for sound effects (I say 'must' because I've never actually gone looking to confirm this.) Because IMF files are raw OPL commands, they can easily play notes on the channels being used for sound effects. This means it's possible for a song to interfere with sound effects as you've heard.

It's more likely to happen with mods because the original game designers would have known of this limitation and produced music accordingly (music that leaves a channel or two spare) whereas I suspect programs that produce IMF files do not obey this rule. (Certainly the ones I wrote don't, because I didn't even think about it at the time.)

The reason the first 450 bytes of IMF files are identical is because some of that is chip configuration, but most of it is setting instruments. Many of the Keen songs share the same instruments. It's possible that some sound effect code is included in these bytes, but I would expect not. The game should have code to initialise the sound effects independently of the music, at least so that the sound effects work when you have switched the music off.

The game crashes easily with corrupted music. If you edit the files make sure you follow the four-byte grouping (not counting the two initial bytes) as per the IMF format specs.
NY00123
Vorticon Elite
Posts: 507
Joined: Sun Sep 06, 2009 19:36

Post by NY00123 »

What's interesting here, is that, at least the way it seems to me, the original Keen music tracks "interfere" with the sound effects, while alternate tracks in a few MODs and level packs don't.

Well, assuming that 'restoring' sound effects to the original form (as with original music turned on) in the MODs, is just a matter of adding the 448 bytes I've mentioned, with no major issues of hangs and the like, maybe a relevant IMF generator can be updated to add these bytes to the beginning?

EDIT: Looks like I've restored a hang in Keen 8 when enabling cheats a few times, both with 'vanilla' Keen8 and modified. So the hang seems to be irrelevant.
NY00123
Vorticon Elite
Posts: 507
Joined: Sun Sep 06, 2009 19:36

Re: How can voices sound different in Keen 4-6

Post by NY00123 »

About 11.5 years later, I decided to upload a video to YouTube with a demonstration from Keen 4:

https://www.youtube.com/watch?v=td3-zGWc5hc

The previously attached ZIP files should still be as usable as they were.
User avatar
Roobar
Vorticon Elite
Posts: 3263
Joined: Tue Jan 08, 2008 16:12
Contact:

Re: How can voices sound different in Keen 4-6

Post by Roobar »

Nice find! I think I once noticed that, but never really thought too much about it or it didn't bothered me.

What's more interesting to me is that you mentioned the colors have been incorrectly rendered. This bothers me a lot. A lot of the gameplay videos on yt are with these wrong colors. I thought it was the version people are downloading, but now you mention something about a rendering issue. Is your actual game colors correct, but your recording software is changing them? What recoding software are you using? I really need to know why these colors are like this.
NY00123
Vorticon Elite
Posts: 507
Joined: Sun Sep 06, 2009 19:36

Re: How can voices sound different in Keen 4-6

Post by NY00123 »

Roobar wrote: Mon Jun 21, 2021 9:00 Nice find! I think I once noticed that, but never really thought too much about it or it didn't bothered me.
I don't remember when I found out the connection to the music. Originally, I just heard the somewhat differing sounds in Keen 8 (revision 2). It's very possible that I initially assumed these were custom mod sounds, given that this revision did have its own music tracks and sound effects, or at least a few of the latter.

Now, it's only a guess, and I don't remember the answer for sure. Either way, I don't think that I'll reveal too much by writing the following information. Basically, in my old Keen 6 level pack, AAMBA, the super secret level uses its own music track replacement. It isn't impacting sound effects like the official tracks, so this could be where I figured out the connection to the original soundtrack. It's even possible that I experimented with appending the aforementioned ~450 bytes to the super secret level's track, but looks like there was no release with such a modification.

On a side note, this track replaced "Into the Future", thus explaining the absence of the latter.
What's more interesting to me is that you mentioned the colors have been incorrectly rendered. This bothers me a lot. A lot of the gameplay videos on yt are with these wrong colors. I thought it was the version people are downloading, but now you mention something about a rendering issue. Is your actual game colors correct, but your recording software is changing them? What recoding software are you using? I really need to know why these colors are like this.
I still don't have an answer about this. I don't upload videos sufficiently often to know for sure what is an optimal way to record and process a game's footage on YouTube. The couple of players I checked under Ubuntu 20.04 (a Linux distribution) were GNOME Videos (Totem) and VLC. I recall having a few problems while using a later build of DOSBox, so if I remember correctly, I eventually settled with capturing ZMBV-encoded file via DOSBox 0.74-3.

I did use ffmpeg. I'm unsure this was the exact command, but since it was apparently the last one in use, it was probably the one.
It's probably not optimal, given the problems I had and other possible factors, but I'm mentioning it for reference:

Code: Select all

ffmpeg -i keen4e_004.avi  -sws_flags neighbor+full_chroma_inp -s 1600x1200  -vcodec libx264 -crf 23   -acodec libmp3lame -aq 2 -f mp4 keen4e_004.mp4
Regarding the mp4 file, what's weird is that with GNOME Videos, the dark green color is darker than in DOSBox, as shown in YouTube, but it's closer to DOSBox' output in VLC.
User avatar
proYorp
Vorticon Elite
Posts: 472
Joined: Fri Mar 03, 2017 1:56
Location: Orbit
Contact:

Re: How can voices sound different in Keen 4-6

Post by proYorp »

What a coincidence, I just finished writing a whole essay on my experiences with DOSBox video recording. Maybe it will be of some interest to you.
Here it is.

Something I learned is that the ZMBV codec seems to not be widely supported in full, and the display does indeed depend on the video player. That probably has a lot to do with it.
"Friendly. Very friendly. Too friendly." Image
User avatar
XkyRauh
Mortimer's RightHand Man
Posts: 418
Joined: Thu Nov 01, 2007 16:32
Location: San Diego, California

Re: How can voices sound different in Keen 4-6

Post by XkyRauh »

The Bounder's jump/impact noise changes also, multiple times in that video. :(
Post Reply