Audio loop


Advanced source ports supporting streamed audio formats may allow custom loop points to be defined. There are standard specifications for setting loop points in some audio formats, so this article only covers cases where there is no standard method and a custom solution had to be devised.

These loop points are usually a subset of loop point metadata that can be found elsewhere. The VGMStream library also supports them, as well as other engines for other games, such as EDuke32.

ZDoom loop points[edit]

ZDoom allows to use special Vorbis comments in Ogg Vorbis and FLAC files, with the field names LOOP_BEGIN and LOOP_END. The value can be a number that will be interpreted as the sample count at which the loop respectively begins or end, or as a formatted string of the form HH:MM:SS.sss. This is then parsed at the time at which the loop point is placed, and converted into a sample number according to the file's sample rate.

Support for these loop points was independently implemented in PrBoom+ and Chocolate Doom 2.1.0. In Chocolate Doom, it is naturally only supported for external digital music packs.

In addition, ZDoom also supports, for sound effects only, a bidirectional loop where the sound loops by being played backward from the end point back to the start point. This behavior is set by adding a Vorbis comment with the LOOP_BIDI field name.

SRB2 loop points[edit]

SRB2 independently implemented its own Vorbis comment metadata systems. Contrarily to ZDoom, it only allows to set the loop start point. There are three different ways to define it; the oldest consists in using the standard COMMENT field and use a string of the form LOOPOINT=value, where the value is the sample number of the loop point. (So in the Vorbis stream, the result will be something like, for example, COMMENT=LOOPPOINT=397473.) Alternatively, dedicated custom comments can be used, either LOOPPOINT directly with the sample number as value, or LOOPMS with the millisecond count as value.