Author Topic: Extracting Adlib-Instruments from Lemmings 2  (Read 4498 times)

0 Members and 1 Guest are viewing this topic.

Tax-5

  • Guest
Extracting Adlib-Instruments from Lemmings 2
« on: August 07, 2014, 10:40:22 AM »
Im working on a musical project and i want to use the sounds of Lemmings 2 in it.
Im not speaking of sampling the sound effects or small loops. I mean to use the real L2 adlib sounds.

I have a modified computer with a CT1600 soundblaster and a program to "create" soundblaster instruments and play them over MIDI.
This is already working fine.

Now i need the soundblaster instruments that are stored somewhere in the music files of Lemmings 2.
I searched a lot in google and it seems that my request is a little special and nobody has done this before.

The question is now: where are those informations stored and what format are they?
I dont need the midi-files, just the adlib instrument definition. They should be about five to ten of them each track.
Does somebody know how to get those informations?

Offline geoo

  • Administrator
  • Posts: 1475
    • View Profile
Re: Extracting Adlib-Instruments from Lemmings 2
« Reply #1 on: August 07, 2014, 02:46:44 PM »
I think I remember asking ccexplore (probably via PM unfortunately, which means that information is lost now) about those samples out of curiosity to get them as wavs or something almost a decade ago, he elaborated on a few things but I didn't end up getting anything out of it.

Anyway, I found a few threads from the forum archives which might be relevant, most notably this one: http://www.camanis.net/lemmings/lemmingswelt/forums/?topic=1121193817
The topic references this one: http://www.camanis.net/lemmings/lemmingswelt/forums/?topic=1114127516
Here's another topic in which ccexplore posted some tool to mute certain channels: http://www.camanis.net/lemmings/lemmingswelt/forums/?topic=1115137024
The 'guest' posting there is active as ccexplore on this current incarnation of the forums.
You can record what I think is the raw OPL output with dosbox in .dro format, and then I think there are also .vgm dumps.

I know nothing about these things myself, but maybe this could be a starting point.

Tax-5

  • Guest
Re: Extracting Adlib-Instruments from Lemmings 2
« Reply #2 on: August 07, 2014, 03:24:22 PM »
No. This wasnt what im looking for.
I do not need the MIDI Files (they only contain the song information... play Note C, play Note A etc..)

What i need is the information where the instruments are stored.
Its difficult to explain. In Lemmings there are a lot of sounds.. basses, leads and so on.
Those are information how the soundblaster (adlib/opl2) has to do its job.

And those are the informations that i need.
I also checked your first link, but none of the downloads work anymore.. i already tried other tools and didnt get any usable results.

I'll try it with a hex editor...

Offline geoo

  • Administrator
  • Posts: 1475
    • View Profile
Re: Extracting Adlib-Instruments from Lemmings 2
« Reply #3 on: August 07, 2014, 05:59:08 PM »
Duh, I know you're not looking for MIDI files. I don't even know why you assumed that, I didn't even mention MIDIs. Just because some people in those threads tried to figure out information with the aim to get MIDIs of the Lemmings music doesn't mean that this this is the only thing you can do with that information. I don't claim that this information is useful especially considering it pertains to Lemmings 1 (though it seems that the .dat files in the Lemmings 2 music folder have at least some signature bytes in common with the corresponding Lemmings 1 files), but it seemed that Borg_Number_One had some things figured out, but as you said, unfortunately the links are dead. I'm not sure whether some people here still have some of the stuff lying around.

Anyway, as I said, wouldn't a manual DoxBox .dro recording which "contains 'raw' recordings of the writes to the registers of the Adlib synth / Yamaha OPL2/dual OPL2/OPL3 chip." contain that information you're looking for somewhere in it?
But yeah, maybe you're easier off just trying to figure the relevant parts of the formats of the Lemmings 2 music files. I doubt you need the following because those files don't have the compression format's signature bytes, but just in case, there's a compressor to a compression format commonly used in Lemmings 2 here: http://www.camanis.net/lemmings/tools.php

If you have any findings, it'd be cool to have a report on them. :)

Offline ccexplore

  • Posts: 5311
    • View Profile
Re: Extracting Adlib-Instruments from Lemmings 2
« Reply #4 on: August 07, 2014, 08:42:39 PM »
I haven't ever done anything with DOS Lemmings 2's files.  However, I did just quickly load up DOS Lemmings 2's adlib.bin in a debugger/disassembler and it looks very much similar to the way adlib.dat in Lemmings 1 is laid out (after decompression in the case of Lemmings 1; the Lemmings 2 file is not compressed it seems).  It appears to start with the actual programming for playing the music, followed by the data for the music themselves.  From just a quick glance I suspect there might be enough similarities that, I suspect what I (used to) know about DOS Lemmings 1's adlib.dat would probably directly carry over to Lemmings 2's adlib.bin.

Anyway, geoo's suggestion isn't wrong.  In the worst case where we can't work out adlib.bin, if you use DOSBox to capture a .DRO recording from the game as it runs, it basically records all the raw OPL2/OPL3 commands send by the game to the sound card, and from there with a little programming, you can effectively deduce the instrumentation from the raw commands, not just the musical notes.  But admittedly it's probably easier if L2's adlib.bin is laid out very similarly to L1's adlib.dat.  If I recall there will be a section (or maybe one section per song) that specifically contains the instrumentation-related data you are looking for.

I have to work for a living nowadays and a lot of this stuff happened a long time ago, so unfortunately I simply can't promise I will be able to set aside any time to help you, especially with a lot of the old work and notes now on an old XP laptop that barely works anymore.  (And also, admittedly the DOS version of the Lemmings 2 music isn't exactly my preference anyhow.)  I'll post here when/if I have any relevant information to share.

Tax-5

  • Guest
Re: Extracting Adlib-Instruments from Lemmings 2
« Reply #5 on: August 08, 2014, 08:14:06 AM »
Thanks for your help. I was succesful yesterday (it almost drove me crazy)
I didnt knew that you can record the OPL-Data within DOSbox... i usually dont use Dosbox.

Well... first i recorded the OPL-data in Dosbox. (I had to download Lemmings 2, because my CD-version has no Soundblaster Sound)
After recording, i had to convert the .dro File into a .imf File (There are tools out there, but you'll have to figure out WHAT do you want to convert)

Now it gets a little complicated and "work-intensive":
I have a small tool called "ImfCreator". There is a small function inside where i can import instruments from .imf Files.
The hard part is, that the program is very unstable, doesnt run on older systems and you can only import ONE instrument from an .imf File.
You are also unable to create a new/blank instrument-bank and just put it in there. You always have to overwrite the standard GM-instruments.

Anyway. After importing an instrument, the program shows the settings (like on synthesizers).. now i can write them down or make a screenshot of it.
Going back to my music-computer (where imfcreator wont work) i'll type all the settings into my nice little music programm.
Repeating those steps for every single sound within a tune... depending on the instrumentation, each tune has 10-20 sounds in it.

Well.. its working but its a freaking time-taking procedure! But i'll get this done on a saturday afternoon ;)