Gordon and Alyx

  The Half Life 2 Audio Loading Fix Page  a.k.a "The MaLDo Fix"      

HomeFAQDownloadsHalf Life 2 Forum Audio Loading ThreadContact
 
HL2 Logo

 

Audio Loading Fix > Frequently Asked Questions
 
HL2 Logo Using the fix
 
Using the fix

The fix is totally safe. It makes no changes to your PC outside of the game files and it works by simply playing all the sounds a chapter uses prior to starting a chapter, in much the same way they are played in the game. This causes the sounds to be cached in your PCs RAM, and as a result they may be accessed much faster when required

In the case of the main game's files, it does not overwrite any game files and, unless you add the entries from the autoexec.cfg provided it makes no changes to the normal operation of Half Life 2. It only does anything when you run one of the files manually from the console and the changes only last for the duration of that game. If you no longer wish to use the fix then simply do not load a sound file next time you play. You do not need to even delete the files from your cfg folder, although of course you are free to do so if you wish.

In the case of the Lost Coast files there is one file, "Chapter1.cfg", which causes the sounds to be loaded when you start a new game. To stop using the fix you will need to delete this from your Lost Coast cfg folder.

One word of caution, if you set the game's heapsize too high for your available RAM there will no longer be enough free RAM for essential Windows processes. This will cause your PC to run very slowly and in extreme circumstances, impossible if you follow the instructions carefully, it could even crash your PC. In this unlikely situation your PC will be fine after a reboot. However, before running Half Life 2 again you will need to either stop unnecessary applications or processes to make more room for Half Life 2, reduce your heapsize or increase your RAM. However, you should not reduce your heapsize below the level recommended for the files you are using, if you do the fix will not work and it is likely Half Life 2 will run worse than without the fix.

Top

To change your heapsize:

  • Open the Steam 'games' window and click on 'properties' for Half Life 2 (or whichever game/mod you are planning on playing).
  • Click on 'Launch options'
  • Type "-heapsize nnnnnn" (without the quotes) where "nnnnnn" is the heapsize you require.

For Half Life 2 especially, you may also want to add "-console", e.g. "-heapsize 716800 -console", which will automatically load the console when the game starts. This will make it easy for you to load the necessary sound files before starting play (not necessary with Lost Coast, Minerva or CS:S) and also disables the 3D menu background. resulting in a faster load time.

Top

There is no way (without Valve help, which at the moment doesn't seem likely) to automatically load the cfg when you load a saved game or when you move from one chapter to another whilst playing the game. As I result I felt it was more confusing than helpful to have the game 'sometimes' load the cfg automatically.

cfg files are simple text files which you can create using Notepad. It is possible to create a cfg file called "Chaptern.cfg", which you store in the same folder as the others. This needs to first execute the right cfg from the package and then load the first map of the chapter e.g.

exec 001@Point_Insertion.cfg

map d1_trainstation_01

The game will then automatically load the right sounds when you start a "new game" on that chapter, but not when you load one of your own saved games and not when you move from one chapter to another in the game. Then you still need to execute the cfg file manually. Feel free to make your own files if you feel they will be helpful.

I have actually implemented this for "Lost Coast", which only has one chapter and where you are most likely to start a new game every time you play. So there is an example of a chapter cfg file in the lc_cfg folder.

If you intend on playing the same bit a lot you can also add an exec command to load the relevant cfg in your valve.rc file (in the same folder as the cfg's and also a simple text file). This will then load a set of sounds every time you start HL2. But you need to remember to change when you move to a different bit of the game. This is more useful if you have 2GB or more RAM, as you can load cfg's less often (see below).

Top

You can make your own that have the contents of several chapters in them e.g.

echo "Flushing sound cache..."
snd_flushasync
echo "Loading Point Insertion sounds..."
echo "Built by the Steam Community"
echo "Sounds revealed by MaLDo and Jong"
echo "Packaged by Jong"
echo "Original concept by MaLDo"
exec ch_001.cfg
exec ch_001.cfg
exec trainstation.cfg
exec trainstation.cfg
echo "Loading Red Letter Day sounds..."
exec ch_002.cfg
exec ch_002.cfg
exec train_lab.cfg
exec train_lab.cfg
echo "Sound preloading complete."

BUT!!! Things go badly wrong if you ever overflow the cache - either during the pre-loading phase or whilst playing - the system flushes the cache for you and you lose all your cached sounds. You need to be sure you have enough cache for all the sounds you are going to encounter. Probably the biggest chapter, Anticitizen One, uses 95% of the cache when the heap is set to 700MB. You will not be able to load multiple chapters in many cases if at all with a 700MB heap.

On the good side there are sometimes massive overlaps in sounds from one chapter to another and sounds only get loaded once so loading multiple chapters does not result in as much cache usage as you might think. For example, Anticitizen One and Follow Freeman use many of the same sounds, so adding those together results in only a modest increase in cache.

The best way to build a file which loads more sounds is to first increase your heapsize appropriately (MaLDo reports that you can actually use a 2GB heapsize with 2GB of RAM), then progressively add an extra chapters' sounds to your new cfg file, one at a time. After each addition load the new set of sounds and then type "snd_memasync" (without the quotes) into the console. This lists all sounds loaded and at the end says how much of your cache is in use. As long as the cache used increases when you add a new chapter is added you are fine. If suddenly the cache percentage in use drops this indicates you overflowed your cache and all the sounds loaded to that point were flushed out. You will then need to remove the sounds for the last chapter from your file and start a new file for this and subsequent chapters.

Top

Other questions

Stuttering is a symptom of a number of problems and not a single problem in itself. The Audio Loading Fix can only address stuttering caused by the loading of audio sounds. This is typically the last cause left when all other problems with a users PC have been eliminated.

This web site is not intended to duplicate the work done by many others to address the more general stuttering issue with Half Life 2. However, for completeness here are a few tips that may help. You may also wish to check the Steam Forum, which always has a number of stuttering threads on the go!

Common Causes of stuttering

  • As well as hard disc accesses for loading sounds, Half Life 2 frequently autosaves the player's position in the game. This can also cause hitching and occasional stuttering. The audio loading thread and others contain tips for stopping these autosaves. Other than the save at map changes (where there is a pause to load new data anyway), they do involve editing map files which are normally hidden in compressed .gcf files. This is not a trivial task and is probably not worth the effort for most users.
  • Running at too high resolution or detail for your video card. Try using the default recommended settings and work up to higher quality levels carefully.
  • Problems with your video or sound card, especially driver issues. Follow the instructions for your card to make sure you are using the latest drivers and have a perfect driver installation.
  • Disc fragmentation. Always defrag your hard disc after any Steam/Source/HL2 update and preferably regularly, e.g. weekly.
  • Anti-virus software. Because Half Life 2 extensively accesses the hard disc during play, it can, depending on your anti-virus software, be vital to disable it before playing. Anyway, this is normally sound practice for all games.
  • Old tweaks to autoexec.cfg or config.cfg that are now out of date. Try deleting those files, let the system re-generate the defaults and then carefully reapply any tweaks one or two at a time only if they still improve things and don't make things worse. You will need to re-apply any options you have changed in the game, e.g.. key bindings. You will also need to type "sv_unlockedchapters 13" into the console to unlock all the chapters of the game from the new game menu, or change the "sv_unlockedchapters" field in your new config.cfg to the same value, but it is worth it to be sure you have the right default settings for your system.
  • Other PC processes taking mill. Shut down all applications, system tray tools and processes which you do not need running.
  • Problems with your pci latency configuration. See the beginning of the audio loading thread for information on how to play with this.

It is worth noting that many old stuttering tips (from late 2004, before the earlier Valve fixes) are now more dangerous than helpful. Generally it is now better not to tweak your config.cfg file or add to your autoexec.cfg file. Deleting these files and allowing Steam to recreate them, as above, is often the best way of getting back to a known, working state.

Top

  1. Temporarily (whilst collecting sounds only) change the launch options for Half Life 2 to include "-condebug"
  2. Open the game at the main menu
  3. If you wish to use an existing list of sounds as a starting point then 'exec' that .cfg file first before loading the map/chapter/game you wish to play
  4. Immediately type 'snd_memasync' into the console and make a note of the last few sounds that appear (if any). Any newly captured sounds will appear after these in the list
  5. Load your game and start playing
  6. Every few minutes "quicksave", then bring up the console, and enter 'snd_memasync'. This provides a 'checkpoint' in case HL2 crashes.
  7. At the end of the map/chapter/game, close the game and open the file "console.log" in the game folder (C:\Program Files\Valve\Steam\SteamApps\<account name>\half-life 2\hl2).
  8. Scroll to the end of the file and copy and past the results of the very last "snd_memasync" command to your favourite text editor (if you have completed your run without any crashes you can ignore all the checkpoints).
  9. Delete everything from the beginning of the file up to the first new sound you discovered (the first sound to be listed after any sounds that appeared at step 4 above).
  10. Delete everything that appears at the end of the file, after the last sound.

    You should have  file which looks like this (sounds shown are examples only):

    14.40 Kb : npc\combine_soldier\vo\dagger.wav

    10.32 Kb : npc\combine_soldier\vo\seven.wav

    35.26 Kb : npc\combine_soldier\vo\hardenthatposition.wav

    14.54 Kb : npc\combine_soldier\vo\hunter.wav

    19.12 Kb : physics\metal\metal_grenade_impact_hard2.wav

    31.38 Kb : npc\combine_soldier\vo\contactconfim.wav

    15.68 Kb : npc\combine_soldier\vo\fifteen.wav

    6.71 Kb : npc\combine_soldier\vo\fist.wav

    38.00 Kb : npc\combine_soldier\vo\targetcontactat.wav

    30.00 Kb : weapons\debris3.wav

    9.41 Kb : npc\combine_soldier\vo\dash.wav

    17.02 Kb : npc\combine_soldier\vo\range.wav

    100.54 Kb : ambient\levels\streetwar\city_battle5.wav

    198.83 Kb : physics\metal\metal_box_scrape_smooth_loop1.wav

    17.75 Kb : physics\surfaces\tile_impact_bullet3.wav

    17.24 Kb : physics\surfaces\tile_impact_bullet1.wav

    ......................etc

    ......................etc

  11. Now use your text editor/word processor to remove everything for the beginning of each line up to and including the ":" and replace with "Play "
  12. Add "Stopsound" to the very end of the file, after the last Play command.

    You should now have a file which looks like this:

    Play  npc\combine_soldier\vo\dagger.wav

    Play  npc\combine_soldier\vo\seven.wav

    Play  npc\combine_soldier\vo\hardenthatposition.wav

    Play  npc\combine_soldier\vo\hunter.wav

    Play  physics\metal\metal_grenade_impact_hard2.wav

    Play  npc\combine_soldier\vo\contactconfim.wav

    Play  npc\combine_soldier\vo\fifteen.wav

    Play  npc\combine_soldier\vo\fist.wav

    Play  npc\combine_soldier\vo\targetcontactat.wav

    Play  weapons\debris3.wav

    Play  npc\combine_soldier\vo\dash.wav

    Play  npc\combine_soldier\vo\range.wav

    Play  ambient\levels\streetwar\city_battle5.wav

    Play  physics\metal\metal_box_scrape_smooth_loop1.wav

    Play  physics\surfaces\tile_impact_bullet3.wav

    Play  physics\surfaces\tile_impact_bullet1.wav

    ....................etc

    Stopsound

  13. Save the file as "xxxxx.cfg", where "xxxxx" is anything you like.
  14. Now use your text editor to make another .cfg file with a name of your choosing (starting it with a "0" can make it easy to find as there are no other cfg's with this as their first letter). In this example I have called it  "001.cfg"
  15. Put "snd_flushasync" as the first line
  16. If you used an existing sound file as a start point then enter lines to 'exec' that file twice first
  17. Then enter lines to 'exec' your file with the newly captured sounds (xxxxx.cfg) twice
  18. So you end up with a file that looks something like
  19. snd_flushasync

    exec yyyyy.cfg

    exec yyyyy.cfg

    exec xxxxx.cfg

    exec xxxxx.cfg

  20. Now you can simply reload the game, execute "001.cfg" (or whatever you called it) and play.

If the game crashes at any point you can use steps 7-19 to make a sound file for all the sounds up to the point of your last save. You should then go through the steps again, "exec 001.cfg" at step 3, reload the last quicksave at step 5 and start capturing the sounds up to the end of the map/chapter/game. Remember to only add new sounds that appear after the last sound displayed at step 4 of your new run. You can add the newly collected sounds to your original sound file (in this example, xxxxx.cfg), before the final "Stopsound".

 

Normally I would recommend going through this whole process at least two times, the second time loading 001.cfg, at step 2 above, before collecting sounds. The second pass almost always finds more sounds and, at the very least, will reassure you you have most captured. If you have captured the sounds correctly you should not find more than about 5-10 new sounds per map. You can add the newly collected sounds to your original sound file (in this example, xxxxx.cfg), before the final "Stopsound".

 

NB: You MUST exit the game and reload it before trying to create a different sound file e.g. for a different chapter or map. once a sound has been loaded once it is allocated a space in the sound cache 'index'. Even if you flush (empty) the sound cache the sound still retains a place in the list, marked 'not resident'. If a subsequent chapter/map plays the same sound the old space is re-utilised, the sound does not appear at the end of the list and is likely to be missed when capturing the sounds.

Top

This is a Steam Community web site and is in not affiliated in any way with Valve Corporation. Use of Half Life 2 imagery and Steam styling is not intended to suggest any endorsement of the contents herein by Valve Corporation. The enclosed information and downloadable content is used at the visitor's own risk.

Valve, the Valve logo, Half-Life, the Half-Life logo, the Lambda logo, Steam, the Steam logo, Team Fortress, the Team Fortress logo, Opposing Force, Day of Defeat, the Day of Defeat logo, Counter-Strike, the Counter-Strike logo, Source, the Source logo and Counter-Strike: Condition Zero are trademarks and/or registered trademarks of Valve Corporation.