From UFOpaedia
Revision as of 14:35, 12 March 2013 by Morgan525 (talk | contribs) (→‎Garbled MIDI)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The files with the names of soundcards, adlib, roland and gm (general midi) store the respective Geoscape and Battlescape music sequences for their respective cards.

For those with plain soundblaster compatibles, was used. Those with Roland Gus's or general midi output devices, they used their respective files for the music sequences. They're stored in different files because the midi devices handle their data in different ways.

These files are only used by the Dos version - and perhaps are the reason why the music in the dos version, on certain soundcards, sound a lot better than the CE versions (though your mileage may vary). Speaking of which, these three files were replaced in the Collectors edition with midi files, one for each music sequence - this allows for a bit more freedom in modding as you can replace the midi files you don't like with other midi files.

The CE version of UFO leaves out for some really odd reason, so your intro sequence has no sound effects. Worse still, it will not play even if you copy it in.

I think there were a few 0-byte com files in here as well, but they did nothing and weren't used by the game.


The .com files in my game are not empty, they probably do some low level sound card service, but on the other hand, in the main .bat file sound\sndstart and sound\sndend exe files are called. I looked into the them for strings they contain, and found names of other coms and exes in sound directory. I think sndstart/sndend is just a wrapper for a convenient use in .bat file.

The INTRO.CAT file was used only by old sound engine - DOS 1.4 uses (and CE should use) SAMPLE3.CAT. Erasing it makes CE crash with error:

Error Code 0
FILE: D:\SS\XCOM\UFO Defense\Stubs.c
LINE: 58

Cannot open file Sound/

I'm not sure which files 1.4 version uses for Roland support, because there are two files (one for intro music, one with rest of it) - this construction was used by 1.2 engine. There isn't one file with all the music in it.

- Quantifier

Garbled MIDI

A couple of the MIDI files seem to have screwed up instrument sounds when played on my computer -- I tried them on a friend's computer and had the same problems. The two major problems are the files for the intro music "GMINTRO1.MID" and particularly the BattleScape music "GMTACTIC.MID" -- I think there's supposed to be a low-pitch piano key (every now and then when I alt-tab out and back the sound works fine) but instead it just sort of sounds like a blown speaker. I was wondering if anyone else is having this sort of sound trouble and if there is a way of fixing it.

Yes. The midi playback gets very distorted if you tab out and back to the window especially during combat. If the music changes or reloads, it will play fine from that point but saving-exit-reload will fix the problem as well. One of the main issues is with the type of midi synth that your system uses. Some people seem to have one the data for the midi file seems to like, while others have different instruments for the same values and thus the sound is horrible. It seems that many of the tracks in the midi files are set to 00 (01?) which is a grand piano in the default microsoft synth table. I downloaded a midi editor and only had to changed the instrument number and the music played very similar to what I remember from the DOS game. At the very least, it was a significant improvement over what was previously playing.

Tycho 20:27, 8 March 2012 (EST)

Modified sounds between 1.2 and 1.4

Anyone know exactly which sounds were modified between 1.2 and 1.4? Was it just the alien death screams? All of them, or only some? Phasma Felis 21:15, 6 June 2008 (PDT)

Music modding

Discussion moved from my userpage. It belongs more to this page. Seb76 03:31, 8 June 2008 (PDT)

Thanks for the userpage, Seb! :) I have a (probably very silly) project I could use some advice with.
I want to give the DOS version of X-COM the ability to play the excellent CD music from the PlayStation version. X-COM DOS plays its music through a TSR called MUSIC.COM in the SOUND subdirectory, which is loaded into memory when X-COM is started and then receives commands from it somehow. I've found a TSR CD player, Mercury Soft CD Player, that works in DOSBox and runs fine with X-COM, and if copied over SOUND.COM, X-COM will automatically start it and it responds to its hotkeys properly. I figure all that's left to do is disassemble SOUND.COM, figure out how it receives its signals, then disassemble MCD and modify it to respond to those same signals.
Of course, that's probably the hardest part :) It helps that both SOUND.COM and MCD.COM are less than 4K each, but my experience with assembler is very slim and many years out of date. You suggested using IDA in the Grenade discussion, so I'll be giving that a look. Any other suggestions or advice to get me started? Phasma Felis 20:46, 6 June 2008 (PDT)
The way it works in the CE version is still influenced by this. Only the mouse, video and sound code was wrapped with windows calls; the rest was left as-is. All the sound related operations are centralized in one procedure taking 3 arguments. The first that I dubbed 'opcode', and 2 others that are not used (but may be of use in the DOS version). I suspect that in DOS version these arguments are passed to the TSR by some way to trigger sound actions. Here are the details I know from the CE edition:
  • if the opcode is >0x7f (i.e. the most significant bit is set), then it is a music change request (translated into a 'play midi' sequence in the CE edition), else it is a digitized sound that will be played
  • the music sample number is extracted by removing the high bit (opcode-0x80)
  • cases 1,5 and 14-17 stop the music but don't start a new sequence
  • for other cases, it starts playing a midi file (and stops the current playing if any):
Sample idx Sound file
0 sound/gmgeo1.mid
2 sound/gminter.mid
3,4 sound/gmdefend.mid
6,7 sound/gmenbase.mid
8 sound/gmmars.mid
9,12 sound/gmstory.mid
10 sound/gmlose.mid
11 sound/gmwin.mid
13 sound/gmtactic.mid
18 sound/gmgeo2.mid
You need to get this sample idx and remap it to the PSX track you want to play. I don't know if you can map all PSX tracks.
PS: What is the 'official' way of moving this to the talk page... Cut/Paste? Seb76 04:11, 7 June 2008 (PDT)
Edit: I could grab a DOS version of XCom and noticed there are no mid files in the first place so this won't be useful if you want to patch the DOS version. Seb76 11:53, 7 June 2008 (PDT)
Awesome! Thanks very much, I think this will help. The music in the DOS version is all stored in two files (ADLIB.CAT and GM.CAT), but I'll bet the indexes are the same. Most of the PSX tracks map well; there's a few oddities, and it has two extra Geoscape tracks and one extra Battlescape, but I'll probably just choose those randomly each time (I'm tentatively thinking that the two least-significant bits of the system clock should work, and hopefully be easier to implement than a proper RNG).
P.S. I think cut/paste should be fine for moving it to the Sound talk page (I think that's what you meant). Just be sure to give it an appropriate heading. :) Phasma Felis 19:51, 7 June 2008 (PDT)

The two geoscape sequences really consist of four songs that are about 4 minutes each. The PSX version splits these into the individual tracks. Also the, and files, if I'm not mistaken, contain the complete set of music in each file but are set up to work for their respective sound card types. Most Sound Blaster users will have been listening to the sequences. - NKF 22:31, 8 June 2008 (PDT)