Call of Duty 5: Custom Sound 2

From COD Modding & Mapping Wiki
Jump to navigation Jump to search

This tutorial explains how to encode soundfiles for World at War.

This CoD title does not support MP3, but different types of WAVE: uncompressed PCM, xWMA, ADPCM and WAVEbext.
They all need a proprietary data block, called PRIV chunk. You can create it with the modtools' MODSound.exe as described below.


Setup sound encode environment (once)

Sound encoding won't work if there are any spaces in the folder paths, special characters might also cause problems. As the default installation path of the game contains spaces and renaming the directories would potentially break the game, I suggest to set up a new folder structure for sound conversion.

  1. Create a folder on any drive, in any subfolders you want, but with no spaces in path!
    For instance D:\Games\ModSound\ (will be refered to as modsound dir)
    Bad: D:\Games\sound path\
  2. Create these 8 subfolders:
    • ModSound\bin\
    • ModSound\raw\
    • ModSound\raw\soundaliases\
    • ModSound\sound_assets\
    • ModSound\sound_assets\raw\
    • ModSound\sound_assets\raw\sound\
    • ModSound\sound_assets\raw\sound\SFX\
    • ModSound\sound_assets\raw\sound\stream\
  3. Copy MODSound.exe from CoD modtools to your ModSound\bin\ folder (and keep explorer opened for later)
  4. Get Microsoft's DirectX SDK: Download SDK June 2010 (currently latest)
  5. Open the downloaded file (DXSDK_Jun10.exe) with 7-Zip, e.g. right-click in explorer on the file, 7-Zip > Open
  6. Navigate to DXSDK\Utilities\bin\x86\
  7. Select AdpcmEncode.exe and xWMAEncode.exe, drag and drop them into your modsound's bin dir: ModSound\bin\AdpcmEncode.exe...
  8. Rename xWMAEncode.exe to WMAEncode.exe (leading "x" stripped off)
  9. Get the zip-package of the latest SoX tool (Sound-Exchange): Download SoX v14.4.0
  10. Open it with 7-Zip or the like and extract the following files to your modsound folder's bin\ directory:
    • libgomp-1.dll
    • pthreadgc2.dll
    • sox.exe
    • zlib1.dll
  11. Done, your sound encoding environment is ready to go!


Convert sounds and soundaliases

  1. Copy your custom soundalias file(s) from CoD5\raw\soundaliases\ to ModSound\raw\soundaliases\
    Soundalias CSV creation is not covered here, check other tutorials and stock CSVs (you may use Open Office to view them).
    Note: Don't forget the column header line, which goes like name,platform,file,sequence,vol_min... or it won't work at all!
  2. Convert the sound files you wanna use to WAVE (Microsoft PCM 16-bit) using Audacity if they aren't already wav (e.g. mp3 to wav).
    You may also re-export wav files with fancy sample rates (other than 11025, 22050, 44100, 48000, 96000) or if you experience problems with sound conversion later on.
  3. Put them into subfolders of ModSound\sound_assets\raw\sound\, streamed audio goes into stream\... and sound fx into SFX\...
    Create missing subfolders, like stream\music\ for streamed music tracks or e.g. SFX\weapon\MG\ if it's going to become a MG sound.
  4. Sounds shouldn't be directly placed into ModSound\sound_assets\raw\sound\, they may not work!
  5. Go to ModSound\ in explorer, select bin folder, hold Shift and right-click on it. Context menu opens, click Open Command Window here (also see here)
    Alternatively, hit Windows key, type cmd and hit enter to open a command prompt. If it says C:\... but your ModSound folder is on D:\..., type D: (drive letter and colon) and hit return. Change to ModSound\bin\ folder with cd the\path\ModSound\bin (e.g. Games\ModSound\bin) and hit enter
  6. Type modsound -pc -verbose -aliasfiles your_aliasfile_name
    If the soundalias CSV is ModSound\raw\soundaliases\mp_yourmap.csv, your_alias_name would be mp_yourmap
    (Note: modsound is not the ModSound directory, but the executable modsound.exe)
  7. If you wanna force it to encode all sounds even if they been already converted, add -clean, e.g. modsound -pc -clean -verbose ...
  8. As soon as you hit return, encoding will start and some info will be displayed. Hang on, especially ADPCM encoding can last quite a bit!
  9. When it's finished, copy the encoded sound files from ModSound\raw\sound\ to CoD5\raw\sound\
  10. Add the soundalias CSV to your zone file: sound,mp_yourmap,,all_mp (for SP: all_sp at the end)
  11. Add sound fx (from SFX\ folder) as well.
    Example for raw\sound\SFX\weapon\MG\shot.wav
    • sound,SFX/weapon/MG/shot
  12. Build fastfile with your zone file (either using Launcher or a batch script).
  13. Pack streamed audio as IWD (not covered here).
    Example for raw\sound\stream\music\mytrack.wav
    • mp_yourmap.iwd\sound\stream\music\mytrack.wav
  14. The soundaliases defined in your soundalias CSV should now be available. Note: You may have to place fastfiles / IWDs into %localappdata%\Activision\CoDWaW\usermaps\mp_yourmap\!


Trouble shooting

  • ERROR: .../sound_assets/MODSound.hst : file not found

    You can ignore this error message, MODSound.hst will be automatically created.

  • If there are spaces or special characters in the folder paths to your ModSound directory, the following errors will occur:

    Converting D:\CoD5\path to space\sound_assets\raw\sound\SFX\test_raw.wav failed with
    error ERROR_FILE_NOT_FOUND (The system cannot find the file specified)

    ERROR: Couldn't open input file.

    Read the above guide how to setup the sound encode environment!

  • MODSound.exe choses xWMA or ADPCM compression automatically. It will encode sounds from raw\sound\stream\ with ADPCM, as xWMA streaming isn't supported by the engine. So don't try to use an xWMA encoded wav as streamed music track, it will not work!


--CoDEmanX 22:03, 25 April 2012 (IST)