View Single Post
  #2  
Old 06-09-2015, 02:32 PM
Shendare
Dragon
 
Join Date: Apr 2009
Location: California
Posts: 814
Default

For historical documentation purposes, here's what I figured out on the file formats during the course of my h4x:

ZoneNick_sndbnk.eff - Text listing of sound effects used in a zone:

Code:
EMIT
soundfile1
soundfile2
soundfile3
...

LOOP
soundfile1
soundfile2

RAND (optional, empty, never used)
ZoneNick_sounds.eff - No header, just raw 84-byte binary structs:

Code:
        public struct EffSoundEntry
        {
            public Int32 UnkRef00;
            public Int32 UnkRef04;
            public Int32 Reserved;
            public Int32 Sequence;
            public float X;
            public float Y;
            public float Z;
            public float Radius;
            public Int32 Cooldown1;
            public Int32 Cooldown2;
            public Int32 RandomDelay;
            public Int32 Unk44;
            public Int32 SoundID1;
            public Int32 SoundID2;
            public Byte SoundType;
            public Byte UnkPad57;
            public Byte UnkPad58;
            public Byte UnkPad59;
            public Int32 AsDistance;
            public Int32 UnkRange64;
            public Int32 FadeOutMS;
            public Int32 UnkRange72;
            public Int32 FullVolRange;
            public Int32 UnkRange80;
        };
EffSoundEntry field notes:

- Each sound effect record can reference up to 2 sound effects / music subsongs, SoundID1 and Cooldown1 are for daytime, SoundID2/Cooldown2 for nighttime. RandomDelay is added to whichever is active.

- SoundType 0 is for day/night environment sounds that play at a constant volume, such as bats screeching or wind blowing across an open area.

- SoundType 1 is for background music, with the option of specifying different music for daytime vs nighttime in the same location. If either SoundID is a negative number, it's a PoP-added reference to the associated line number in mp3index.txt. Otherwise, it indicates which sub-song to play in the ZoneNick.xmi MIDI file at that location.

- SoundType 2 is for environment sounds that play at all times of day or night, loudest at the center and quickly fading quieter as a character moves away. Campfires, for instance.

- SoundType 3 is for day/night sound effects like SoundType 0, but the sounds act like SoundType 2 where they are only at full volume within FullVolRange, and quickly drop off as the character moves farther away from them.

- SoundID1 (32-bit signed) is either:
  • A negative number, pointing to the appropriate line in mp3index.txt
  • Zero, indicating no sound effect or music for that time of day
  • 1-31, an index to a sound file in the EMIT section of sndbnk.eff
  • 32-161, a hard-coded sound file reference. I did some trial and error to figure these out
  • 162+, an index to a sound file in the LOOP section of sndbnk.eff. You subtract 161 from this number to know which LOOP sound file is played.

- AsDistance acts like a volume dampener, making an effect sound like it's happening farther away. 3000-3100 seems to be the cutoff where the sound disappears completely no matter what volume your speakers are on, so I use 3000 as a scale for the Volume setting in the .emt file.

- Any other fields are undetermined or self-explanatory. UnkRange64 ranges from -60 to +3000, similar to AsDistance's -60 to +4000, but plugging different values in it didn't seem to do anything. Same with UnkRange72 (0 - 10000, which would seem to be a candidate for FadeInMS, but didn't do anything), and UnkRange80 (0 - 3000) also had no effect.

Hard-coded SoundIDs found in the .eff files (I think these are all found packed in snd2.pfs):

Code:
39 - death_me
143 - thunder1
144 - thunder2
158 - wind_lp1
159 - rainloop
160 - torch_lp
161 - watundlp
Reply With Quote