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.

ZDoom loop points
ZDoom allows to use special s in and  files, with the field names  and. 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. 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+ 2.5.1.1 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 field name.

These loop points are 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.

SRB2 loop points
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 field and use a string of the form, where the value is the sample number of the loop point. (So in the Vorbis stream, the result will be something like, for example, .) Alternatively, dedicated custom comments can be used, either directly with the sample number as value, or  with the millisecond count as value.