Looping a sound: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(cleaned)
Line 1: Line 1:
=Intro=
{{toc-right}}
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/loop points to the sound file. To do so, we must use a sound editing program that add cue points or loop points.
There are [[Music_Composition|many programs available]] for sound editing and some can create loops. Here are a few known programs:


*[http://www.goldwave.com/ GoldWave] - 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.
A looped sound will repeat endlessly without any gap between its end and start. It is up to the sound artist to ensure that the end and start of the file match up however, or there will be a "pop" as the waveform jumps from one shape to another.
*[http://www.sonycreativesoftware.com/products/soundforgefamily.asp Sony Sound Forge] - This program is a lot more expensive than GoldWave and is able to read loop/cue points.<br>{{todo|Does this program do '''everything''' necessary for looping, like editing and detecting loops in official wav files?}}
 
*[http://www.wavosaur.com/ Wavosaur] - This program is completely free (donations are accepted by the author). It appears to be able to detect loops in all wav files. Cue points in GoldWave are read as Markers in Wavosaur. There is no need for installation. Just open the application and editing can start immediately.
'''Source detects looped sounds ONLY through cue points embedded in the file.''' This is a WAV-only feature, so MP3s cannot be looped. MS-ADPCM compressed WAVs can be looped, but due to the compression there will be a pop when the sound restarts. ([http://www.compuphase.com/mp3/mp3loops.htm Compressed formats, including MP3, can theoretically be looped.])
{{note|{{l4d2}} During development: editing the contents of an existing sound file stored in your campaign's ''sound.cache'' will not show any change until the sound cache is rebuilt! See [[L4D2 Campaign Add-on Tutorial#Creating a sound.cache files|Creating a sound.cache files]] or [[L4D2 Custom Sound and Music Tutorial]] for further instructions.}}
 
{{note|There is no need to mark a sound as looping when playing it, but if using [[ambient_generic]] you will find that the "Is NOT Looped" flag must be set correctly if you want to stop the sound after it starts!}}
 
{{warning|{{l4d2}} During development: editing the contents of an existing sound file stored in your campaign's ''sound.cache'' will not show any change until the sound cache is rebuilt! See [[L4D2 Campaign Add-on Tutorial#Creating a sound.cache files|Creating a sound.cache files]] or [[L4D2 Custom Sound and Music Tutorial]] for further instructions.}}
 
== Programs ==
 
These free programs can add cue points to a WAV:
 
* [http://www.goldwave.com/ GoldWave]
* [http://www.wavosaur.com/ Wavosaur] (Use markers, '''not''' loop points)
 
=== GoldWave ===


==Adding the Loop with GoldWave==
Open Goldwave and open the sound you want to loop. Click the '''cues''' icon. ([[Image:Cues button.jpg]])
Open Goldwave and open the sound you want to loop. Click the '''cues''' icon. ([[Image: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:
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:
:[[Image:Cue dialog.jpg]]


==Conclusion==
[[Image:Cue dialog.jpg]]
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.
 
== Cue location ==
 
Your cues do not have to be at the start and end of the file. If you place them in the middle Source will start playing the sound normally, then when it reaches the end cue will loop back to the start cue. From then on only what's between the cues will play.
 
This can be used to give a sound a "winding up" effect that only plays once (e.g. a motor starting).


==See Also==
==See Also==
*[[ambient_generic]]
 
*{{l4d}} [[L4D_Soundscripts|L4D Soundscripts]]
* [[ambient_generic]]
*{{l4d2}} [[L4D_2_Custom_Sound_and_Music_Tutorial|L4D2 Custom Sound and Music Tutorial]]
* [[Sound and Music]]
*[[Music_Composition|Music Composition]]
*[[Sound_and_Music|Sound and Music]]
*[[Soundcache]]
*[[Sound_Download_Sites|Sound Download Sites]]
*[[Soundscape|Soundscapes]]
*[[Soundscripts]]
*[[Sound_System|Category:Sound System]]


==External Links==
==External Links==
*[http://www.goldwave.com/ Goldwave] - Official Website
 
*[http://www.sonycreativesoftware.com/products/soundforgefamily.asp Sony Sound Forge] - Product Page
* [http://www.interlopers.net/tutorials/27356 Looping Menu Music] - An Interlopers.net Tutorial on Soundlooping
*[http://www.wavosaur.com/ Wavosaur] - Official Website
*[http://www.interlopers.net/tutorials/27356 Looping Menu Music] - An Interlopers.net Tutorial on Soundlooping


[[Category:Sound System]]
[[Category:Sound System]]
[[Category:Third Party Tools]]
[[Category:Third Party Tools]]

Revision as of 04:27, 8 April 2011

A looped sound will repeat endlessly without any gap between its end and start. It is up to the sound artist to ensure that the end and start of the file match up however, or there will be a "pop" as the waveform jumps from one shape to another.

Source detects looped sounds ONLY through cue points embedded in the file. This is a WAV-only feature, so MP3s cannot be looped. MS-ADPCM compressed WAVs can be looped, but due to the compression there will be a pop when the sound restarts. (Compressed formats, including MP3, can theoretically be looped.)

Note.pngNote:There is no need to mark a sound as looping when playing it, but if using ambient_generic you will find that the "Is NOT Looped" flag must be set correctly if you want to stop the sound after it starts!
Warning.pngWarning:Left 4 Dead 2 During development: editing the contents of an existing sound file stored in your campaign's sound.cache will not show any change until the sound cache is rebuilt! See Creating a sound.cache files or L4D2 Custom Sound and Music Tutorial for further instructions.

Programs

These free programs can add cue points to a WAV:

GoldWave

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

Cue location

Your cues do not have to be at the start and end of the file. If you place them in the middle Source will start playing the sound normally, then when it reaches the end cue will loop back to the start cue. From then on only what's between the cues will play.

This can be used to give a sound a "winding up" effect that only plays once (e.g. a motor starting).

See Also

External Links