Sound loop tests

Half-Life HL
Sound loop tests by DiscoStu
Posted 7 years ago2011-12-30 03:22:40 UTC • Examples • Half-Life
Screenshot Thumbnail
Sound loop tests
DiscoStu DiscoStu
7 years ago2011-12-30 03:22:40 UTC
7 years ago2011-12-30 03:22:40 UTC
5.00 (3)
full star full star full star full star full star Download

Objective: To find out the difference between using cues and not using them in a sound file in the Half Life engine.

Procedure: The theory is that, for audio files to be looped, there has to be one cue at the start of the file and one at the end. The test uses six separate sound files, all containing the same 4-second audio data but different cues.

They are set as follows:
One file with no cues at all.
One file with 1 cue, set at 0:00
One file with 1 cue, set at a random point different than 0:00 (set at 0.5s)
One file with 2 cues, the first at 0:00 and the last at the very end (4 sec)
One file with 2 cues, in two random locations different than the very ends (set at 1.5s and 3s respectively)
One file with 3 cues, in three random locations different than the start and end (set at 1.5s, 3s and 3.5s respectively)
The test is arranged in four groups of tests. All ambient_generics have the "play everywhere" and "start silent" flags.

The first group of 6 ambient_generics are individually triggered and are toggled.

The second group of 6 ambient_generics are also individually triggered, but are also set to "not toggled".

The third group of 6 ambient_generics are toggled and triggered all at once by a single button, to demonstrate how they all end up out of sync due to differently placed cues.

The fourth group of 6 ambient_generics are not toggled and also triggered all at once by a single button.

Test Results:

Sound files with no cues will not loop at all, even if set to toggled ("toggle/not-toggle" flag has no effect).

Sound files with cues will play the first time from 0:00 to the very end, and then loop between the first two cues. If only one cue is present, it will loop from said cue to the end of the file.

If two cues are present and they are at each end of the file, the sound will loop from start to end; but if said cues are placed at random points in the file, the complete audio will only be heard once, at least until the sound is turned off and then back on.

Files with three or more cues will only use the first two cues and ignore the rest.

Sound files with cues will always loop, regardless of the "toggled" flag; but there is a difference. If set to toggle, the sound can be toggled on/off any time. If the flag is set to not toggled, there will be no way to turn the sound off. It will only ever be silent if "start silent" is used, and only until it is triggered. Further triggering will only cause the sound to jump back to 0:00 and continue playing (looping between its cue points, if set)

As always, I hope this will serve as a working example of generally unexplored engine features (being mostly edge cases), and that others will find this an useful and interesting learning experience (and maybe even find inspiration to push the engine even further)

Love to all,



Commented 7 years ago2011-12-30 03:49:58 UTC Comment #18831
While unfortunately I cannot download and test, from the description it sounds interesting. It could definitely be of use some day.
Commented 7 years ago2011-12-30 05:52:41 UTC Comment #18564
Best way to get sound cues in files? (coughfreecough)

interesting, i'll have to DL tomorrow
Commented 7 years ago2011-12-30 06:06:53 UTC Comment #18565
very precisely and carefully done! After all these years, i finally understand what "not toggled" flag is for and now i truly understand exactly what the cue points do and why.

Superb work sir! this should be written up as a tutorial too!

[b]EDIT: LOL it creates quite a cacoughpanously awesoome sound when you willy-nilly start pressing all the buttons! All kinds of ideas are popping up in my haed for some multiplayer maps using all these togglable sounds, but i'm sure it would wreak some seriousl havoc on a server. :P
Commented 7 years ago2011-12-30 11:12:01 UTC Comment #18563
It is possible to loop sounds with no cues, simply make a trigger_auto, and two trigger_relays, and the ambient_generic.

Then get the trigger_auto to turn the looping sequence on (or you can turn it on in any other way).

name the trigger_relay 1; relay1, name the trigger_relay 2; sound, name the ambient_generis; sound. Then make relay1 trigger sound, and make relay2 trigger relay1, with delay values being the wait between each time the sound is played. This way it will never turn off, the loop.

You can take it a step further at that, by adding a random trigger to make it trigger randomly lets say every 11, 3 or 7 seconds (the sound). This method is great for ambience in CS 1.6.
Commented 7 years ago2011-12-30 13:27:50 UTC Comment #19698
Wow, good job DiscoStu!

As Captain T said, you should save this in the tutorials section too. It will be easier to find it when it's needed.
Commented 7 years ago2011-12-30 18:37:43 UTC Comment #19699
Yay, glad you guys like it :D

@Tetsu0: Try GoldWave, it's free if it still exists. It's also ancient. Maybe Audacity can do that too.

@Cap'n & doggybag: I might do a tutorial, but there already are two tutorials on custom sounds and I fear this alone is not worthy of a tutorial. I'll try to write something up, though. Meanwhile, I posted a link to this at the custom sounds tutorial.

@Skals: Sure you can do that. I just meant sounds with no cues won't loop automatically. Also I suspect that method won't loop as perfectly.
Commented 6 years ago2012-05-24 10:52:34 UTC Comment #19488
Commented 5 years ago2013-09-27 06:41:32 UTC Comment #19892
This was helpful. Thank you.

You must log in to post a comment. You can login or register a new account.