EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Tools (https://www.eqemulator.org/forums/forumdisplay.php?f=593)
-   -   Old style .eff to editable .emt zone sounds converter (https://www.eqemulator.org/forums/showthread.php?t=39747)

Shendare 06-09-2015 02:26 PM

Old style .eff to editable .emt zone sounds converter
 
The original game packed the background music and environment sound effect locations for zones in a binary ZoneNick_sounds.eff file, text ZoneNick_sndbnk.eff file that listed the sound effects referenced in the binary file, and ZoneNick.xmi multi-song MIDI files.

With Planes of Power, they added mp3 music for some of the higher-level planes, added the list of them to mp3index.txt, and pointed music references in the appropriate planes' x_sounds.eff files to these new mp3s by using negative numbers for the song numbers.

In Legacy of Ykesha, they completely revamped the system. No more xmi music files and no more eff files for new zones. Zones newly created now used a text-based .emt file that listed the locations and characteristics of background music and environment sounds for zones.

No documentation was ever released on either format, but a request from Grimluck on figuring out how to customize music in the zones led me on a journey to reverse engineer them.

The result is a tool that can convert the old-style .eff files for Original through PoP zones into the editable .emt file that can be customized at will. If the client finds a .emt file for a zone, it'll ignore any old .eff files that are hanging around for it.

The field definitions in the comma-delimited .emt file are also included in any converted files, for easy human reference while editing.

------------------------------------------------------------

The source code for the command-line version is here:

https://github.com/Shendare/Eff2Emt

The source code for the GUI version in .Net 3.5 C# is here:

https://github.com/Shendare/Eff2EmtGUI

Compiled binaries can be found here:

http://www.shendare.com/EQ/Emu/Eff2Emt/

Current Screenshot (GUI version):

http://www.shendare.com/EQ/Emu/Eff2Emt/screenshot.png

Screenshot Mirror (in case my site goes down for some reason):

http://i.imgur.com/6Dbpmhj.png

Shendare 06-09-2015 02:32 PM

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


Shendare 06-09-2015 02:34 PM

Oh, and the fields in the .emt files. I just paste this line as-is at the top of a .emt file for reference. The game doesn't find a "SoundFile (wav=sound mp3/xmi=music)" in the game files as a sound file to play, so it ignores the line.

;?,SoundFile (wav=sound mp3/xmi=music),Unknown (0=OK 1=OK),WhenActive (0=Always 1=Daytime 2=Nighttime),Volume (1.0 = 100%),FadeInMS,FadeOutMS,WavLoopType (0=Constant 1=Delayed Repeat),X,Y,Z,WavFullVolRadius,WavMaxAudibleDist,N onZero = RandomizeLocation,ActivationRange,MinRepeatDelay,M axRepeatDelay,xmiIndex,EchoLevel (50 = Max),IsEnvSound (for option toggle)

Shendare 06-10-2015 05:49 AM

And c++ command-line version is now available as well.

Scorpious2k 06-10-2015 07:29 AM

Very nice work, Shendare!

Shendare 06-10-2015 12:07 PM

Thanks. It was a fun little puzzle challenge. I haven't been able to work on some stuff I've been wanting to lately, so it was nice being able to play with something at least.

Drajor 06-10-2015 03:35 PM

Well done :)

Shendare 06-10-2015 03:37 PM

Thanks! Next step would be a quick user-friendly UI for adding and editing the sounds and music. Somewhere down the line.

rockyraccoon599 12-30-2020 05:20 PM

Thank you so much for your amazing tools! I'm using this converter for a project to implement Maestrobob's awe32 mp3 transfers in the trilogy era zones instead of the default windows midi or other soundfont workarounds.

Rivervale was where I started. As far as I know, there's only one song and it plays throughout the whole zone. Looking into the rivervale.emt, I didn't see any reference to rivervale.xmi. Next, I compared your documentation to the raw rivervale_sounds.eff and found a reference to background music at index 0 of the xmi. So, I studied Eff2EmtConverter.cs and found why this song was left out after the conversion. On line 481 and 489 the sound file name is generated based on the index type. A PoP mp3 song if <0, empty if 0, xmi if >0.
Code:

_soundFile1 = (_effEntry.SoundID1 < 0) ? SoundFileNumber(_effEntry.SoundID1) : (_effEntry.SoundID1 == 0) ? "" : ZoneNick + ".xmi";
For my purpose, I included 0 in the xmi range and converted again. The missing reference appeared! I don't know if this is just a bug or a conflicting edge case, but I'm happy to continue with my music project for now.

Telin 08-30-2022 04:37 PM

I just wanted to note a strange bug when converting old zone sounds to .emt. The old environmental sound effects, like wind_lp_4, after conversion sound much louder depending on which direction you’re facing in game. At first I thought it was loudest if I was facing the source location, but it ended up that they are consistently loudest when facing north and south and are quieter when facing east west. This makes it difficult to customize or try and repair old zones sounds because it doesn’t sound good with this bug. To narrow down the issue, I tested a newer zone and added a line for the old environmental sound, and it happened there as well.

steve 03-13-2023 04:49 PM

Quote:

Originally Posted by Telin (Post 268342)
I just wanted to note a strange bug when converting old zone sounds to .emt. The old environmental sound effects, like wind_lp_4, after conversion sound much louder depending on which direction you’re facing in game. At first I thought it was loudest if I was facing the source location, but it ended up that they are consistently loudest when facing north and south and are quieter when facing east west. This makes it difficult to customize or try and repair old zones sounds because it doesn’t sound good with this bug. To narrow down the issue, I tested a newer zone and added a line for the old environmental sound, and it happened there as well.

One of the unknown fields might be the heading that controls the volume of the sound being played.


All times are GMT -4. The time now is 05:36 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.