UPDATED September 27, 2018 for Non-3DSound fixes, example map update, audio update. Thanks to bonesy23438 for verifying the fix.
Four simple scripts to play looping sounds at various health levels. Two are non-3D, two are 3D. Three sounds (each in mono and stereo) and an example map are included. Well-commented for ease of use and editing.
Two play a single sound, looping by default. (low_health_warning.lua and low_health_warning_non3d.lua) With these scripts you simply change the health number at which you want the sound to begin.
The others plays three different sounds by default, each within a different health range. (low_health_warning_layered.lua and low_health_warning_layered_non3d.lua) With these you can set, add, or remove multiple health and sound intervals.
These can be fairly easily edited for other uses or to add more sounds, change the health intervals, etc. They do not replace the default heartbeat sound! That sound can be replaced, removed, or left alone. It's up to the user to find and use their preferred method but I do recommend that you disable it somehow.
Attach the script to a dynamic entity, set to always active, and browse to your sounds in the entity's sound slots, starting with slot 0.
The included test map has a 3D sound version by default. Change that to the non 3D script if you want to test it that way. To test the sounds on the map, simply walk up to the red barrel and allow it to start reducing your health through the various layers for different sounds.
These are very useful as they are, but an experienced scripter could probably improve these quite a bit. The tools and skills to edit your desired sounds to affect looping points and add stretches of silence will allow you even more options.
PLEASE NOTE:The 3D Sound versions' sounds will fade in and out according to your distance from the entity they are attached to.