Looping a sound: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(→‎Conclusion: Clarification and important note added that without, could leave some very frustrated and lost for hours (Eg. Me))
Line 11: Line 11:


==Conclusion==
==Conclusion==
Save your file and it's loop-ready. Now when you use a [[ambient_generic]] and un-check the '''Is NOT Looped ''' flag with your sound it will loop in game correctly. On a side note, you can also decide to set the starting cue point right in the middle of the wave sound. Basically, the engine will play the sound quite normally from the start, and when it will reach the end, instead of jumping back to the begining of the sound, it should go back to the first cue point. For example, it could be used for a motor sound, where the engine starts and then idle for a moment. The idling part could be looped without the startup part.
Save your file as a Wave (*.wav) with the Attributes: PCM signed 16-bit, stereo or mono. Now when you use a [[ambient_generic]] and un-check the '''Is NOT Looped ''' flag with your sound it will loop in-game correctly.
 
You can also decide to set the first cue point right in the middle of the wave sound. Basically, the engine will play the sound from the start, and when it reaches the end, instead of jumping back to the beginning of the sound, it will go back to the first cue point. For example, it could be used for a motor sound, where the engine starts and then idles for a moment. The idling part could be looped without having to make two sound files.
 
'''NOTE:''' ''If your sound does not play in-game try typing 'snd_rebuildaudiocache' in console, wait for it to do it's business, then restart the game and map.''


==See Also==
==See Also==

Revision as of 02:46, 2 October 2009

Intro

In this short tutorial you will learn how to loop a .wave sound file. (.mp3 can't be looped via cue points) Looping sounds in Source requires a simple short process to be made. Sounds cannot be simply looped by un-checking the Is NOT Looped flag of a ambient_generic. Instead you must add cue points to the sound file. To do we must use a program called Goldwave. Download it here. There is a free trial version available, after it ends you will need to buy Goldwave. Once it is installed you are ready to begin.

Adding the loop

Open Goldwave and open the sound you want to loop. Click the cues icon. (Cues button.jpg) Then in the new window click on the New button and add a cue point At Start. Then click New for another cue point and add a point At End. So it looks similar to this:

Cue dialog.jpg

Conclusion

Save your file as a Wave (*.wav) with the Attributes: PCM signed 16-bit, stereo or mono. Now when you use a ambient_generic and un-check the Is NOT Looped flag with your sound it will loop in-game correctly.

You can also decide to set the first cue point right in the middle of the wave sound. Basically, the engine will play the sound from the start, and when it reaches the end, instead of jumping back to the beginning of the sound, it will go back to the first cue point. For example, it could be used for a motor sound, where the engine starts and then idles for a moment. The idling part could be looped without having to make two sound files.

NOTE: If your sound does not play in-game try typing 'snd_rebuildaudiocache' in console, wait for it to do it's business, then restart the game and map.

See Also