Editing Lemmings 2 Sounds?

Started by Ste Woz Ere, September 14, 2021, 03:37:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ste Woz Ere

My copy of it has the Amiga sounds (it came that way), but I have seen a video using the original DOS sounds...so I was wondering if that version was edited somehow? I can't see anything obvious in the files/folders (aside from a .voc file that won't play in anything), so I was wondering if there was a way to edit the sounds?
Tribes of Steel - a whole new Lemmings 2 game! (120-level pack)
Currently a WIP - all tribes are complete, testing and feedback is welcome!

Simon

Idea: Run INSTALL.EXE and choose a different sound card.

Reason: I remember that the clam will "mmmmhh" the lemmings in one setting, but silently devour the lemmings in another setting. :8(): I don't believe the settings produce differences like between Amiga and DOS, but it's worth a try.

-- Simon

The Tomato Watcher

#2
If I understand what you mean by DOS sounds, I think you want the AdLib option, specifically, when you run INSTALL.EXE. The Sound Blaster sounds are supposed to be the same sampled sounds as the Amiga ones (just pitched up or down). I found this video which may be the one you're referring to which is definitely using the AdLib option. https://www.youtube.com/watch?v=KwOkrYI7v8Q

That .voc file you mentioned? It's some really weird nonstandard thing that's almost a regular .voc file but not exactly. I stumbled upon a script online that was able to extract the sound effects (mostly), but I don't there's an easy way to edit them into the game. I think you could edit them if you import the .voc file as raw audio into something like Audacity, but it would be a royal pain and you'd really have to know what you're doing. You'd have to figure out the correct frequencies for each sound, and it would just be a mess. You'd also have to save it as raw audio and change the extension to .voc manually instead of saving it as a .voc which would add an unnecessary header and mess everything up. But, it would technically work I'm pretty sure.

Dullstar

#3
Tomato Watcher's suggestion to use the AdLib option from INSTALL.EXE is correct based on what it sounds like you actually want to do (it doesn't sound like you actually want to use custom sounds).

I've looked at those .voc files in a hex editor a bit but haven't really done much of anything with them, but I believe it's a bit of other stuff with an embedded .voc. You can open it as raw audio in Audacity fairly easily, actually - there'll be a few blips because it's not entirely raw audio data, but enough of it is audio data that you'll get some recognizable stuff. The sampling rates are all messed up but I think there should be enough info in the file to piece it back together. Will take a look at it later. I suspect that without some reverse engineering work, though, the amount of possible editing would be fairly limited - you could probably swap sounds as long as you don't change the length, but I'm not sure if audacity could do it safely. You'd need to make sure you can resave the exported audio byte-for-byte before touching anything, and make sure you're only touching audio - you wouldn't want to mess with the structural bits if you don't know what they do; that could easily corrupt the whole file.

Update: The sample rate seems to be about 10101 Hz (1000000 / (256 - 0x9d)), but I don't think it's correct for every sound. Need to investigate how separate sound effects are separated.
https://moddingwiki.shikadi.net/wiki/VOC_Format
https://fabiensanglard.net/reverse_engineering_strike_commander/docs/Creative%20Voice%20(VOC)%20file%20format.txt

The Tomato Watcher

The sample rate is absolutely different for each sound. I remember when making my Lemmings voice clips video (before finding that random script) I imported the file at 8000 Hz, since I assumed that would be somewhat close to the actual sample rates, and I had to adjust the frequencies for each one differently. I have the .wavs from that script still, and while many of the sounds are indeed 10101 Hz, they can go from as low as 4032 Hz to as high as 20000 Hz. I'll attach them here so you can see which one is which, though you'll have to bear with my filenames, since I didn't number them in order; I just gave them brief, descriptive names, and frankly I'm too lazy to order them properly. There's a couple missing/bugged that the script just didn't like, so be aware of that as well.

Fun fact: the sound effects in the Atari ST version are these exact sound effects, except they ALL play at 8000 Hz, which is why a lot of them sound off.

Dullstar

#5
Yeah, the 10101 Hz is based off the first one. I figured out how they're spaced out, so I do actually have enough information to extract the correct rate for every sample (which is probably what the script does).

The file is essentially some sort of prelude, followed by a bunch of .voc files glued together. At least some editing is probably possible; but to what extant probably depends on what the meaning of all the stuff at the beginning is. If it's offsets, then you could probably insert new sound effects as long as you update the offsets properly.

I suspect that the beginning section is an array of 32-bit integers (with space for up to 128 of them) just based on the spacing, but I don't have any strong evidence of it.

UPDATE: Current working hypothesis is that each number at the beginning is the offset of one of the sounds, from the position of the first sound, i.e. take one of those numbers, add 0x200, and that should be a sound. Need to confirm it holds true for all sounds.

UPDATE 2: Yep! They're definitely offsets, AND the game definitely uses them! Try replacing the entire array with 00, or perhaps filling it up with 89 C6 00 00 for some amusing times.

UPDATE 3: I have also managed to alter the playback frequency somewhat. The ones in the file are used most of the time, with some exceptions, most notably the skill panel - my guess is that altering that would require editing the executable. Anyway, you probably can't alter the pitch of whatever the skill panel is using, but you can absolutely repoint it to use a different sound, and you could almost certainly alter the audio data (as in, I haven't actually messed with editing the audio data yet, but I see no reason why it wouldn't work).

Alright, I think that's enough for tonight.

Ste Woz Ere

Quote from: Dullstar on September 16, 2021, 11:28:54 PM
Tomato Watcher's suggestion to use the AdLib option from INSTALL.EXE is correct based on what it sounds like you actually want to do (it doesn't sound like you actually want to use custom sounds).

Partly correct - I'm interested in pitching down various sounds (oh no, argh, metal etc.) to match the original Amiga versions. (which I was able to do in NL/SL by just copying into the sound folder)
Tribes of Steel - a whole new Lemmings 2 game! (120-level pack)
Currently a WIP - all tribes are complete, testing and feedback is welcome!

Dullstar

If you're just changing the pitches, it's a single byte change per sound, though note that sounds that the game adjusts pitch on the fly (namely the skill panel) can't be adjusted.

You would, of course, need to know the desired playback rate.