<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.hydrogenaudio.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Case</id>
	<title>Hydrogenaudio Knowledgebase - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.hydrogenaudio.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Case"/>
	<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Special:Contributions/Case"/>
	<updated>2026-04-30T19:53:52Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38811</id>
		<title>ReplayGain</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38811"/>
		<updated>2026-01-23T13:31:32Z</updated>

		<summary type="html">&lt;p&gt;Case: /* foobar2000 ReplayGain scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;ReplayGain&#039;&#039;&#039; is the name of a technique invented to achieve the same perceived playback loudness of audio files. It defines an algorithm to measure the &#039;&#039;&#039;perceived&#039;&#039;&#039; loudness of audio data.&lt;br /&gt;
&lt;br /&gt;
ReplayGain allows the loudness of each song within a collection of songs to be consistent. This is called &#039;Track Gain&#039; (or &#039;Radio Gain&#039; in earlier parlance). It also allows the loudness of a specific sub-collection (an &amp;quot;album&amp;quot;) to be consistent with the rest of the collection, while allowing the dynamics from song to song on the album to remain intact. This is called &#039;Album Gain&#039; (or &#039;Audiophile Gain&#039; in earlier parlance). This is especially important when listening to classical music albums, because quiet tracks need to remain a certain degree quieter than the louder ones.&lt;br /&gt;
&lt;br /&gt;
ReplayGain is different from [[Normalization|peak normalization]]. Peak normalization merely ensures that the peak amplitude reaches a certain level. This does not ensure equal loudness. The ReplayGain technique measures the &#039;&#039;effective power&#039;&#039; of the waveform (i.e. the RMS power after applying an &amp;quot;equal loudness contour&amp;quot;), and then adjusts the amplitude of the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified than peak-normalized waveforms.&lt;br /&gt;
&lt;br /&gt;
==Target loudness==&lt;br /&gt;
The target loudness of ReplayGain is [https://wiki.hydrogenaudio.org/index.php?title=Original_ReplayGain_specification#Reference_level &#039;&#039;&#039;89&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;dB SPL&#039;&#039;&#039;] / &#039;&#039;&#039;-18&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;[https://en.wikipedia.org/wiki/LUFS LUFS]&#039;&#039;&#039; (&#039;&#039;Loudness Units relative to Full Scale&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Some utilities have realized the inadequacies of the classic ReplayGain loudness calculation, switching to a more modern algorithm ([https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en ITU-R BS.1770]). However, the way it was integrated was extremely &#039;&#039;ad hoc&#039;&#039;, at least until a draft of a [[ReplayGain 2.0 specification|revised specification]] started being written.&lt;br /&gt;
&lt;br /&gt;
==Clipping==&lt;br /&gt;
Audio is generally recorded such that the loudest sounds don&#039;t clip, but the use of ReplayGain can cause clipping if the average volume of a song is below the target level. That is, upon playback, the volume of a quiet song is increased, so the parts of the song with above-average loudness, especially in the bass frequencies, will exceed the limits of the format and will be distorted. Whether this distortion is audible depends on the sounds in question, and the listener&#039;s sensitivity.&lt;br /&gt;
&lt;br /&gt;
Implementations deal with the risk of clipping in different ways. Some have a &amp;quot;pre-amp&amp;quot; feature which reduces (or boosts) the original audio&#039;s level by a certain amount before doing whatever is needed for ReplayGain. Some have a &amp;quot;prevent clipping&amp;quot; feature to reduce the amount of ReplayGain adjustment to whatever amount would keep clipping from occurring, based on peak info stored in the file&#039;s metadata (thus reducing the effectiveness of ReplayGain). Some recommend using a compressor/limiter DSP to prevent or reduce clipping, regardless of whether it was caused by ReplayGain.&lt;br /&gt;
&lt;br /&gt;
An alternative that may reduce the risk of clipping is the [https://tech.ebu.ch/docs/r/r128.pdf EBU R 128] recommendation of a -23&amp;amp;nbsp;LUFS target, but that&#039;s a different standard, and some may find the additional reduction in volume excessive, particularly if it leads to maxing out volume on user hardware. [[Opus]] in particular has adopted that standard, using a global gain as well as &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; tags. With ReplayGain, a simple (though somewhat radical) solution is to lower the preamp value by 5&amp;amp;nbsp;dB (or whatever one feels comfortable with) in the playback software. The RG target will always be -18&amp;amp;nbsp;LUFS, regardless of a user&#039;s volume or preamp settings.&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
There are different ReplayGain implementations, each with its own uses and strength. Most use [[metadata]] to indicate the level of the volume change that the player should make. Some modify the audio data itself, and optionally use metadata as well. There are advantages and disadvantages to both methods.&lt;br /&gt;
&lt;br /&gt;
In the metadata method, information on both types of ReplayGain (Track Gain and Album Gain) can be stored. The volume-change information can be very precise. If audio data was also changed, the metadata can contain &amp;quot;undo&amp;quot; info. Not all audio players/decoders know how to read and use ReplayGain information stored in metadata. And there&#039;s no standard for where and how ReplayGain info is stored; each implementation uses different formats and puts the info in different locations.&lt;br /&gt;
&lt;br /&gt;
In the audio data method, the file&#039;s actual audio data is modified so that its natural/default playback volume is at the target level. In this scenario, only one type of ReplayGain (Track Gain or Album Gain) can be applied. If no &amp;quot;undo&amp;quot; info is saved somewhere, it may not be possible to restore the original audio data. Limitations of the audio file format may prevent precise (finely tuned) gain adjustments with this method. For example, MP3 and AAC files can only be losslessly modified in 1.5 dB steps. Depending on the audio file format, the process may also be lossy in the sense that it could irreversibly push a signal above the format&#039;s maximum amplitude (resulting in clipping) or below the minimum (resulting in silence).&lt;br /&gt;
&lt;br /&gt;
=== Old versus new algorithms ===&lt;br /&gt;
Since the ReplayGain standard does not define tags to specify which algorithm was used (classic or ITU-R BS.1770) or what target was set (RG&#039;s -18&amp;amp;nbsp;LUFS, EBU R 128&#039;s -23&amp;amp;nbsp;LUFS, or any other target set by the user or some piece of software), there may be confusion as to how the results were produced. Typically, utilities that ship with reference encoders (FLAC / metaflac, Vorbis / vorbisgain, WavPack / wvgain, Musepack / mpcgain…) use the original RG algorithm, which can produce values that differ from newer tools by several decibels in certain cases. Generally speaking, it is recommended to run other utilities or players that implement the ITU-R BS.1770 algorithm, although it may not be obvious which algorithm they use at first glance. Their documentation may provide that information.&lt;br /&gt;
&lt;br /&gt;
==== RG1, RG2 ====&lt;br /&gt;
Although there are many references online, and within ReplayGain scanners, about version 1 vs. version 2 of the ReplayGain standard, at the time of writing this, there is (admittedly) only one ReplayGain standard. The core principle, as well as the 4 tags from the original specification, have not changed. More tags have been proposed but they are still subject to debate. As a rule of thumb, tools that advertise &amp;quot;ReplayGain&amp;amp;nbsp;2&amp;quot; compliance employ the newer, more accurate ITU-R BS.1770 algorithm. [[foobar2000]] labels it &amp;quot;EBU R128&amp;quot; but it essentially means the same thing. Should a better algorithm be developed in the future, it will still work towards fulfilling ReplayGain&#039;s original goals, and probably write the same tags.&lt;br /&gt;
&lt;br /&gt;
=== MP3Gain ===&lt;br /&gt;
[[MP3Gain]] is an implementation of classic ReplayGain. It can be used to just analyze files &amp;amp; recommend changes or to also modify the gain. If modifying the gain, it always modifies the global gain fields in the MP3 audio data. It can add somewhat precise metadata, including undo info. The gain can be modified to any target dB, or it can be changed by a specified amount. For balance correction, user-specified changes can even be made on just one channel in simple L/R stereo-mode files (not joint stereo).&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]]&lt;br /&gt;
* Method: Audio + Meta (in APE tag), or Audio only&lt;br /&gt;
* APE tag fields (ASCII bytes):&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values for this file. 3 digits, zero-padded if necessary.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_ALBUM_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values across a set of files scanned as an album. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_UNDO +###,+###,N&amp;lt;/code&amp;gt; - the global gain adjustment to restore the original values in the left and right channels, respectively, followed by an indicator of whether to wrap at the extremes (&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; means no, &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; means yes). The adjustment values are 3 digits, zero-padded, preceded by a sign (&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;).&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Examples: &amp;lt;code&amp;gt;+0.424046&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-10.38500&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Example: &amp;lt;code&amp;gt;0.149923&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Optional.&lt;br /&gt;
* Limitations: Although the metadata, if written, contains precise adjustment &amp;amp; peak values, the audio data modifications are limited to 1.5dB steps and may become irreversible (however, that&#039;s a very rare condition; see the [https://hydrogenaud.io/index.php/topic,34154.0.html &amp;quot;mp3gain is NOT lossless&amp;quot; forum thread])&lt;br /&gt;
* http://mp3gain.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== AACGain ===&lt;br /&gt;
[[AACGain]] is a modified version of MP3Gain that works on both MP3 and AAC files.&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]], [[AAC]] (with or without MP4 container)&lt;br /&gt;
* Method: Audio + Meta, or Audio only&lt;br /&gt;
* Limitations: Limited to 1.5dB steps mode, may become irreversible (same caveat as for MP3Gain)&lt;br /&gt;
* http://aacgain.altosdesign.com/&lt;br /&gt;
&lt;br /&gt;
=== [[LAME]] ===&lt;br /&gt;
* Method: Header ([http://gabriel.mp3-tech.org/mp3infotag.html mp3infotag])&lt;br /&gt;
* Notes:&lt;br /&gt;
** Uses the classic RG algorithm.&lt;br /&gt;
** Tags added during encoding; not supported by any player yet; Track Gain only&lt;br /&gt;
** Replay Gaining MP3&#039;s is usually done using MP3Gain (see [[ReplayGain#MP3Gain|above]]) or [[ReplayGain#foobar2000 ReplayGain scanner|foobar2000]]&lt;br /&gt;
* http://lame.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== [[Musepack]] ReplayGain ===&lt;br /&gt;
* Method: Header (similar to Meta data method)&lt;br /&gt;
* Notes: Uses the classic RG algorithm. ReplayGain values are stored in the header and ReplayGain is part of the Musepack specifications; therefore any Musepack decoder that does not support ReplayGain can be considered broken.&lt;br /&gt;
* http://www.musepack.net/&lt;br /&gt;
&lt;br /&gt;
=== VorbisGain ===&lt;br /&gt;
* Format: (Ogg) [[Vorbis]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.sjeng.org/vorbisgain.html&lt;br /&gt;
** new compiles of VorbisGain at [http://www.rarewares.org/ogg.html www.rarewares.org]&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) [[Vorbis#ReplayGain|check this section]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== FLAC / METAFLAC ===&lt;br /&gt;
* Format: [[Free Lossless Audio Codec|FLAC]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://flac.sf.net&lt;br /&gt;
&lt;br /&gt;
=== WavPack / WVGAIN ===&lt;br /&gt;
* Format: [[WavPack]]&lt;br /&gt;
* Method: Meta (in [[APEv2]] tag)&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.wavpack.com&lt;br /&gt;
&lt;br /&gt;
=== Wavegain ===&lt;br /&gt;
* Format: waveform&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* Limitations: Irreversible&lt;br /&gt;
* http://www.rarewares.org/others.php#wavegain&lt;br /&gt;
&lt;br /&gt;
=== MusicPlayer ===&lt;br /&gt;
* Custom implementation, inspired by MP3Gain.&lt;br /&gt;
* Format: any that FFmpeg supports&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Limitations: Doesn&#039;t modify the files at all. Stores the value in own database. Used only for playback.&lt;br /&gt;
* https://github.com/albertz/music-player&lt;br /&gt;
&lt;br /&gt;
=== [[foobar2000]] ReplayGain scanner ===&lt;br /&gt;
* Since v1.1.6, defaults to ITU-R BS.1770 analysis (although it labels it EBU R128), but can be configured to use the &amp;quot;Classic ReplayGain&amp;quot; algorithm instead. The ITU-R BS.1770 implementation uses a reference level of -18&amp;amp;nbsp;LUFS instead of -23, in order to retain compatibility with the ReplayGain standard.&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] (default) or [[APEv2]] tags.&lt;br /&gt;
** [[Musepack]]: Values written to header.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]] and/or file header.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags&lt;br /&gt;
** [[MP4]] (AAC, ALAC, MP3): Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain).&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TTA]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** [[WMA]]: Values written to WMA tags.&lt;br /&gt;
** [[WAV]]: Values written to ID3 chunk.&lt;br /&gt;
** [[AIFF]]: Values written to ID3 chunk.&lt;br /&gt;
** [[Matroska]]: Values written to container tags.&lt;br /&gt;
** Modules ([[MOD]] etc.): Optionally saved into [[APEv2]] tags.&lt;br /&gt;
** Any non-taggable format or format supported by FFmpeg can store RG values in a database or external tag with a component.&lt;br /&gt;
** A separate function can be invoked to apply the tagged Track or Album Gain to the global gain fields in MP3, AAC (in container), or Opus files, and rewrite any existing tags to account for the peak change and compensate for the difference from 89&amp;amp;nbsp;dB. The 89&amp;amp;nbsp;dB reference level for tags isn&#039;t configurable, but the reference level applied to the global gain fields is.&lt;br /&gt;
** Can automatically copy Track or Album gain values to Apple&#039;s SoundCheck tag in MP4 files or any format that supports ID3v2 to effectively add ReplayGain support to Apple&#039;s players.&lt;br /&gt;
* https://foobar2000.org/&lt;br /&gt;
&lt;br /&gt;
=== [[MediaMonkey]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[WAV]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[MPC]]: Internal gain Structure.&lt;br /&gt;
* In addition to tags, all ReplayGain values are also stored in MediaMonkey&#039;s MDB database&lt;br /&gt;
* Album/Audiophile ReplayGain not supported until v3.0 (Dec 2007); support during burning &amp;amp; ripping added in 3.1 (Jun 2009)&lt;br /&gt;
* Also capable of (irreversibly) changing the volume of MP3 tracks, similar to [[MP3Gain]]&lt;br /&gt;
* http://www.mediamonkey.com/&lt;br /&gt;
&lt;br /&gt;
=== [[Winamp]] ReplayGain scanner===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in Windows Media Audio tags.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[MP4]]&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
* Support Album/Track Gain&lt;br /&gt;
&lt;br /&gt;
=== [[loudgain]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** MP2, [[MP3]]: Values written to [[ID3v2]] tags (ID3v2.3/ID3v2.4 selectable).&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Speex]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]], based on -23&amp;amp;nbsp;LUFS Opus standard. Only &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; are written, but the calculated &#039;&#039;true peak&#039;&#039; value can still be used to reduce the gain values ([[Clipping]] prevention).&lt;br /&gt;
** [[MP4]], [[M4A]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under &amp;lt;code&amp;gt;----:com.apple.iTunes:…&amp;lt;/code&amp;gt;. This is for [[AAC]] and [[ALAC]] in [[MPEG-4]] containers.&lt;br /&gt;
** [[ASF]], [[Windows Media Audio|WMA]]: Values written to WMA tags, no prefix.&lt;br /&gt;
** [[WAV]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] (ID3v2.3/ID3v2.4 selectable) format. Using the &amp;lt;code&amp;gt;bext&amp;lt;/code&amp;gt; chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.&lt;br /&gt;
** [[Audio Interchange File Format|AIFF]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] format.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[Monkey&#039;s Audio]] (APE): Values written to [[APEv2]] tags.&lt;br /&gt;
* Follows EBU R128, ITU BS.1770 and the [[ReplayGain 2.0 specification|revised ReplayGain specification]].&lt;br /&gt;
* &#039;&#039;Never&#039;&#039; touches the actual audio data but &#039;&#039;only writes RG2 tags&#039;&#039;.&lt;br /&gt;
* Uses &#039;&#039;true peak&#039;&#039; values calculated by oversampling to 192&amp;amp;nbsp;kHz, using a custom polyphase FIR interpolator that will oversample 4x for sample rates &amp;lt; 96&amp;amp;nbsp;kHz, 2x for sample rates &amp;lt; 192&amp;amp;nbsp;kHz and leave the signal unchanged for 192&amp;amp;nbsp;kHz.&lt;br /&gt;
* &#039;&#039;Clipping prevention&#039;&#039; can be used to lower the ReplayGain values to a safe margin (default -1&amp;amp;nbsp;dBTP, can be changed).&lt;br /&gt;
* Many options for special cases: force RG tags upper-/lowercase, add extra tags (LRA, Reference loudness), strip unwanted tag types (APEv2 from MP2/MP3, ID3 from WavPack), tab-delimited table output for analysis with CSV file.&lt;br /&gt;
* &#039;&#039;Linux&#039;&#039; Free and Open Source software, can be installed on &#039;&#039;MacOS&#039;&#039; using &#039;&#039;HomeBrew&#039;&#039;, on &#039;&#039;Windows 10&#039;&#039; using the Linux &#039;&#039;bash&#039;&#039;.&lt;br /&gt;
* Also installs a &amp;lt;code&amp;gt;rgbpm&amp;lt;/code&amp;gt; bash script for mass-tagging, which can be adapted to the user’s needs.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; Loudgain relies on standard libraries like &#039;&#039;TagLib&#039;&#039;. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of &#039;&#039;TagLib&#039;&#039;. Version 1.11.1 had a nasty bug for a while that [https://hydrogenaud.io/index.php/topic,118085.msg974957.html#msg974957 could corrupt Ogg Vorbis files]. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called &amp;lt;code&amp;gt;loudgain.static&amp;lt;/code&amp;gt; in the repo’s &amp;lt;code&amp;gt;/bin&amp;lt;/code&amp;gt; folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).&lt;br /&gt;
* https://github.com/Moonbase59/loudgain&lt;br /&gt;
* Bug tracker: https://github.com/Moonbase59/loudgain/issues&lt;br /&gt;
&lt;br /&gt;
=== [[rsgain]] ===&lt;br /&gt;
rsgain is a newer ReplayGain command line utility designed with a &amp;quot;batteries included&amp;quot; philosophy, use the newer ITU-R BS.1770 algorithm.&lt;br /&gt;
&lt;br /&gt;
Features:&lt;br /&gt;
* Cross-platform Windows&amp;amp;nbsp;/&amp;amp;nbsp;macOS&amp;amp;nbsp;/&amp;amp;nbsp;Linux&lt;br /&gt;
* Supports all popular audio formats&lt;br /&gt;
* Simplified &amp;quot;Easy Mode&amp;quot; command line syntax supports recursive, directory-based scanning&lt;br /&gt;
* Multithreaded scanning option that provides significant speed improvement with full library scans&lt;br /&gt;
* Option to skip files with existing ReplayGain metadata&lt;br /&gt;
* Scan presets allow the user to save advanced settings for consistent use&lt;br /&gt;
&lt;br /&gt;
== Players support ==&lt;br /&gt;
ReplayGain being present in the specs of the FLAC, Musepack, and APE formats, any player that support those formats usually supports ReplayGain.&lt;br /&gt;
&lt;br /&gt;
The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* [[foobar2000]] supports ReplayGain in all possible aspects.&lt;br /&gt;
* [[Winamp]] supports ReplayGain in album or track mode.&lt;br /&gt;
* [[MediaMonkey]] supports ReplayGain, with many configuration options.&lt;br /&gt;
* [[XMPlay]] recently implemented ReplayGain&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...and probably others.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
* [[XMMS]]. Reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], [[Musepack]], (Ogg) [[Vorbis]] ..&lt;br /&gt;
:For [[MP3]], use the CVS version of the [http://xmms-mad.sourceforge.net/ xmms-mad] mp3 plugin (it&#039;s not yet released as binary, furthermore not available in distribs&#039; versions for now. Meanwhile binaries are available here: [http://perso.crans.org/~krempp/xmms-mad/ custom binaries])&lt;br /&gt;
* [[amarok]]. By using the amarok-script [http://kde-apps.org/content/show.php?content=26073 ReplayGain]&lt;br /&gt;
:And possibly others, since [http://developer.kde.org/~wheeler/taglib.html TagLib] added support for [[APEv2]] tags in [[MP3]] files, players using this library (like [[amaroK]] and [[JuK]]) might support that kind of ReplayGain tags in the near future.&lt;br /&gt;
* [http://www.sacredchao.net/quodlibet Quod Libet] reads ReplayGain from (Ogg) [[Vorbis]], [[MP3]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support ReplayGain values stored in [[APEv2]] tags in [[MP3]]s. ReplayGain values are stored in RVA2 id3v2.4 frames. See the [http://www.sacredchao.net/quodlibet/wiki/Development/ID3Notes Quod Libet RVA2 / ReplayGain notes].&lt;br /&gt;
* [http://www.musicpd.org/ Music Player Daemon] (MPD) reads ReplayGain from (Ogg) [[Vorbis]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:foobar2000-style TXXX frames in [[MP3]]s are also supported in the latest development releases.&lt;br /&gt;
* [http://www.mplayerhq.hu/ MPlayer]. Mplayer support for ReplayGain is codec dependent.&lt;br /&gt;
:Codecs that are known to support ReplayGain: vorbis&lt;br /&gt;
:Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line.  To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed.  To prioritize the codecs by default, list them in a line in mplayer.conf:&lt;br /&gt;
 ac=[codec],[othercodec],vorbis,mad,&lt;br /&gt;
* [http://idjc.sourceforge.net/ IDJC] (Internet DJ Console) reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], (Ogg) FLAC, (Ogg) [[Vorbis]], MP2 (audio), [[MP3]], [[Opus]], but only the &#039;&#039;lowercase&#039;&#039; tags. There is a [https://sourceforge.net/p/idjc/bugs/100/ ticket] open to handle tags case-insensitively.&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
* [https://www.videolan.org/vlc/ VLC] supports ReplayGain in many file formats, but usually only the &#039;&#039;uppercase&#039;&#039; variant of the tags.&lt;br /&gt;
* [https://kodi.tv/ KODI] reads ReplayGain from nearly all formats, but usually only the &#039;&#039;lowercase&#039;&#039; variant of the tags.&lt;br /&gt;
&lt;br /&gt;
=== Portable devices ===&lt;br /&gt;
[http://www.rockbox.org/ Rockbox] supports ReplayGain (in album or track mode) for most formats, including  WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey&#039;s Audio, Wavpack, FLAC and Vorbis.  &amp;lt;br&amp;gt;Note that ReplayGain is only supported when using the respective codec&#039;s native tagging format.  For example:  ReplayGain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Fuze with firmware 1.02.26 and 2.02.26&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Clip+&lt;br /&gt;
&lt;br /&gt;
The iPod features &#039;&#039;Soundcheck&#039;&#039;, which seems to produce roughly the same normalization gains as ReplayGain, but doesn&#039;t provide an Album Gain.&lt;br /&gt;
&lt;br /&gt;
=== Hi-Fi ===&lt;br /&gt;
Slim Devices, a company owned by Logitech Inc, supports ReplayGain on both of their hi-end audiophile players, known as the [[Slim Devices Transporter|Transporter]] and the [[Slim Devices Squeezebox|Squeezebox]].&lt;br /&gt;
&lt;br /&gt;
BluOS also supports ReplayGain with the selection of album- or track-gain and a so called Smart option that decides between the two by itself.&lt;br /&gt;
NAD devices that use BluOS consequently also support ReplayGain.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;references/&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[ReplayGain specification]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Replay_Gain ReplayGain] at Wikipedia&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain.html ReplayGain using foobar2000] (how to use ReplayGain in Windows using foobar2000).&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html ReplayGain in Linux] (how to use ReplayGain in Linux using foobar2000 and Wine, or using metaflac or vorbisgain).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[index.php?title=Category:Technical]]&lt;br /&gt;
[[index.php?title=Category:Metadata]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Revised_ReplayGain_specification&amp;diff=38810</id>
		<title>Revised ReplayGain specification</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Revised_ReplayGain_specification&amp;diff=38810"/>
		<updated>2026-01-23T13:21:32Z</updated>

		<summary type="html">&lt;p&gt;Case: /* De-Facto extensions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;font size=&amp;quot;4&amp;quot;&amp;gt;&#039;&#039;This is a proposed update to the [[ReplayGain 1.0 specification|original ReplayGain specification]]. This proposal is currently &#039;&#039;&#039;Under Construction&#039;&#039;&#039;. Please discuss this proposal on the [[Talk:ReplayGain 2.0 specification|discussion page]] or the [https://hydrogenaudio.org/index.php/topic,129032.0.html dedicated thread on Hydrogenaudio].&#039;&#039; --[[User:Skamp|Skamp]] 22:10 CET, January 22, 2026&amp;lt;/font&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Although music is encoded to a digital format with a clearly defined maximum peak amplitude, and although most recordings are normalized to utilize this peak amplitude, not all recordings sound equally loud. This is because once this peak amplitude is reached, perceived loudness can be further increased through signal-processing techniques such as dynamic range compression and equalization.&amp;lt;ref&amp;gt;Source: Wikipedia - [http://en.wikipedia.org/wiki/Loudness_war Loudness war]&amp;lt;/ref&amp;gt; Therefore, the loudness of a given album has more to do with the year of issue or the whim of the producer than the intended emotional effect. Because of this, a random play through a music collection can have one leaping for the volume control every other track.&lt;br /&gt;
&lt;br /&gt;
There is a solution to this annoyance: within each audio file, information can be stored about what volume change would be required to play each track or album at a standard loudness, and players can use this &amp;quot;replay gain&amp;quot; information to automatically nudge the volume up or down as required.&lt;br /&gt;
&lt;br /&gt;
The ReplayGain specification is a standard which defines an appropriate reference level, explains a way of calculating and representing the ideal replay gain for a given track or album, and provides guidance for players to make the required volume adjustment during playback. The standard also specifies a means to prevent clipping when the calculated replay gain exceeds the limits of digital audio, and it describes how the replay gain information is stored within audio files.&lt;br /&gt;
&lt;br /&gt;
==Loudness measurement==&lt;br /&gt;
Loudness is a subjective measure of the intensity of sound. The correlation of perceived loudness to sound pressure level is determined by the peculiarities of the auditory system.&lt;br /&gt;
&lt;br /&gt;
The [[ReplayGain 1.0 specification|original ReplayGain specification]] described a loudness measurement system which included a weighting filter, root mean square (RMS) measurement and statistical processing that model human perception of loudness in both the frequency and time domains.&lt;br /&gt;
&lt;br /&gt;
Since original ReplayGain proposal in 2001, the science, practice and standards for loudness normalization have been advanced significantly. The current industry standard approach to loudness measurement is described by the International Telecommunications Union&amp;lt;ref&amp;gt;http://www.itu.int/en/Pages/default.aspx&amp;lt;/ref&amp;gt; (ITU) as BS.1770. The most recent version of this standard is known as ITU BS.1770-5&amp;lt;ref&amp;gt;https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en&amp;lt;/ref&amp;gt; and was published in December 2023. The ITU work is freely available and is not believed to be encumbered by any patent issues. The ITU BS.1770-2 standard has been adopted in the United States by the [http://www.atsc.org ATSC] as [http://www.atsc.org/cms/standards/a_85-2011a.pdf A/85] and in Europe by the [http://www.ebu.ch European Broadcast Union] as [http://tech.ebu.ch/docs/tech/tech3343.pdf EBU R-128] for broadcast audio. &lt;br /&gt;
&lt;br /&gt;
BS.1770 uses a &amp;quot;K-weighted&amp;quot; RMS measurement. This weighting function is significantly less complex than the inverted Fletcher-Munson weighting used by the original ReplayGain algorithm. A gating function designed measure the loudness of foreground components in the audio program. The gate in BS.1770 performs a similar function as the statistical processing in the original RG specification. &lt;br /&gt;
&lt;br /&gt;
The computation required for BS.1770 loudness measurement is reduced compared to the original RG technique. Nevertheless, BS.1770 has been shown in several academic studies to be equally or more effective than the RG algorithm in modeling human loudness perception on music program as well as other material such as podcasts, television programs and movies.&amp;lt;ref&amp;gt;Paul Nygren. [http://www.speech.kth.se/prod/publications/files/3319.pdf Achieving equal loudness between audio files]. KTH Royal Institute of Technology&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;Martin Wolters; Harald Mundt; Jeffrey Riedmiller (May 2010). [http://www.aes.org/e-lib/browse.cfm?elib=15341 Loudness Normalization In The Age Of Portable Media Players]. Audio Engineering Society.&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;Esben Skovenborg; Søren H. Nielsen (October 2004). [http://web.archive.org/web/20120208024743/http://www.tcelectronic.com/media/skovenborg_2004_loudness_m.pdf Evaluation of Different Loudness Models with Music and Speech Material]. Audio Engineering Society. Archived from [http://www.tcelectronic.com/media/skovenborg_2004_loudness_m.pdf the original] on 2012-02-08.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Recent RG implementations use BS.1770 for loudness measurement. It is expected the ITU standard will evolve over time to meet the needs of broadcasters and governments. It is the intent of the ReplayGain community that RG follow any future backwards-compatible improvements to loudness measurement using the BS.1770 standard.&lt;br /&gt;
&lt;br /&gt;
==Reference level==&lt;br /&gt;
&lt;br /&gt;
Classic ReplayGain is calibrated to a pink noise reference signal with a RMS level 14&amp;amp;nbsp;dB below a full-scale sinusoid. This reference signal is used to establish a reference level. ReplayGain will apply no gain or attenuation to the reference signal or any program material which has the same loudness measurements as the reference signal.&lt;br /&gt;
&lt;br /&gt;
BS-1770 defines a loudness scale for program material. The units of BS.1770 loudness measurements are in Loudness Units [relative to] Full Scale (LUFS). LUFS can be treated like decibels.&lt;br /&gt;
&lt;br /&gt;
In order to maintain backwards compatibility with classic RG, newer RG uses a -18&amp;amp;nbsp;LUFS reference, which based on lots of music, can give similar loudness compared to classic RG.&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
The loudness measurement of the RG1 reference signal is NOT -18 LUFS; &lt;br /&gt;
The original -20 RMS dBFS one is -20.36 LUFS, and the -14 RMS dbFS one would be -15.36 LUFS.&lt;br /&gt;
&lt;br /&gt;
We picked -18 here is the result of analyzing actual music. &lt;br /&gt;
&lt;br /&gt;
Check what 2Bdecided said here: https://hydrogenaud.io/index.php/topic,109076.msg899298.html#msg899298&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Gain calculation==&lt;br /&gt;
RG achieves loudness compensated playback by applying gain (or attenuation) dependent on the measured loudness of the audio file relative to the established reference level. The gain is calculated as follows:&lt;br /&gt;
:&amp;lt;math&amp;gt;RG=L_{r}-L&amp;lt;/math&amp;gt;&lt;br /&gt;
Where:&lt;br /&gt;
:&amp;lt;math&amp;gt;RG&amp;lt;/math&amp;gt; is the replay gain adjustment in decibels,&lt;br /&gt;
:&amp;lt;math&amp;gt;L_{r}&amp;lt;/math&amp;gt; is the -18&amp;amp;nbsp;LUFS reference level&lt;br /&gt;
:&amp;lt;math&amp;gt;L&amp;lt;/math&amp;gt; is the measured loudness of the audio file in LUFS.&lt;br /&gt;
&lt;br /&gt;
Gain is positive if the loudness of the audio file is lower than the reference level. The gain is negative (representing an attenuation) if the loudness of the audio file is higher than the reference level. The gain is stored as metadata with the audio file as described below and is used by players to adjust output volume of tracks as they are played as described in [[ReplayGain 2.0 specification#Player requirements|Player requirements]] below.&lt;br /&gt;
&lt;br /&gt;
==Metadata==&lt;br /&gt;
For ReplayGain to do its work during playback, four values must be stored as metadata&amp;lt;ref&amp;gt;Metadata is &amp;quot;data about data.&amp;quot; For example, the ID3 &#039;&#039;de facto&#039;&#039; standard provides a way to store artist, title, album title, track number, and other metadata in data blocks called &amp;quot;tags&amp;quot; immediately before or after the audio data in an MP3 file. Other metadata storage/tagging standards and conventions exist for other audio file formats.&amp;lt;/ref&amp;gt; with or within the audio file:&lt;br /&gt;
# Peak track amplitude&lt;br /&gt;
# Peak album amplitude&lt;br /&gt;
# Track replay gain&lt;br /&gt;
# Album replay gain&lt;br /&gt;
&lt;br /&gt;
If calculated for an individual track, the loudness measurement (as specified above) yields track replay gain. If calculated on an album basis, with all tracks concatenated to make one long audio file, the loudness measurement yields album replay gain.&lt;br /&gt;
&lt;br /&gt;
===Replay gain===&lt;br /&gt;
Under some listening conditions, it&#039;s useful to have every track sound equally loud. The problem with a track-by-track approach is that tracks which should be quiet in the context of the album on which they reside will be brought up to the level of all the rest. For casual listening, or in a noisy background, this can be a good thing. For serious listening, it does not respect the intent of the artist or mastering engineer; a tender ballad track will be blasting at the same loudness as a hard rock track on the same album. It&#039;s generally ideal to leave the intentional loudness differences between tracks in place, yet still correct for unmusical and annoying loudness differences between albums. To accomplish this, ReplayGain suggests that two different gain adjustments should be stored as metadata with each sound file.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Album replay gain&#039;&#039; represents the ideal listening gain for an entire album. ReplayGain reads the collection of tracks that comprise an album, and calculates a single replay gain for the whole set. This single gain can be used for playback of all tracks of the album. Intentionally quiet tracks then stay appropriately quieter than the rest. It still solves the basic problem (annoying, unwanted level differences between discs) because quiet or loud discs are still adjusted overall&amp;amp;mdash;so the pop CD that&#039;s 20&amp;amp;nbsp;dB louder than the classical CD will be brought into line.&lt;br /&gt;
&lt;br /&gt;
===Peak amplitude===&lt;br /&gt;
Scanning a track or album for the peak amplitude can be a time-consuming process. Therefore, it&#039;s helpful if this single value is stored as metadata. This is used to predict whether the required replay gain adjustment will cause clipping during playback.&lt;br /&gt;
&lt;br /&gt;
The maximum peak amplitude value is stored as a floating point number, where 1.0 represents digital full scale. As with replay gain values, separate peak amplitude values are stored per track and per album.&lt;br /&gt;
&lt;br /&gt;
For uncompressed files simply, scanners store the maximum absolute sample value held in the file on any channel for positive or negative excursion. The single sample value should be converted to a floating-point representation, such that digital full scale is equivalent to a value of 1.0.&lt;br /&gt;
&lt;br /&gt;
Psychoacoustically coded audio, such as MP3, does not exist as a sequence of samples until it is decoded. Psychoacoustic coding of a heavily limited file can lead to sample values larger than digital full scale upon decoding. The coded files must be decoded using a fully compliant decoder that allows peak overflows (i.e. has headroom) and may result in peak amplitude values greater than 1.0.&lt;br /&gt;
&lt;br /&gt;
==Metadata format==&lt;br /&gt;
From the standpoint of metadata storage, each audio file format presents a unique situation. There are three favored schemes defined for storage of ReplayGain metadata: &#039;&#039;&#039;ID3v2&#039;&#039;&#039;, &#039;&#039;&#039;Vorbis comments&#039;&#039;&#039; and &#039;&#039;&#039;APEv2&#039;&#039;&#039;. A survey of file formats is listed below with metadata schemes in order of preference for each:&lt;br /&gt;
* .aac (Advanced Audio Coding raw format) &amp;amp;ndash; No metadata support (use .mp4 instead)&lt;br /&gt;
* .aiff, .aif, .aifc (Apple Interchange File Format) &amp;amp;ndash; &#039;&#039;&#039;ID3v2&#039;&#039;&#039; (in &amp;quot;ID3&amp;quot; IFF chunk)&lt;br /&gt;
* .ape, .apl (Monkey&#039;s Audio) &amp;amp;ndash; &#039;&#039;&#039;APEv2&#039;&#039;&#039;&lt;br /&gt;
* .bwf (Broadcast Wave Format) &amp;amp;ndash; &#039;&#039;&#039;ID3v2&#039;&#039;&#039; (in RIFF chunk)&lt;br /&gt;
* .flac (Free Lossless Audio Codec) &amp;amp;ndash; &#039;&#039;&#039;Vorbis comments&#039;&#039;&#039;&lt;br /&gt;
* .mp3 (MPEG audio layer 3) &amp;amp;ndash; &#039;&#039;&#039;ID3v2&#039;&#039;&#039;, LAME VBR proposed tag specification&lt;br /&gt;
* .mp4 also .m4a, .m4b, .m4p, m4r (MPEG-4 Part 14) &amp;amp;ndash; &#039;&#039;&#039;ID3v2&#039;&#039;&#039; (in &amp;quot;ID32&amp;quot; box)&lt;br /&gt;
* .mpc (Musepack) &amp;amp;ndash; &#039;&#039;&#039;APEv2&#039;&#039;&#039;&lt;br /&gt;
* .ogg (Ogg Vorbis) &amp;amp;ndash; &#039;&#039;&#039;Vorbis comments&#039;&#039;&#039;, same for other Ogg codecs&lt;br /&gt;
* .opus (Ogg Opus) &amp;amp;ndash; &#039;&#039;&#039;Vorbis comments&#039;&#039;&#039; available&lt;br /&gt;
** standard {{code|R128_TRACK_GAIN}} and {{code|R128_ALBUM_GAIN}} (MUST adjust for -23 LUFS) comment keys may be preferable (used by {{code|loudgain}})&lt;br /&gt;
* .tta (True Audio) &amp;amp;ndash; &#039;&#039;&#039;ID3v2&#039;&#039;&#039;, &#039;&#039;&#039;APEv2&#039;&#039;&#039;&lt;br /&gt;
* .asf, .wma (Windows Media audio) - &#039;&#039;&#039;Vorbis comments&#039;&#039;&#039; in Extended Content Description Object&lt;br /&gt;
** {{code|loudgain}} instead uses native ASF/WMA attributes (itself a key-value storage) via TagLib, which is more sensible&lt;br /&gt;
* .wav (Windows PCM) &amp;amp;ndash; No metadata support (use .bwf instead)&lt;br /&gt;
** ID3 RIFF chunk possible (used by {{code|loudgain}})&lt;br /&gt;
* .wv (WavePak) &amp;amp;ndash; &#039;&#039;&#039;APEv2&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===ID3v2===&lt;br /&gt;
The ID3v2 standard&amp;lt;ref&amp;gt;The ID3v2 format is explained at [http://www.id3.org/ www.id3.org]. The most useful document is the [http://www.id3.org/id3v2.3.0.html ID3v2 v2.3.0 standard]. Although this document has been superseded by v2.4.0, the earlier document is complete (rather than an update), and in indexed HTML form. As such, it represents a better technical introduction to ID3v2.&amp;lt;/ref&amp;gt; defines a &#039;&#039;tag&#039;&#039; which is situated before the data in an MP3 file.&amp;lt;ref&amp;gt;The original ID3 (v1) tags resided at the end of the file, and contained a few fields of information. The ID3v1 tag is not extensible and therefore cannot support ReplayGain metadata.&amp;lt;/ref&amp;gt; ID3 is used primarily with MP3 audio files but means of adapting the system to other file types have been developed.&lt;br /&gt;
&lt;br /&gt;
The ID3v2 tag is divided into &#039;&#039;frames&#039;&#039;. The preferred means of storing ReplayGain metadata is use of &#039;&#039;TXXX&#039;&#039; key/value pair frames. Two other legacy schemes for storing ReplayGain metadata exist: [[ReplayGain legacy metadata formats#ID3v2 RGAD|RGAD]] and [[ReplayGain legacy metadata formats#ID3v2 RVA2|RVA2]]. These formats are documented in the [[ReplayGain legacy metadata formats|appendix]]. Players may choose to look for these formats if metadata in the &#039;&#039;TXXX&#039;&#039; format is not found in the ID3v2 tag. New scanners may write these older formats in addition to the newer (TXXX) ones if they wish to remain backwards compatible with older players.&lt;br /&gt;
&lt;br /&gt;
ReplayGain uses four TXXX frames. The header of a TXXX frame is coded as follows:&lt;br /&gt;
&lt;br /&gt;
 Frame ID       $54 58 58 58 (&amp;quot;TXXX&amp;quot;) &lt;br /&gt;
 Size           $xx xx xx xx (size of frame excluding this header)&lt;br /&gt;
 Flags          $40 $00      (discard frame if audio data is altered)&lt;br /&gt;
&lt;br /&gt;
Frame data is coded as follows:&lt;br /&gt;
&lt;br /&gt;
 Text encoding  $00          (ISO-8859-1 encoding)&lt;br /&gt;
 Description    &amp;lt;key string&amp;gt; $00&lt;br /&gt;
 Value          &amp;lt;value string&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The four frames associated with ReplayGain metadata use the following key/value pairs&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Table 3: Metadata keys and value formatting&lt;br /&gt;
|-&lt;br /&gt;
!Metadata&lt;br /&gt;
!Key&lt;br /&gt;
!Value format&lt;br /&gt;
|-&lt;br /&gt;
|Track replay gain&lt;br /&gt;
|REPLAYGAIN_TRACK_GAIN&lt;br /&gt;
|[-]a.bb dB&lt;br /&gt;
|-&lt;br /&gt;
|Peak track amplitude&lt;br /&gt;
|REPLAYGAIN_TRACK_PEAK&lt;br /&gt;
|c.dddddd&lt;br /&gt;
|-&lt;br /&gt;
|Album replay gain&lt;br /&gt;
|REPLAYGAIN_ALBUM_GAIN&lt;br /&gt;
|[-]a.bb dB&lt;br /&gt;
|-&lt;br /&gt;
|Peak album amplitude&lt;br /&gt;
|REPLAYGAIN_ALBUM_PEAK&lt;br /&gt;
|c.dddddd&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Gains are specified textually in decibels. Negative gains (attenuation) are prefixed with a &#039;-&#039;. Positive gains have no prefix. Integral portion of the gain (a) may be one or two numeric (0-9) digits. If there is no integral portion the field is &#039;0&#039;. The decimal portion of the gain (bb) is two numeric digits. Gains are suffixed with a space followed by &#039;dB&#039;.&lt;br /&gt;
&lt;br /&gt;
Peak levels are specified textually as a positive decimal. Peak level is a dimensionless quantity with 1.000000 representing full scale. No suffix is included on peak values. The integer field (c) is typically 1 or 0. Six numeric digits in the decimal field (dddddd) is adequate to accurately represent peak values for 16-bit audio data.&lt;br /&gt;
&lt;br /&gt;
A robust player should be prepared to parse the following variations in either replay gain or peak level metadata:&lt;br /&gt;
*Positive gains with leading &#039;+&#039;&lt;br /&gt;
*More or fewer significant digits than specified in any field&lt;br /&gt;
*Leading zeros or spaces in integer fields&lt;br /&gt;
*Missing or malformed &#039;dB&#039; suffix (e.g. no space between numeric digits and suffix, alternate capitalization)&lt;br /&gt;
*Alternate capitalization of keys&lt;br /&gt;
&lt;br /&gt;
Other formatting errors indicate more severe problems and should result in player ignoring data as if the frame did not exist.&lt;br /&gt;
&lt;br /&gt;
===Vorbis comments===&lt;br /&gt;
A Vorbis comment&amp;lt;ref&amp;gt;[http://www.xiph.org/vorbis/doc/v-comment.html Vorbis comment metadata format]. ReplayGain metadata is documented on the [http://wiki.xiph.org/VorbisComment#Replay_Gain Xiph Wiki].&amp;lt;/ref&amp;gt; uses an ASCII &amp;lt;tt&amp;gt;key=value&amp;lt;/tt&amp;gt; format. When Vorbis comments are used, the four ReplayGain metadata items are stored as separate comments. The &#039;&#039;keys&#039;&#039; and formatting for &#039;&#039;values&#039;&#039; is the same as specified for ID3v2. Keys and values are required by the Vorbis comment specification to b separated by &#039;=&#039; (equal character).&lt;br /&gt;
&lt;br /&gt;
===APEv2===&lt;br /&gt;
The APEv2 metadata format&amp;lt;ref&amp;gt;[http://wiki.hydrogenaudio.org/index.php?title=APEv2_specification APEv2 Specification at Hydrogen Audio Wiki]&amp;lt;/ref&amp;gt; also organizes data into key/value pairs. Keys are ASCII format. A flags field allows support for several value formats including UTF-8 and binary. Under APEv2, ReplayGain meta data is stored using the same keys and data as ASCII values in the same format as specified for ID3v2.&lt;br /&gt;
&lt;br /&gt;
===De-Facto extensions===&lt;br /&gt;
MusicBrainz Picard and [http://github.com/Moonbase59/loudgain#tags-written-andor-deleted LoudGain] also support the following additional tags, named using the same conventions:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Extension metadata keys&lt;br /&gt;
|-&lt;br /&gt;
!Metadata&lt;br /&gt;
!Key&lt;br /&gt;
!Value format&lt;br /&gt;
!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|Track range&lt;br /&gt;
|REPLAYGAIN_TRACK_RANGE&lt;br /&gt;
|[-]a.bb dB&lt;br /&gt;
|rowspan=2 | Indicates dynamics (R-128 Loudness Range / LRA), may guide pre-amplification&lt;br /&gt;
|-&lt;br /&gt;
|Album range&lt;br /&gt;
|REPLAYGAIN_ALBUM_RANGE&lt;br /&gt;
|[-]a.bb dB&lt;br /&gt;
|-&lt;br /&gt;
|Reference loudness&lt;br /&gt;
|REPLAYGAIN_REFERENCE_LOUDNESS&lt;br /&gt;
|[-]a.bb LUFS&lt;br /&gt;
| Use alternative reference levels; change ref levels without re-scanning the file&lt;br /&gt;
(note: this field is harmful. The standard has only one reference level. The effective playback level is changed in player and does not require any form of rescanning.)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Proposed extension(s) ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+Extension metadata keys&lt;br /&gt;
|-&lt;br /&gt;
!Metadata&lt;br /&gt;
!Key&lt;br /&gt;
!Value format&lt;br /&gt;
!Purpose&lt;br /&gt;
|-&lt;br /&gt;
|Algorithm&lt;br /&gt;
|REPLAYGAIN_ALGORITHM&lt;br /&gt;
|ITU-R BS.1770&lt;br /&gt;
|Method to produce values&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Player requirements==&lt;br /&gt;
[[File:RG_Player_control.gif‎|frame|Figure 8: Example ReplayGain control panel]]&lt;br /&gt;
&lt;br /&gt;
Loudness normalization, pre-amplification and clipping prevention are the operations performed by a ReplayGain player.&lt;br /&gt;
&lt;br /&gt;
===Loudness normalization===&lt;br /&gt;
To properly normalize loudness, the player needs to determine if the user desires Track style level normalization (all tracks same loudness), or Album style level normalization (all albums same loudness, tracks of an album played at the same relative level as on the original release). This option should be selectable in the ReplayGain control panel (Figure 8). The player reads the corresponding gain metadata value from the file and scales the audio data as appropriate. Scaling the audio data simply means multiplying each sample value by a constant value. This constant is given by:&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;10^\frac{gain}{20}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or, in words, replay gain divided by 20 all raised to the power of ten.&amp;lt;ref&amp;gt;After any such operation, it&#039;s a good idea to dither the result. If this calculation and the pre-amp are implemented separately, then dither should only be added to the final result, just before the result is truncated back to 16 bits, or 24, or 8, as limited by the soundcard&amp;amp;mdash;not the file (i.e. after ReplayGain adjustment, an 8-bit file should be sent to a 16-bit soundcard at 16-bits).&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the file only contains one of the replay gain adjustments (e.g. Album) but the user has requested the other (Track), then the player should use the one that is available (in this case, Album). If neither (Track or Album) gain metadata is available, then the player needs to choose a suitable default gain. Potential choices include unity gain (0 dB) or an average of gains from other tracks in the album or playlist.&lt;br /&gt;
&lt;br /&gt;
===Pre-amplification===&lt;br /&gt;
Although the calibration level used by ReplayGain suggests that the average level of an audio track should be 14&amp;amp;nbsp;dB below full scale, some pop music is dynamically compressed to peak at 0&amp;amp;nbsp;dB and average around 3&amp;amp;nbsp;dB below full scale. This means that, when the replay gain is applied, the level of such tracks will be reduced by 11&amp;amp;nbsp;dB! If users are listening to a mixture of highly compressed and more dynamic tracks, ReplayGain will make the listening experience more pleasurable by bringing the level of the compressed tracks down into line with that of the others. However, if users are only listening to highly compressed music, then they may complain that all their files are now too quiet.&amp;lt;ref&amp;gt;This problem can be especially noticeable on portable players with limited output or gain.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To address this problem, a pre-amp feature should be incorporated into the player. A user-supplied pre-amp setting is an adjustment to the calculated replay gain. It should default to perform no adjustment. This means that casual users will experience a moderate reduction in the loudness of their compressed pop music. Less-compressed material can generally be played at the same loudness without clipping. Normalization of more dynamic material may cause clipping or invoke the [[ReplayGain 2.0 specification#Clipping prevention|clipping prevention]] mechanism (see below). Power users and audiophiles can reduce the pre-amp gain to enjoy the full dynamic range of all of their music.&lt;br /&gt;
&lt;br /&gt;
If enabled, the player should read the user selected pre-amp gain, and scale the audio signal by the appropriate amount. For example, a +6&amp;amp;nbsp;dB gain requires a scale of 10&amp;lt;sup&amp;gt;6/20&amp;lt;/sup&amp;gt;, which is approximately 2. The replay gain and pre-amp scale factors can be combined&amp;lt;ref&amp;gt;Scale factors in  Decibel units are added to produce the same effect as multiplying scale factors in linear units.&amp;lt;/ref&amp;gt; for simplicity and ease of processing.&lt;br /&gt;
&lt;br /&gt;
===Clipping prevention===&lt;br /&gt;
ReplayGain&#039;s suggestion of a -14&amp;amp;nbsp;dB average playback level leaves sufficient headroom for the bulk of modern recordings. Nevertheless, there exists the possibility that after application of replay gain and pre-amp adjustment, a track may exceed full scale during its dynamic peaks. Without intervention, this will result in clipping, a severe form of distortion. Factors introducing the possibility of clipping include:&lt;br /&gt;
&lt;br /&gt;
# Recordings from certain genres and certain periods in the history of commercial recordings require additional headroom. Although these recordings can be accommodated through a downwards adjustment of the pre-amp setting, it may be difficult to determine a safe adjustment and it may be undesirable to lower average level to accommodate the rare track which requires it. &lt;br /&gt;
# ReplayGain will make loud dynamically compressed tracks quieter, and quiet dynamically uncompressed tracks louder. The average levels will then be similar, but the quiet tracks will actually have louder peaks. If the user pushes the pre-amp gain upwards the peaks of the (originally) quieter tracks will be pushed well over full scale.&lt;br /&gt;
# In coded audio (e.g. MP3 files) a file that was hard-limited to digital full scale before encoding will often be pushed over the limit by the psychoacoustic compression. A decoder with headroom can recover the over full scale signal by reducing the gain.&lt;br /&gt;
&lt;br /&gt;
ReplayGain suggests two possible solutions which prevent clipping in these situations. A player should support one or both of these.&lt;br /&gt;
&lt;br /&gt;
====Audio limiting====&lt;br /&gt;
In situation 2 above, the user clearly wants all the music to sound very loud. To give them their wish, any signal which would peak above digital full scale should be hard limited at just below digital full scale. This is also useful at lower pre-amp gains, where it allows the average level of classical music to be raised to that of pop music, without distorting. The exact type of nature limiting or compression an implementation choice for the player.&amp;lt;ref&amp;gt;Something like the Hard Limiter found in Cool Edit Pro (Syntrillium) would be appropriate for pop music at least.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Reduced gain====&lt;br /&gt;
The audiophile user will not want any compression or limiting on the signal. In this case the only option is to automatically and temporarily reduce the pre-amp gain below the user-selected setting for tracks where clipping would otherwise occur. Clipping can be predicted by examining the peak level of the track or album being played.&lt;br /&gt;
&lt;br /&gt;
The player must read the peak amplitude metadata. If peak level metadata is unavailable, the player should assume a peak level of 1.0. If the peak level for both track and album is stored as metadata in the file, it is possible to calculate if, following the replay gain adjustment and pre-amp gain, the signal will clip at some point. If it won&#039;t, then no further action is necessary. &lt;br /&gt;
&lt;br /&gt;
An overall scale factor for loudness normalization taking into account replay gain, pre-amp setting and clipping prevention through gain reduction is given below.&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;min( 10^\frac{RG + G_{pre-amp}}{20}, \frac{1}{peak amplitude} )&amp;lt;/math&amp;gt;&lt;br /&gt;
&amp;lt;!-- use this when tex is fixed: :&amp;lt;math&amp;gt;\operatorname{min}( 10^\frac{RG + G_{pre-amp}}{20}, \frac{1}{L_{\mathrm{peak}}} )&amp;lt;/math&amp;gt; --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Hardware implementation===&lt;br /&gt;
The above three steps are appropriate to software players operating on the digital signal in order to scale it. However, it is possible to send the digital signal to the DAC without level correction, and to place an attenuator in the analogue signal path. The attenuator can then be driven by the Replay Gain value. The clipping problem can be addressed by providing adequate headroom in the analog circuitry. Bit transparency and maximum signal to noise ratio is maintained in the digital signal and DAC process.&amp;lt;ref&amp;gt;A system using today&#039;s 24-bit converters is unlikely to appreciate any overall gain in system performance with such an arrangement. A digitally-controlled analog gain element typically introduces significant noise and distortion.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Acknowledgements==&lt;br /&gt;
The [http://replaygain.hydrogenaudio.org/proposal original ReplayGain proposal] (an [http://replay.waybackmachine.org/20090306202649/http://www.replaygain.org/ archive] is also available) was developed by David Robinson and was published 10 July 2001. Additional updates were published by David Robinson through 10 October 2001.&lt;br /&gt;
&lt;br /&gt;
The following acknowledgement was included with the original proposal, &amp;quot;The algorithm to calculate an ideal replay gain has grown from my research into human hearing, with many additional ideas drawn from the work of E. Zwicker, and Brian Moore. I am currently completing my PhD at the University of Essex, and have been funded by the EPSRC.&amp;quot; Additionally David Robinson credited Glen Sawyer (Snelg) and Jim Casaburi (Walrus) for software contributions and Bob Katz and Matt Ashland for ideas.&lt;br /&gt;
&lt;br /&gt;
This updated ReplayGain specification reflecting current and recommended practice was prepared by Kevin Gross in 2011.&lt;br /&gt;
&lt;br /&gt;
==Contact==&lt;br /&gt;
For ReplayGain-related questions or contributions, please post in the [http://www.hydrogenaudio.org/forums/index.php?showforum=1 General Audio] section of the Hydrogen Audio forums.&lt;br /&gt;
 &lt;br /&gt;
==Appendix==&lt;br /&gt;
# [[ReplayGain legacy metadata formats]]&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38809</id>
		<title>ReplayGain</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38809"/>
		<updated>2026-01-23T11:02:51Z</updated>

		<summary type="html">&lt;p&gt;Case: /* Target loudness */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;ReplayGain&#039;&#039;&#039; is the name of a technique invented to achieve the same perceived playback loudness of audio files. It defines an algorithm to measure the &#039;&#039;&#039;perceived&#039;&#039;&#039; loudness of audio data.&lt;br /&gt;
&lt;br /&gt;
ReplayGain allows the loudness of each song within a collection of songs to be consistent. This is called &#039;Track Gain&#039; (or &#039;Radio Gain&#039; in earlier parlance). It also allows the loudness of a specific sub-collection (an &amp;quot;album&amp;quot;) to be consistent with the rest of the collection, while allowing the dynamics from song to song on the album to remain intact. This is called &#039;Album Gain&#039; (or &#039;Audiophile Gain&#039; in earlier parlance). This is especially important when listening to classical music albums, because quiet tracks need to remain a certain degree quieter than the louder ones.&lt;br /&gt;
&lt;br /&gt;
ReplayGain is different from [[Normalization|peak normalization]]. Peak normalization merely ensures that the peak amplitude reaches a certain level. This does not ensure equal loudness. The ReplayGain technique measures the &#039;&#039;effective power&#039;&#039; of the waveform (i.e. the RMS power after applying an &amp;quot;equal loudness contour&amp;quot;), and then adjusts the amplitude of the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified than peak-normalized waveforms.&lt;br /&gt;
&lt;br /&gt;
==Target loudness==&lt;br /&gt;
The target loudness of ReplayGain is [https://wiki.hydrogenaudio.org/index.php?title=Original_ReplayGain_specification#Reference_level &#039;&#039;&#039;89&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;dB SPL&#039;&#039;&#039;] / &#039;&#039;&#039;-18&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;[https://en.wikipedia.org/wiki/LUFS LUFS]&#039;&#039;&#039; (&#039;&#039;Loudness Units relative to Full Scale&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Some utilities have realized the inadequacies of the classic ReplayGain loudness calculation, switching to a more modern algorithm ([https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en ITU-R BS.1770]). However, the way it was integrated was extremely &#039;&#039;ad hoc&#039;&#039;, at least until a draft of a [[ReplayGain 2.0 specification|revised specification]] started being written.&lt;br /&gt;
&lt;br /&gt;
==Clipping==&lt;br /&gt;
Audio is generally recorded such that the loudest sounds don&#039;t clip, but the use of ReplayGain can cause clipping if the average volume of a song is below the target level. That is, upon playback, the volume of a quiet song is increased, so the parts of the song with above-average loudness, especially in the bass frequencies, will exceed the limits of the format and will be distorted. Whether this distortion is audible depends on the sounds in question, and the listener&#039;s sensitivity.&lt;br /&gt;
&lt;br /&gt;
Implementations deal with the risk of clipping in different ways. Some have a &amp;quot;pre-amp&amp;quot; feature which reduces (or boosts) the original audio&#039;s level by a certain amount before doing whatever is needed for ReplayGain. Some have a &amp;quot;prevent clipping&amp;quot; feature to reduce the amount of ReplayGain adjustment to whatever amount would keep clipping from occurring, based on peak info stored in the file&#039;s metadata (thus reducing the effectiveness of ReplayGain). Some recommend using a compressor/limiter DSP to prevent or reduce clipping, regardless of whether it was caused by ReplayGain.&lt;br /&gt;
&lt;br /&gt;
An alternative that may reduce the risk of clipping is the [https://tech.ebu.ch/docs/r/r128.pdf EBU R 128] recommendation of a -23&amp;amp;nbsp;LUFS target, but that&#039;s a different standard, and some may find the additional reduction in volume excessive, particularly if it leads to maxing out volume on user hardware. [[Opus]] in particular has adopted that standard, using a global gain as well as &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; tags. With ReplayGain, a simple (though somewhat radical) solution is to lower the preamp value by 5&amp;amp;nbsp;dB (or whatever one feels comfortable with) in the playback software. The RG target will always be -18&amp;amp;nbsp;LUFS, regardless of a user&#039;s volume or preamp settings.&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
There are different ReplayGain implementations, each with its own uses and strength. Most use [[metadata]] to indicate the level of the volume change that the player should make. Some modify the audio data itself, and optionally use metadata as well. There are advantages and disadvantages to both methods.&lt;br /&gt;
&lt;br /&gt;
In the metadata method, information on both types of ReplayGain (Track Gain and Album Gain) can be stored. The volume-change information can be very precise. If audio data was also changed, the metadata can contain &amp;quot;undo&amp;quot; info. Not all audio players/decoders know how to read and use ReplayGain information stored in metadata. And there&#039;s no standard for where and how ReplayGain info is stored; each implementation uses different formats and puts the info in different locations.&lt;br /&gt;
&lt;br /&gt;
In the audio data method, the file&#039;s actual audio data is modified so that its natural/default playback volume is at the target level. In this scenario, only one type of ReplayGain (Track Gain or Album Gain) can be applied. If no &amp;quot;undo&amp;quot; info is saved somewhere, it may not be possible to restore the original audio data. Limitations of the audio file format may prevent precise (finely tuned) gain adjustments with this method. For example, MP3 and AAC files can only be losslessly modified in 1.5 dB steps. Depending on the audio file format, the process may also be lossy in the sense that it could irreversibly push a signal above the format&#039;s maximum amplitude (resulting in clipping) or below the minimum (resulting in silence).&lt;br /&gt;
&lt;br /&gt;
=== Old versus new algorithms ===&lt;br /&gt;
Since the ReplayGain standard does not define tags to specify which algorithm was used (classic or ITU-R BS.1770) or what target was set (RG&#039;s -18&amp;amp;nbsp;LUFS, EBU R 128&#039;s -23&amp;amp;nbsp;LUFS, or any other target set by the user or some piece of software), there may be confusion as to how the results were produced. Typically, utilities that ship with reference encoders (FLAC / metaflac, Vorbis / vorbisgain, WavPack / wvgain, Musepack / mpcgain…) use the original RG algorithm, which can produce values that differ from newer tools by several decibels in certain cases. Generally speaking, it is recommended to run other utilities or players that implement the ITU-R BS.1770 algorithm, although it may not be obvious which algorithm they use at first glance. Their documentation may provide that information.&lt;br /&gt;
&lt;br /&gt;
==== RG1, RG2 ====&lt;br /&gt;
Although there are many references online, and within ReplayGain scanners, about version 1 vs. version 2 of the ReplayGain standard, at the time of writing this, there is (admittedly) only one ReplayGain standard. The core principle, as well as the 4 tags from the original specification, have not changed. More tags have been proposed but they are still subject to debate. As a rule of thumb, tools that advertise &amp;quot;ReplayGain&amp;amp;nbsp;2&amp;quot; compliance employ the newer, more accurate ITU-R BS.1770 algorithm. [[foobar2000]] labels it &amp;quot;EBU R128&amp;quot; but it essentially means the same thing. Should a better algorithm be developed in the future, it will still work towards fulfilling ReplayGain&#039;s original goals, and probably write the same tags.&lt;br /&gt;
&lt;br /&gt;
=== MP3Gain ===&lt;br /&gt;
[[MP3Gain]] is an implementation of classic ReplayGain. It can be used to just analyze files &amp;amp; recommend changes or to also modify the gain. If modifying the gain, it always modifies the global gain fields in the MP3 audio data. It can add somewhat precise metadata, including undo info. The gain can be modified to any target dB, or it can be changed by a specified amount. For balance correction, user-specified changes can even be made on just one channel in simple L/R stereo-mode files (not joint stereo).&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]]&lt;br /&gt;
* Method: Audio + Meta (in APE tag), or Audio only&lt;br /&gt;
* APE tag fields (ASCII bytes):&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values for this file. 3 digits, zero-padded if necessary.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_ALBUM_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values across a set of files scanned as an album. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_UNDO +###,+###,N&amp;lt;/code&amp;gt; - the global gain adjustment to restore the original values in the left and right channels, respectively, followed by an indicator of whether to wrap at the extremes (&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; means no, &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; means yes). The adjustment values are 3 digits, zero-padded, preceded by a sign (&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;).&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Examples: &amp;lt;code&amp;gt;+0.424046&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-10.38500&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Example: &amp;lt;code&amp;gt;0.149923&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Optional.&lt;br /&gt;
* Limitations: Although the metadata, if written, contains precise adjustment &amp;amp; peak values, the audio data modifications are limited to 1.5dB steps and may become irreversible (however, that&#039;s a very rare condition; see the [https://hydrogenaud.io/index.php/topic,34154.0.html &amp;quot;mp3gain is NOT lossless&amp;quot; forum thread])&lt;br /&gt;
* http://mp3gain.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== AACGain ===&lt;br /&gt;
[[AACGain]] is a modified version of MP3Gain that works on both MP3 and AAC files.&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]], [[AAC]] (with or without MP4 container)&lt;br /&gt;
* Method: Audio + Meta, or Audio only&lt;br /&gt;
* Limitations: Limited to 1.5dB steps mode, may become irreversible (same caveat as for MP3Gain)&lt;br /&gt;
* http://aacgain.altosdesign.com/&lt;br /&gt;
&lt;br /&gt;
=== [[LAME]] ===&lt;br /&gt;
* Method: Header ([http://gabriel.mp3-tech.org/mp3infotag.html mp3infotag])&lt;br /&gt;
* Notes:&lt;br /&gt;
** Uses the classic RG algorithm.&lt;br /&gt;
** Tags added during encoding; not supported by any player yet; Track Gain only&lt;br /&gt;
** Replay Gaining MP3&#039;s is usually done using MP3Gain (see [[ReplayGain#MP3Gain|above]]) or [[ReplayGain#foobar2000 ReplayGain scanner|foobar2000]]&lt;br /&gt;
* http://lame.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== [[Musepack]] ReplayGain ===&lt;br /&gt;
* Method: Header (similar to Meta data method)&lt;br /&gt;
* Notes: Uses the classic RG algorithm. ReplayGain values are stored in the header and ReplayGain is part of the Musepack specifications; therefore any Musepack decoder that does not support ReplayGain can be considered broken.&lt;br /&gt;
* http://www.musepack.net/&lt;br /&gt;
&lt;br /&gt;
=== VorbisGain ===&lt;br /&gt;
* Format: (Ogg) [[Vorbis]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.sjeng.org/vorbisgain.html&lt;br /&gt;
** new compiles of VorbisGain at [http://www.rarewares.org/ogg.html www.rarewares.org]&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) [[Vorbis#ReplayGain|check this section]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== FLAC / METAFLAC ===&lt;br /&gt;
* Format: [[Free Lossless Audio Codec|FLAC]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://flac.sf.net&lt;br /&gt;
&lt;br /&gt;
=== WavPack / WVGAIN ===&lt;br /&gt;
* Format: [[WavPack]]&lt;br /&gt;
* Method: Meta (in [[APEv2]] tag)&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.wavpack.com&lt;br /&gt;
&lt;br /&gt;
=== Wavegain ===&lt;br /&gt;
* Format: waveform&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* Limitations: Irreversible&lt;br /&gt;
* http://www.rarewares.org/others.php#wavegain&lt;br /&gt;
&lt;br /&gt;
=== MusicPlayer ===&lt;br /&gt;
* Custom implementation, inspired by MP3Gain.&lt;br /&gt;
* Format: any that FFmpeg supports&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Limitations: Doesn&#039;t modify the files at all. Stores the value in own database. Used only for playback.&lt;br /&gt;
* https://github.com/albertz/music-player&lt;br /&gt;
&lt;br /&gt;
=== [[foobar2000]] ReplayGain scanner ===&lt;br /&gt;
* Since v1.1.6, defaults to ITU-R BS.1770 analysis (although it labels it EBU R128), but can be configured to use the &amp;quot;Classic ReplayGain&amp;quot; algorithm instead. The ITU-R BS.1770 implementation uses a reference level of -18&amp;amp;nbsp;LUFS instead of -23, in order to retain compatibility with the ReplayGain standard.&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] (default) or [[APEv2]] tags.&lt;br /&gt;
** [[Musepack]]: Values written to header.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]] and/or file header.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags&lt;br /&gt;
** [[MP4]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain).&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TTA]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** [[WMA]]: Values written to WMA tags.&lt;br /&gt;
** [[WAV]]: Values written to ID3 chunk.&lt;br /&gt;
** [[AIFF]]: Values written to ID3 chunk.&lt;br /&gt;
** Modules ([[MOD]] etc.): Optionally saved into [[APEv2]] tags.&lt;br /&gt;
** Any non-taggable format or format supported by FFmpeg can store RG values in a database or external tag with a component.&lt;br /&gt;
** A separate function can be invoked to apply the tagged Track or Album Gain to the global gain fields in MP3, MP4 (AAC), or Opus files, and rewrite any existing tags to account for the peak change and compensate for the difference from 89&amp;amp;nbsp;dB. The 89&amp;amp;nbsp;dB reference level for tags isn&#039;t configurable, but the reference level applied to the global gain fields is.&lt;br /&gt;
** Can automatically copy Track or Album gain values to Apple&#039;s SoundCheck tag in MP4 files or any format that supports ID3v2 to effectively add ReplayGain support to Apple&#039;s players.&lt;br /&gt;
* https://foobar2000.org/&lt;br /&gt;
&lt;br /&gt;
=== [[MediaMonkey]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[WAV]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[MPC]]: Internal gain Structure.&lt;br /&gt;
* In addition to tags, all ReplayGain values are also stored in MediaMonkey&#039;s MDB database&lt;br /&gt;
* Album/Audiophile ReplayGain not supported until v3.0 (Dec 2007); support during burning &amp;amp; ripping added in 3.1 (Jun 2009)&lt;br /&gt;
* Also capable of (irreversibly) changing the volume of MP3 tracks, similar to [[MP3Gain]]&lt;br /&gt;
* http://www.mediamonkey.com/&lt;br /&gt;
&lt;br /&gt;
=== [[Winamp]] ReplayGain scanner===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in Windows Media Audio tags.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[MP4]]&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
* Support Album/Track Gain&lt;br /&gt;
&lt;br /&gt;
=== [[loudgain]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** MP2, [[MP3]]: Values written to [[ID3v2]] tags (ID3v2.3/ID3v2.4 selectable).&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Speex]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]], based on -23&amp;amp;nbsp;LUFS Opus standard. Only &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; are written, but the calculated &#039;&#039;true peak&#039;&#039; value can still be used to reduce the gain values ([[Clipping]] prevention).&lt;br /&gt;
** [[MP4]], [[M4A]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under &amp;lt;code&amp;gt;----:com.apple.iTunes:…&amp;lt;/code&amp;gt;. This is for [[AAC]] and [[ALAC]] in [[MPEG-4]] containers.&lt;br /&gt;
** [[ASF]], [[Windows Media Audio|WMA]]: Values written to WMA tags, no prefix.&lt;br /&gt;
** [[WAV]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] (ID3v2.3/ID3v2.4 selectable) format. Using the &amp;lt;code&amp;gt;bext&amp;lt;/code&amp;gt; chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.&lt;br /&gt;
** [[Audio Interchange File Format|AIFF]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] format.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[Monkey&#039;s Audio]] (APE): Values written to [[APEv2]] tags.&lt;br /&gt;
* Follows EBU R128, ITU BS.1770 and the [[ReplayGain 2.0 specification|revised ReplayGain specification]].&lt;br /&gt;
* &#039;&#039;Never&#039;&#039; touches the actual audio data but &#039;&#039;only writes RG2 tags&#039;&#039;.&lt;br /&gt;
* Uses &#039;&#039;true peak&#039;&#039; values calculated by oversampling to 192&amp;amp;nbsp;kHz, using a custom polyphase FIR interpolator that will oversample 4x for sample rates &amp;lt; 96&amp;amp;nbsp;kHz, 2x for sample rates &amp;lt; 192&amp;amp;nbsp;kHz and leave the signal unchanged for 192&amp;amp;nbsp;kHz.&lt;br /&gt;
* &#039;&#039;Clipping prevention&#039;&#039; can be used to lower the ReplayGain values to a safe margin (default -1&amp;amp;nbsp;dBTP, can be changed).&lt;br /&gt;
* Many options for special cases: force RG tags upper-/lowercase, add extra tags (LRA, Reference loudness), strip unwanted tag types (APEv2 from MP2/MP3, ID3 from WavPack), tab-delimited table output for analysis with CSV file.&lt;br /&gt;
* &#039;&#039;Linux&#039;&#039; Free and Open Source software, can be installed on &#039;&#039;MacOS&#039;&#039; using &#039;&#039;HomeBrew&#039;&#039;, on &#039;&#039;Windows 10&#039;&#039; using the Linux &#039;&#039;bash&#039;&#039;.&lt;br /&gt;
* Also installs a &amp;lt;code&amp;gt;rgbpm&amp;lt;/code&amp;gt; bash script for mass-tagging, which can be adapted to the user’s needs.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; Loudgain relies on standard libraries like &#039;&#039;TagLib&#039;&#039;. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of &#039;&#039;TagLib&#039;&#039;. Version 1.11.1 had a nasty bug for a while that [https://hydrogenaud.io/index.php/topic,118085.msg974957.html#msg974957 could corrupt Ogg Vorbis files]. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called &amp;lt;code&amp;gt;loudgain.static&amp;lt;/code&amp;gt; in the repo’s &amp;lt;code&amp;gt;/bin&amp;lt;/code&amp;gt; folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).&lt;br /&gt;
* https://github.com/Moonbase59/loudgain&lt;br /&gt;
* Bug tracker: https://github.com/Moonbase59/loudgain/issues&lt;br /&gt;
&lt;br /&gt;
=== [[rsgain]] ===&lt;br /&gt;
rsgain is a newer ReplayGain command line utility designed with a &amp;quot;batteries included&amp;quot; philosophy, use the newer ITU-R BS.1770 algorithm.&lt;br /&gt;
&lt;br /&gt;
Features:&lt;br /&gt;
* Cross-platform Windows&amp;amp;nbsp;/&amp;amp;nbsp;macOS&amp;amp;nbsp;/&amp;amp;nbsp;Linux&lt;br /&gt;
* Supports all popular audio formats&lt;br /&gt;
* Simplified &amp;quot;Easy Mode&amp;quot; command line syntax supports recursive, directory-based scanning&lt;br /&gt;
* Multithreaded scanning option that provides significant speed improvement with full library scans&lt;br /&gt;
* Option to skip files with existing ReplayGain metadata&lt;br /&gt;
* Scan presets allow the user to save advanced settings for consistent use&lt;br /&gt;
&lt;br /&gt;
== Players support ==&lt;br /&gt;
ReplayGain being present in the specs of the FLAC, Musepack, and APE formats, any player that support those formats usually supports ReplayGain.&lt;br /&gt;
&lt;br /&gt;
The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* [[foobar2000]] supports ReplayGain in all possible aspects.&lt;br /&gt;
* [[Winamp]] supports ReplayGain in album or track mode.&lt;br /&gt;
* [[MediaMonkey]] supports ReplayGain, with many configuration options.&lt;br /&gt;
* [[XMPlay]] recently implemented ReplayGain&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...and probably others.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
* [[XMMS]]. Reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], [[Musepack]], (Ogg) [[Vorbis]] ..&lt;br /&gt;
:For [[MP3]], use the CVS version of the [http://xmms-mad.sourceforge.net/ xmms-mad] mp3 plugin (it&#039;s not yet released as binary, furthermore not available in distribs&#039; versions for now. Meanwhile binaries are available here: [http://perso.crans.org/~krempp/xmms-mad/ custom binaries])&lt;br /&gt;
* [[amarok]]. By using the amarok-script [http://kde-apps.org/content/show.php?content=26073 ReplayGain]&lt;br /&gt;
:And possibly others, since [http://developer.kde.org/~wheeler/taglib.html TagLib] added support for [[APEv2]] tags in [[MP3]] files, players using this library (like [[amaroK]] and [[JuK]]) might support that kind of ReplayGain tags in the near future.&lt;br /&gt;
* [http://www.sacredchao.net/quodlibet Quod Libet] reads ReplayGain from (Ogg) [[Vorbis]], [[MP3]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support ReplayGain values stored in [[APEv2]] tags in [[MP3]]s. ReplayGain values are stored in RVA2 id3v2.4 frames. See the [http://www.sacredchao.net/quodlibet/wiki/Development/ID3Notes Quod Libet RVA2 / ReplayGain notes].&lt;br /&gt;
* [http://www.musicpd.org/ Music Player Daemon] (MPD) reads ReplayGain from (Ogg) [[Vorbis]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:foobar2000-style TXXX frames in [[MP3]]s are also supported in the latest development releases.&lt;br /&gt;
* [http://www.mplayerhq.hu/ MPlayer]. Mplayer support for ReplayGain is codec dependent.&lt;br /&gt;
:Codecs that are known to support ReplayGain: vorbis&lt;br /&gt;
:Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line.  To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed.  To prioritize the codecs by default, list them in a line in mplayer.conf:&lt;br /&gt;
 ac=[codec],[othercodec],vorbis,mad,&lt;br /&gt;
* [http://idjc.sourceforge.net/ IDJC] (Internet DJ Console) reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], (Ogg) FLAC, (Ogg) [[Vorbis]], MP2 (audio), [[MP3]], [[Opus]], but only the &#039;&#039;lowercase&#039;&#039; tags. There is a [https://sourceforge.net/p/idjc/bugs/100/ ticket] open to handle tags case-insensitively.&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
* [https://www.videolan.org/vlc/ VLC] supports ReplayGain in many file formats, but usually only the &#039;&#039;uppercase&#039;&#039; variant of the tags.&lt;br /&gt;
* [https://kodi.tv/ KODI] reads ReplayGain from nearly all formats, but usually only the &#039;&#039;lowercase&#039;&#039; variant of the tags.&lt;br /&gt;
&lt;br /&gt;
=== Portable devices ===&lt;br /&gt;
[http://www.rockbox.org/ Rockbox] supports ReplayGain (in album or track mode) for most formats, including  WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey&#039;s Audio, Wavpack, FLAC and Vorbis.  &amp;lt;br&amp;gt;Note that ReplayGain is only supported when using the respective codec&#039;s native tagging format.  For example:  ReplayGain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Fuze with firmware 1.02.26 and 2.02.26&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Clip+&lt;br /&gt;
&lt;br /&gt;
The iPod features &#039;&#039;Soundcheck&#039;&#039;, which seems to produce roughly the same normalization gains as ReplayGain, but doesn&#039;t provide an Album Gain.&lt;br /&gt;
&lt;br /&gt;
=== Hi-Fi ===&lt;br /&gt;
Slim Devices, a company owned by Logitech Inc, supports ReplayGain on both of their hi-end audiophile players, known as the [[Slim Devices Transporter|Transporter]] and the [[Slim Devices Squeezebox|Squeezebox]].&lt;br /&gt;
&lt;br /&gt;
BluOS also supports ReplayGain with the selection of album- or track-gain and a so called Smart option that decides between the two by itself.&lt;br /&gt;
NAD devices that use BluOS consequently also support ReplayGain.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;references/&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[ReplayGain specification]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Replay_Gain ReplayGain] at Wikipedia&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain.html ReplayGain using foobar2000] (how to use ReplayGain in Windows using foobar2000).&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html ReplayGain in Linux] (how to use ReplayGain in Linux using foobar2000 and Wine, or using metaflac or vorbisgain).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[index.php?title=Category:Technical]]&lt;br /&gt;
[[index.php?title=Category:Metadata]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38808</id>
		<title>ReplayGain</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38808"/>
		<updated>2026-01-23T10:25:15Z</updated>

		<summary type="html">&lt;p&gt;Case: /* foobar2000 ReplayGain scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;ReplayGain&#039;&#039;&#039; is the name of a technique invented to achieve the same perceived playback loudness of audio files. It defines an algorithm to measure the &#039;&#039;&#039;perceived&#039;&#039;&#039; loudness of audio data.&lt;br /&gt;
&lt;br /&gt;
ReplayGain allows the loudness of each song within a collection of songs to be consistent. This is called &#039;Track Gain&#039; (or &#039;Radio Gain&#039; in earlier parlance). It also allows the loudness of a specific sub-collection (an &amp;quot;album&amp;quot;) to be consistent with the rest of the collection, while allowing the dynamics from song to song on the album to remain intact. This is called &#039;Album Gain&#039; (or &#039;Audiophile Gain&#039; in earlier parlance). This is especially important when listening to classical music albums, because quiet tracks need to remain a certain degree quieter than the louder ones.&lt;br /&gt;
&lt;br /&gt;
ReplayGain is different from [[Normalization|peak normalization]]. Peak normalization merely ensures that the peak amplitude reaches a certain level. This does not ensure equal loudness. The ReplayGain technique measures the &#039;&#039;effective power&#039;&#039; of the waveform (i.e. the RMS power after applying an &amp;quot;equal loudness contour&amp;quot;), and then adjusts the amplitude of the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified than peak-normalized waveforms.&lt;br /&gt;
&lt;br /&gt;
==Target loudness==&lt;br /&gt;
The target loudness of all ReplayGain utilities is 89&amp;amp;nbsp;dB SPL when replayed in an SMPTE RP 200 calibrated system (an early departure from the proposal, endorsed by its author&amp;lt;ref&amp;gt;[http://www.hydrogenaudio.org/forums/index.php?s=&amp;amp;showtopic=83397&amp;amp;view=findpost&amp;amp;p=721854 Does Replay gain work differtly in Media monkey]&amp;lt;/ref&amp;gt;) &amp;amp;mdash; the ReplayGain proposal and SMPTE recommendation are 6&amp;amp;nbsp;dB lower.&amp;lt;ref&amp;gt;[http://www.mars.org/mailman/public/mad-dev/2004-February/000993.html ReplayGain discussion at mad-dev]&amp;lt;/ref&amp;gt; The target loudness may be more commonly known and understood as &#039;&#039;&#039;-18&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;[https://en.wikipedia.org/wiki/LUFS LUFS]&#039;&#039;&#039; (&#039;&#039;Loudness Units relative to Full Scale&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Some utilities have realized the inadequacies of the classic ReplayGain loudness calculation, switching to a more modern algorithm ([https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en ITU-R BS.1770]). However, the way it was integrated was extremely &#039;&#039;ad hoc&#039;&#039;, at least until a draft of a [[ReplayGain 2.0 specification|revised specification]] started being written.&lt;br /&gt;
&lt;br /&gt;
==Clipping==&lt;br /&gt;
Audio is generally recorded such that the loudest sounds don&#039;t clip, but the use of ReplayGain can cause clipping if the average volume of a song is below the target level. That is, upon playback, the volume of a quiet song is increased, so the parts of the song with above-average loudness, especially in the bass frequencies, will exceed the limits of the format and will be distorted. Whether this distortion is audible depends on the sounds in question, and the listener&#039;s sensitivity.&lt;br /&gt;
&lt;br /&gt;
Implementations deal with the risk of clipping in different ways. Some have a &amp;quot;pre-amp&amp;quot; feature which reduces (or boosts) the original audio&#039;s level by a certain amount before doing whatever is needed for ReplayGain. Some have a &amp;quot;prevent clipping&amp;quot; feature to reduce the amount of ReplayGain adjustment to whatever amount would keep clipping from occurring, based on peak info stored in the file&#039;s metadata (thus reducing the effectiveness of ReplayGain). Some recommend using a compressor/limiter DSP to prevent or reduce clipping, regardless of whether it was caused by ReplayGain.&lt;br /&gt;
&lt;br /&gt;
An alternative that may reduce the risk of clipping is the [https://tech.ebu.ch/docs/r/r128.pdf EBU R 128] recommendation of a -23&amp;amp;nbsp;LUFS target, but that&#039;s a different standard, and some may find the additional reduction in volume excessive, particularly if it leads to maxing out volume on user hardware. [[Opus]] in particular has adopted that standard, using a global gain as well as &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; tags. With ReplayGain, a simple (though somewhat radical) solution is to lower the preamp value by 5&amp;amp;nbsp;dB (or whatever one feels comfortable with) in the playback software. The RG target will always be -18&amp;amp;nbsp;LUFS, regardless of a user&#039;s volume or preamp settings.&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
There are different ReplayGain implementations, each with its own uses and strength. Most use [[metadata]] to indicate the level of the volume change that the player should make. Some modify the audio data itself, and optionally use metadata as well. There are advantages and disadvantages to both methods.&lt;br /&gt;
&lt;br /&gt;
In the metadata method, information on both types of ReplayGain (Track Gain and Album Gain) can be stored. The volume-change information can be very precise. If audio data was also changed, the metadata can contain &amp;quot;undo&amp;quot; info. Not all audio players/decoders know how to read and use ReplayGain information stored in metadata. And there&#039;s no standard for where and how ReplayGain info is stored; each implementation uses different formats and puts the info in different locations.&lt;br /&gt;
&lt;br /&gt;
In the audio data method, the file&#039;s actual audio data is modified so that its natural/default playback volume is at the target level. In this scenario, only one type of ReplayGain (Track Gain or Album Gain) can be applied. If no &amp;quot;undo&amp;quot; info is saved somewhere, it may not be possible to restore the original audio data. Limitations of the audio file format may prevent precise (finely tuned) gain adjustments with this method. For example, MP3 and AAC files can only be losslessly modified in 1.5 dB steps. Depending on the audio file format, the process may also be lossy in the sense that it could irreversibly push a signal above the format&#039;s maximum amplitude (resulting in clipping) or below the minimum (resulting in silence).&lt;br /&gt;
&lt;br /&gt;
=== Old versus new algorithms ===&lt;br /&gt;
Since the ReplayGain standard does not define tags to specify which algorithm was used (classic or ITU-R BS.1770) or what target was set (RG&#039;s -18&amp;amp;nbsp;LUFS, EBU R 128&#039;s -23&amp;amp;nbsp;LUFS, or any other target set by the user or some piece of software), there may be confusion as to how the results were produced. Typically, utilities that ship with reference encoders (FLAC / metaflac, Vorbis / vorbisgain, WavPack / wvgain, Musepack / mpcgain…) use the original RG algorithm, which can produce values that differ from newer tools by several decibels in certain cases. Generally speaking, it is recommended to run other utilities or players that implement the ITU-R BS.1770 algorithm, although it may not be obvious which algorithm they use at first glance. Their documentation may provide that information.&lt;br /&gt;
&lt;br /&gt;
==== RG1, RG2 ====&lt;br /&gt;
Although there are many references online, and within ReplayGain scanners, about version 1 vs. version 2 of the ReplayGain standard, at the time of writing this, there is (admittedly) only one ReplayGain standard. The core principle, as well as the 4 tags from the original specification, have not changed. More tags have been proposed but they are still subject to debate. As a rule of thumb, tools that advertise &amp;quot;ReplayGain&amp;amp;nbsp;2&amp;quot; compliance employ the newer, more accurate ITU-R BS.1770 algorithm. [[foobar2000]] labels it &amp;quot;EBU R128&amp;quot; but it essentially means the same thing. Should a better algorithm be developed in the future, it will still work towards fulfilling ReplayGain&#039;s original goals, and probably write the same tags.&lt;br /&gt;
&lt;br /&gt;
=== MP3Gain ===&lt;br /&gt;
[[MP3Gain]] is an implementation of classic ReplayGain. It can be used to just analyze files &amp;amp; recommend changes or to also modify the gain. If modifying the gain, it always modifies the global gain fields in the MP3 audio data. It can add somewhat precise metadata, including undo info. The gain can be modified to any target dB, or it can be changed by a specified amount. For balance correction, user-specified changes can even be made on just one channel in simple L/R stereo-mode files (not joint stereo).&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]]&lt;br /&gt;
* Method: Audio + Meta (in APE tag), or Audio only&lt;br /&gt;
* APE tag fields (ASCII bytes):&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values for this file. 3 digits, zero-padded if necessary.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_ALBUM_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values across a set of files scanned as an album. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_UNDO +###,+###,N&amp;lt;/code&amp;gt; - the global gain adjustment to restore the original values in the left and right channels, respectively, followed by an indicator of whether to wrap at the extremes (&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; means no, &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; means yes). The adjustment values are 3 digits, zero-padded, preceded by a sign (&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;).&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Examples: &amp;lt;code&amp;gt;+0.424046&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-10.38500&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Example: &amp;lt;code&amp;gt;0.149923&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Optional.&lt;br /&gt;
* Limitations: Although the metadata, if written, contains precise adjustment &amp;amp; peak values, the audio data modifications are limited to 1.5dB steps and may become irreversible (however, that&#039;s a very rare condition; see the [https://hydrogenaud.io/index.php/topic,34154.0.html &amp;quot;mp3gain is NOT lossless&amp;quot; forum thread])&lt;br /&gt;
* http://mp3gain.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== AACGain ===&lt;br /&gt;
[[AACGain]] is a modified version of MP3Gain that works on both MP3 and AAC files.&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]], [[AAC]] (with or without MP4 container)&lt;br /&gt;
* Method: Audio + Meta, or Audio only&lt;br /&gt;
* Limitations: Limited to 1.5dB steps mode, may become irreversible (same caveat as for MP3Gain)&lt;br /&gt;
* http://aacgain.altosdesign.com/&lt;br /&gt;
&lt;br /&gt;
=== [[LAME]] ===&lt;br /&gt;
* Method: Header ([http://gabriel.mp3-tech.org/mp3infotag.html mp3infotag])&lt;br /&gt;
* Notes:&lt;br /&gt;
** Uses the classic RG algorithm.&lt;br /&gt;
** Tags added during encoding; not supported by any player yet; Track Gain only&lt;br /&gt;
** Replay Gaining MP3&#039;s is usually done using MP3Gain (see [[ReplayGain#MP3Gain|above]]) or [[ReplayGain#foobar2000 ReplayGain scanner|foobar2000]]&lt;br /&gt;
* http://lame.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== [[Musepack]] ReplayGain ===&lt;br /&gt;
* Method: Header (similar to Meta data method)&lt;br /&gt;
* Notes: Uses the classic RG algorithm. ReplayGain values are stored in the header and ReplayGain is part of the Musepack specifications; therefore any Musepack decoder that does not support ReplayGain can be considered broken.&lt;br /&gt;
* http://www.musepack.net/&lt;br /&gt;
&lt;br /&gt;
=== VorbisGain ===&lt;br /&gt;
* Format: (Ogg) [[Vorbis]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.sjeng.org/vorbisgain.html&lt;br /&gt;
** new compiles of VorbisGain at [http://www.rarewares.org/ogg.html www.rarewares.org]&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) [[Vorbis#ReplayGain|check this section]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== FLAC / METAFLAC ===&lt;br /&gt;
* Format: [[Free Lossless Audio Codec|FLAC]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://flac.sf.net&lt;br /&gt;
&lt;br /&gt;
=== WavPack / WVGAIN ===&lt;br /&gt;
* Format: [[WavPack]]&lt;br /&gt;
* Method: Meta (in [[APEv2]] tag)&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.wavpack.com&lt;br /&gt;
&lt;br /&gt;
=== Wavegain ===&lt;br /&gt;
* Format: waveform&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* Limitations: Irreversible&lt;br /&gt;
* http://www.rarewares.org/others.php#wavegain&lt;br /&gt;
&lt;br /&gt;
=== MusicPlayer ===&lt;br /&gt;
* Custom implementation, inspired by MP3Gain.&lt;br /&gt;
* Format: any that FFmpeg supports&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Limitations: Doesn&#039;t modify the files at all. Stores the value in own database. Used only for playback.&lt;br /&gt;
* https://github.com/albertz/music-player&lt;br /&gt;
&lt;br /&gt;
=== [[foobar2000]] ReplayGain scanner ===&lt;br /&gt;
* Since v1.1.6, defaults to ITU-R BS.1770 analysis (although it labels it EBU R128), but can be configured to use the &amp;quot;Classic ReplayGain&amp;quot; algorithm instead. The ITU-R BS.1770 implementation uses a reference level of -18&amp;amp;nbsp;LUFS instead of -23, in order to retain compatibility with the ReplayGain standard.&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] (default) or [[APEv2]] tags.&lt;br /&gt;
** [[Musepack]]: Values written to header.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]] and/or file header.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags&lt;br /&gt;
** [[MP4]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain).&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TTA]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** [[WMA]]: Values written to WMA tags.&lt;br /&gt;
** [[WAV]]: Values written to ID3 chunk.&lt;br /&gt;
** [[AIFF]]: Values written to ID3 chunk.&lt;br /&gt;
** Modules ([[MOD]] etc.): Optionally saved into [[APEv2]] tags.&lt;br /&gt;
** Any non-taggable format or format supported by FFmpeg can store RG values in a database or external tag with a component.&lt;br /&gt;
** A separate function can be invoked to apply the tagged Track or Album Gain to the global gain fields in MP3, MP4 (AAC), or Opus files, and rewrite any existing tags to account for the peak change and compensate for the difference from 89&amp;amp;nbsp;dB. The 89&amp;amp;nbsp;dB reference level for tags isn&#039;t configurable, but the reference level applied to the global gain fields is.&lt;br /&gt;
** Can automatically copy Track or Album gain values to Apple&#039;s SoundCheck tag in MP4 files or any format that supports ID3v2 to effectively add ReplayGain support to Apple&#039;s players.&lt;br /&gt;
* https://foobar2000.org/&lt;br /&gt;
&lt;br /&gt;
=== [[MediaMonkey]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[WAV]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[MPC]]: Internal gain Structure.&lt;br /&gt;
* In addition to tags, all ReplayGain values are also stored in MediaMonkey&#039;s MDB database&lt;br /&gt;
* Album/Audiophile ReplayGain not supported until v3.0 (Dec 2007); support during burning &amp;amp; ripping added in 3.1 (Jun 2009)&lt;br /&gt;
* Also capable of (irreversibly) changing the volume of MP3 tracks, similar to [[MP3Gain]]&lt;br /&gt;
* http://www.mediamonkey.com/&lt;br /&gt;
&lt;br /&gt;
=== [[Winamp]] ReplayGain scanner===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in Windows Media Audio tags.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[MP4]]&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
* Support Album/Track Gain&lt;br /&gt;
&lt;br /&gt;
=== [[loudgain]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** MP2, [[MP3]]: Values written to [[ID3v2]] tags (ID3v2.3/ID3v2.4 selectable).&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Speex]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]], based on -23&amp;amp;nbsp;LUFS Opus standard. Only &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; are written, but the calculated &#039;&#039;true peak&#039;&#039; value can still be used to reduce the gain values ([[Clipping]] prevention).&lt;br /&gt;
** [[MP4]], [[M4A]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under &amp;lt;code&amp;gt;----:com.apple.iTunes:…&amp;lt;/code&amp;gt;. This is for [[AAC]] and [[ALAC]] in [[MPEG-4]] containers.&lt;br /&gt;
** [[ASF]], [[Windows Media Audio|WMA]]: Values written to WMA tags, no prefix.&lt;br /&gt;
** [[WAV]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] (ID3v2.3/ID3v2.4 selectable) format. Using the &amp;lt;code&amp;gt;bext&amp;lt;/code&amp;gt; chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.&lt;br /&gt;
** [[Audio Interchange File Format|AIFF]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] format.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[Monkey&#039;s Audio]] (APE): Values written to [[APEv2]] tags.&lt;br /&gt;
* Follows EBU R128, ITU BS.1770 and the [[ReplayGain 2.0 specification|revised ReplayGain specification]].&lt;br /&gt;
* &#039;&#039;Never&#039;&#039; touches the actual audio data but &#039;&#039;only writes RG2 tags&#039;&#039;.&lt;br /&gt;
* Uses &#039;&#039;true peak&#039;&#039; values calculated by oversampling to 192&amp;amp;nbsp;kHz, using a custom polyphase FIR interpolator that will oversample 4x for sample rates &amp;lt; 96&amp;amp;nbsp;kHz, 2x for sample rates &amp;lt; 192&amp;amp;nbsp;kHz and leave the signal unchanged for 192&amp;amp;nbsp;kHz.&lt;br /&gt;
* &#039;&#039;Clipping prevention&#039;&#039; can be used to lower the ReplayGain values to a safe margin (default -1&amp;amp;nbsp;dBTP, can be changed).&lt;br /&gt;
* Many options for special cases: force RG tags upper-/lowercase, add extra tags (LRA, Reference loudness), strip unwanted tag types (APEv2 from MP2/MP3, ID3 from WavPack), tab-delimited table output for analysis with CSV file.&lt;br /&gt;
* &#039;&#039;Linux&#039;&#039; Free and Open Source software, can be installed on &#039;&#039;MacOS&#039;&#039; using &#039;&#039;HomeBrew&#039;&#039;, on &#039;&#039;Windows 10&#039;&#039; using the Linux &#039;&#039;bash&#039;&#039;.&lt;br /&gt;
* Also installs a &amp;lt;code&amp;gt;rgbpm&amp;lt;/code&amp;gt; bash script for mass-tagging, which can be adapted to the user’s needs.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; Loudgain relies on standard libraries like &#039;&#039;TagLib&#039;&#039;. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of &#039;&#039;TagLib&#039;&#039;. Version 1.11.1 had a nasty bug for a while that [https://hydrogenaud.io/index.php/topic,118085.msg974957.html#msg974957 could corrupt Ogg Vorbis files]. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called &amp;lt;code&amp;gt;loudgain.static&amp;lt;/code&amp;gt; in the repo’s &amp;lt;code&amp;gt;/bin&amp;lt;/code&amp;gt; folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).&lt;br /&gt;
* https://github.com/Moonbase59/loudgain&lt;br /&gt;
* Bug tracker: https://github.com/Moonbase59/loudgain/issues&lt;br /&gt;
&lt;br /&gt;
=== [[rsgain]] ===&lt;br /&gt;
rsgain is a newer ReplayGain command line utility designed with a &amp;quot;batteries included&amp;quot; philosophy, use the newer ITU-R BS.1770 algorithm.&lt;br /&gt;
&lt;br /&gt;
Features:&lt;br /&gt;
* Cross-platform Windows&amp;amp;nbsp;/&amp;amp;nbsp;macOS&amp;amp;nbsp;/&amp;amp;nbsp;Linux&lt;br /&gt;
* Supports all popular audio formats&lt;br /&gt;
* Simplified &amp;quot;Easy Mode&amp;quot; command line syntax supports recursive, directory-based scanning&lt;br /&gt;
* Multithreaded scanning option that provides significant speed improvement with full library scans&lt;br /&gt;
* Option to skip files with existing ReplayGain metadata&lt;br /&gt;
* Scan presets allow the user to save advanced settings for consistent use&lt;br /&gt;
&lt;br /&gt;
== Players support ==&lt;br /&gt;
ReplayGain being present in the specs of the FLAC, Musepack, and APE formats, any player that support those formats usually supports ReplayGain.&lt;br /&gt;
&lt;br /&gt;
The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* [[foobar2000]] supports ReplayGain in all possible aspects.&lt;br /&gt;
* [[Winamp]] supports ReplayGain in album or track mode.&lt;br /&gt;
* [[MediaMonkey]] supports ReplayGain, with many configuration options.&lt;br /&gt;
* [[XMPlay]] recently implemented ReplayGain&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...and probably others.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
* [[XMMS]]. Reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], [[Musepack]], (Ogg) [[Vorbis]] ..&lt;br /&gt;
:For [[MP3]], use the CVS version of the [http://xmms-mad.sourceforge.net/ xmms-mad] mp3 plugin (it&#039;s not yet released as binary, furthermore not available in distribs&#039; versions for now. Meanwhile binaries are available here: [http://perso.crans.org/~krempp/xmms-mad/ custom binaries])&lt;br /&gt;
* [[amarok]]. By using the amarok-script [http://kde-apps.org/content/show.php?content=26073 ReplayGain]&lt;br /&gt;
:And possibly others, since [http://developer.kde.org/~wheeler/taglib.html TagLib] added support for [[APEv2]] tags in [[MP3]] files, players using this library (like [[amaroK]] and [[JuK]]) might support that kind of ReplayGain tags in the near future.&lt;br /&gt;
* [http://www.sacredchao.net/quodlibet Quod Libet] reads ReplayGain from (Ogg) [[Vorbis]], [[MP3]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support ReplayGain values stored in [[APEv2]] tags in [[MP3]]s. ReplayGain values are stored in RVA2 id3v2.4 frames. See the [http://www.sacredchao.net/quodlibet/wiki/Development/ID3Notes Quod Libet RVA2 / ReplayGain notes].&lt;br /&gt;
* [http://www.musicpd.org/ Music Player Daemon] (MPD) reads ReplayGain from (Ogg) [[Vorbis]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:foobar2000-style TXXX frames in [[MP3]]s are also supported in the latest development releases.&lt;br /&gt;
* [http://www.mplayerhq.hu/ MPlayer]. Mplayer support for ReplayGain is codec dependent.&lt;br /&gt;
:Codecs that are known to support ReplayGain: vorbis&lt;br /&gt;
:Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line.  To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed.  To prioritize the codecs by default, list them in a line in mplayer.conf:&lt;br /&gt;
 ac=[codec],[othercodec],vorbis,mad,&lt;br /&gt;
* [http://idjc.sourceforge.net/ IDJC] (Internet DJ Console) reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], (Ogg) FLAC, (Ogg) [[Vorbis]], MP2 (audio), [[MP3]], [[Opus]], but only the &#039;&#039;lowercase&#039;&#039; tags. There is a [https://sourceforge.net/p/idjc/bugs/100/ ticket] open to handle tags case-insensitively.&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
* [https://www.videolan.org/vlc/ VLC] supports ReplayGain in many file formats, but usually only the &#039;&#039;uppercase&#039;&#039; variant of the tags.&lt;br /&gt;
* [https://kodi.tv/ KODI] reads ReplayGain from nearly all formats, but usually only the &#039;&#039;lowercase&#039;&#039; variant of the tags.&lt;br /&gt;
&lt;br /&gt;
=== Portable devices ===&lt;br /&gt;
[http://www.rockbox.org/ Rockbox] supports ReplayGain (in album or track mode) for most formats, including  WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey&#039;s Audio, Wavpack, FLAC and Vorbis.  &amp;lt;br&amp;gt;Note that ReplayGain is only supported when using the respective codec&#039;s native tagging format.  For example:  ReplayGain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Fuze with firmware 1.02.26 and 2.02.26&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Clip+&lt;br /&gt;
&lt;br /&gt;
The iPod features &#039;&#039;Soundcheck&#039;&#039;, which seems to produce roughly the same normalization gains as ReplayGain, but doesn&#039;t provide an Album Gain.&lt;br /&gt;
&lt;br /&gt;
=== Hi-Fi ===&lt;br /&gt;
Slim Devices, a company owned by Logitech Inc, supports ReplayGain on both of their hi-end audiophile players, known as the [[Slim Devices Transporter|Transporter]] and the [[Slim Devices Squeezebox|Squeezebox]].&lt;br /&gt;
&lt;br /&gt;
BluOS also supports ReplayGain with the selection of album- or track-gain and a so called Smart option that decides between the two by itself.&lt;br /&gt;
NAD devices that use BluOS consequently also support ReplayGain.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;references/&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[ReplayGain specification]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Replay_Gain ReplayGain] at Wikipedia&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain.html ReplayGain using foobar2000] (how to use ReplayGain in Windows using foobar2000).&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html ReplayGain in Linux] (how to use ReplayGain in Linux using foobar2000 and Wine, or using metaflac or vorbisgain).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[index.php?title=Category:Technical]]&lt;br /&gt;
[[index.php?title=Category:Metadata]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38807</id>
		<title>ReplayGain</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38807"/>
		<updated>2026-01-23T10:24:41Z</updated>

		<summary type="html">&lt;p&gt;Case: /* foobar2000 ReplayGain scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;ReplayGain&#039;&#039;&#039; is the name of a technique invented to achieve the same perceived playback loudness of audio files. It defines an algorithm to measure the &#039;&#039;&#039;perceived&#039;&#039;&#039; loudness of audio data.&lt;br /&gt;
&lt;br /&gt;
ReplayGain allows the loudness of each song within a collection of songs to be consistent. This is called &#039;Track Gain&#039; (or &#039;Radio Gain&#039; in earlier parlance). It also allows the loudness of a specific sub-collection (an &amp;quot;album&amp;quot;) to be consistent with the rest of the collection, while allowing the dynamics from song to song on the album to remain intact. This is called &#039;Album Gain&#039; (or &#039;Audiophile Gain&#039; in earlier parlance). This is especially important when listening to classical music albums, because quiet tracks need to remain a certain degree quieter than the louder ones.&lt;br /&gt;
&lt;br /&gt;
ReplayGain is different from [[Normalization|peak normalization]]. Peak normalization merely ensures that the peak amplitude reaches a certain level. This does not ensure equal loudness. The ReplayGain technique measures the &#039;&#039;effective power&#039;&#039; of the waveform (i.e. the RMS power after applying an &amp;quot;equal loudness contour&amp;quot;), and then adjusts the amplitude of the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified than peak-normalized waveforms.&lt;br /&gt;
&lt;br /&gt;
==Target loudness==&lt;br /&gt;
The target loudness of all ReplayGain utilities is 89&amp;amp;nbsp;dB SPL when replayed in an SMPTE RP 200 calibrated system (an early departure from the proposal, endorsed by its author&amp;lt;ref&amp;gt;[http://www.hydrogenaudio.org/forums/index.php?s=&amp;amp;showtopic=83397&amp;amp;view=findpost&amp;amp;p=721854 Does Replay gain work differtly in Media monkey]&amp;lt;/ref&amp;gt;) &amp;amp;mdash; the ReplayGain proposal and SMPTE recommendation are 6&amp;amp;nbsp;dB lower.&amp;lt;ref&amp;gt;[http://www.mars.org/mailman/public/mad-dev/2004-February/000993.html ReplayGain discussion at mad-dev]&amp;lt;/ref&amp;gt; The target loudness may be more commonly known and understood as &#039;&#039;&#039;-18&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;[https://en.wikipedia.org/wiki/LUFS LUFS]&#039;&#039;&#039; (&#039;&#039;Loudness Units relative to Full Scale&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Some utilities have realized the inadequacies of the classic ReplayGain loudness calculation, switching to a more modern algorithm ([https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en ITU-R BS.1770]). However, the way it was integrated was extremely &#039;&#039;ad hoc&#039;&#039;, at least until a draft of a [[ReplayGain 2.0 specification|revised specification]] started being written.&lt;br /&gt;
&lt;br /&gt;
==Clipping==&lt;br /&gt;
Audio is generally recorded such that the loudest sounds don&#039;t clip, but the use of ReplayGain can cause clipping if the average volume of a song is below the target level. That is, upon playback, the volume of a quiet song is increased, so the parts of the song with above-average loudness, especially in the bass frequencies, will exceed the limits of the format and will be distorted. Whether this distortion is audible depends on the sounds in question, and the listener&#039;s sensitivity.&lt;br /&gt;
&lt;br /&gt;
Implementations deal with the risk of clipping in different ways. Some have a &amp;quot;pre-amp&amp;quot; feature which reduces (or boosts) the original audio&#039;s level by a certain amount before doing whatever is needed for ReplayGain. Some have a &amp;quot;prevent clipping&amp;quot; feature to reduce the amount of ReplayGain adjustment to whatever amount would keep clipping from occurring, based on peak info stored in the file&#039;s metadata (thus reducing the effectiveness of ReplayGain). Some recommend using a compressor/limiter DSP to prevent or reduce clipping, regardless of whether it was caused by ReplayGain.&lt;br /&gt;
&lt;br /&gt;
An alternative that may reduce the risk of clipping is the [https://tech.ebu.ch/docs/r/r128.pdf EBU R 128] recommendation of a -23&amp;amp;nbsp;LUFS target, but that&#039;s a different standard, and some may find the additional reduction in volume excessive, particularly if it leads to maxing out volume on user hardware. [[Opus]] in particular has adopted that standard, using a global gain as well as &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; tags. With ReplayGain, a simple (though somewhat radical) solution is to lower the preamp value by 5&amp;amp;nbsp;dB (or whatever one feels comfortable with) in the playback software. The RG target will always be -18&amp;amp;nbsp;LUFS, regardless of a user&#039;s volume or preamp settings.&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
There are different ReplayGain implementations, each with its own uses and strength. Most use [[metadata]] to indicate the level of the volume change that the player should make. Some modify the audio data itself, and optionally use metadata as well. There are advantages and disadvantages to both methods.&lt;br /&gt;
&lt;br /&gt;
In the metadata method, information on both types of ReplayGain (Track Gain and Album Gain) can be stored. The volume-change information can be very precise. If audio data was also changed, the metadata can contain &amp;quot;undo&amp;quot; info. Not all audio players/decoders know how to read and use ReplayGain information stored in metadata. And there&#039;s no standard for where and how ReplayGain info is stored; each implementation uses different formats and puts the info in different locations.&lt;br /&gt;
&lt;br /&gt;
In the audio data method, the file&#039;s actual audio data is modified so that its natural/default playback volume is at the target level. In this scenario, only one type of ReplayGain (Track Gain or Album Gain) can be applied. If no &amp;quot;undo&amp;quot; info is saved somewhere, it may not be possible to restore the original audio data. Limitations of the audio file format may prevent precise (finely tuned) gain adjustments with this method. For example, MP3 and AAC files can only be losslessly modified in 1.5 dB steps. Depending on the audio file format, the process may also be lossy in the sense that it could irreversibly push a signal above the format&#039;s maximum amplitude (resulting in clipping) or below the minimum (resulting in silence).&lt;br /&gt;
&lt;br /&gt;
=== Old versus new algorithms ===&lt;br /&gt;
Since the ReplayGain standard does not define tags to specify which algorithm was used (classic or ITU-R BS.1770) or what target was set (RG&#039;s -18&amp;amp;nbsp;LUFS, EBU R 128&#039;s -23&amp;amp;nbsp;LUFS, or any other target set by the user or some piece of software), there may be confusion as to how the results were produced. Typically, utilities that ship with reference encoders (FLAC / metaflac, Vorbis / vorbisgain, WavPack / wvgain, Musepack / mpcgain…) use the original RG algorithm, which can produce values that differ from newer tools by several decibels in certain cases. Generally speaking, it is recommended to run other utilities or players that implement the ITU-R BS.1770 algorithm, although it may not be obvious which algorithm they use at first glance. Their documentation may provide that information.&lt;br /&gt;
&lt;br /&gt;
==== RG1, RG2 ====&lt;br /&gt;
Although there are many references online, and within ReplayGain scanners, about version 1 vs. version 2 of the ReplayGain standard, at the time of writing this, there is (admittedly) only one ReplayGain standard. The core principle, as well as the 4 tags from the original specification, have not changed. More tags have been proposed but they are still subject to debate. As a rule of thumb, tools that advertise &amp;quot;ReplayGain&amp;amp;nbsp;2&amp;quot; compliance employ the newer, more accurate ITU-R BS.1770 algorithm. [[foobar2000]] labels it &amp;quot;EBU R128&amp;quot; but it essentially means the same thing. Should a better algorithm be developed in the future, it will still work towards fulfilling ReplayGain&#039;s original goals, and probably write the same tags.&lt;br /&gt;
&lt;br /&gt;
=== MP3Gain ===&lt;br /&gt;
[[MP3Gain]] is an implementation of classic ReplayGain. It can be used to just analyze files &amp;amp; recommend changes or to also modify the gain. If modifying the gain, it always modifies the global gain fields in the MP3 audio data. It can add somewhat precise metadata, including undo info. The gain can be modified to any target dB, or it can be changed by a specified amount. For balance correction, user-specified changes can even be made on just one channel in simple L/R stereo-mode files (not joint stereo).&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]]&lt;br /&gt;
* Method: Audio + Meta (in APE tag), or Audio only&lt;br /&gt;
* APE tag fields (ASCII bytes):&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values for this file. 3 digits, zero-padded if necessary.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_ALBUM_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values across a set of files scanned as an album. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_UNDO +###,+###,N&amp;lt;/code&amp;gt; - the global gain adjustment to restore the original values in the left and right channels, respectively, followed by an indicator of whether to wrap at the extremes (&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; means no, &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; means yes). The adjustment values are 3 digits, zero-padded, preceded by a sign (&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;).&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Examples: &amp;lt;code&amp;gt;+0.424046&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-10.38500&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Example: &amp;lt;code&amp;gt;0.149923&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Optional.&lt;br /&gt;
* Limitations: Although the metadata, if written, contains precise adjustment &amp;amp; peak values, the audio data modifications are limited to 1.5dB steps and may become irreversible (however, that&#039;s a very rare condition; see the [https://hydrogenaud.io/index.php/topic,34154.0.html &amp;quot;mp3gain is NOT lossless&amp;quot; forum thread])&lt;br /&gt;
* http://mp3gain.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== AACGain ===&lt;br /&gt;
[[AACGain]] is a modified version of MP3Gain that works on both MP3 and AAC files.&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]], [[AAC]] (with or without MP4 container)&lt;br /&gt;
* Method: Audio + Meta, or Audio only&lt;br /&gt;
* Limitations: Limited to 1.5dB steps mode, may become irreversible (same caveat as for MP3Gain)&lt;br /&gt;
* http://aacgain.altosdesign.com/&lt;br /&gt;
&lt;br /&gt;
=== [[LAME]] ===&lt;br /&gt;
* Method: Header ([http://gabriel.mp3-tech.org/mp3infotag.html mp3infotag])&lt;br /&gt;
* Notes:&lt;br /&gt;
** Uses the classic RG algorithm.&lt;br /&gt;
** Tags added during encoding; not supported by any player yet; Track Gain only&lt;br /&gt;
** Replay Gaining MP3&#039;s is usually done using MP3Gain (see [[ReplayGain#MP3Gain|above]]) or [[ReplayGain#foobar2000 ReplayGain scanner|foobar2000]]&lt;br /&gt;
* http://lame.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== [[Musepack]] ReplayGain ===&lt;br /&gt;
* Method: Header (similar to Meta data method)&lt;br /&gt;
* Notes: Uses the classic RG algorithm. ReplayGain values are stored in the header and ReplayGain is part of the Musepack specifications; therefore any Musepack decoder that does not support ReplayGain can be considered broken.&lt;br /&gt;
* http://www.musepack.net/&lt;br /&gt;
&lt;br /&gt;
=== VorbisGain ===&lt;br /&gt;
* Format: (Ogg) [[Vorbis]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.sjeng.org/vorbisgain.html&lt;br /&gt;
** new compiles of VorbisGain at [http://www.rarewares.org/ogg.html www.rarewares.org]&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) [[Vorbis#ReplayGain|check this section]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== FLAC / METAFLAC ===&lt;br /&gt;
* Format: [[Free Lossless Audio Codec|FLAC]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://flac.sf.net&lt;br /&gt;
&lt;br /&gt;
=== WavPack / WVGAIN ===&lt;br /&gt;
* Format: [[WavPack]]&lt;br /&gt;
* Method: Meta (in [[APEv2]] tag)&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.wavpack.com&lt;br /&gt;
&lt;br /&gt;
=== Wavegain ===&lt;br /&gt;
* Format: waveform&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* Limitations: Irreversible&lt;br /&gt;
* http://www.rarewares.org/others.php#wavegain&lt;br /&gt;
&lt;br /&gt;
=== MusicPlayer ===&lt;br /&gt;
* Custom implementation, inspired by MP3Gain.&lt;br /&gt;
* Format: any that FFmpeg supports&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Limitations: Doesn&#039;t modify the files at all. Stores the value in own database. Used only for playback.&lt;br /&gt;
* https://github.com/albertz/music-player&lt;br /&gt;
&lt;br /&gt;
=== [[foobar2000]] ReplayGain scanner ===&lt;br /&gt;
* Since v1.1.6, defaults to ITU-R BS.1770 analysis (although it labels it EBU R128), but can be configured to use the &amp;quot;Classic ReplayGain&amp;quot; algorithm instead. The ITU-R BS.1770 implementation uses a reference level of -18&amp;amp;nbsp;LUFS instead of -23, in order to retain compatibility with the ReplayGain standard.&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] (default) or [[APEv2]] tags.&lt;br /&gt;
** [[Musepack]]: Values written to header.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]] and/or file header.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags&lt;br /&gt;
** [[MP4]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). Can write chosen Gain value to Apple&#039;s SoundCheck&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TTA]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** [[WMA]]: Values written to WMA tags.&lt;br /&gt;
** [[WAV]]: Values written to ID3 chunk.&lt;br /&gt;
** [[AIFF]]: Values written to ID3 chunk.&lt;br /&gt;
** Modules ([[MOD]] etc.): Optionally saved into [[APEv2]] tags.&lt;br /&gt;
** Any non-taggable format or format supported by FFmpeg can store RG values in a database or external tag with a component.&lt;br /&gt;
** A separate function can be invoked to apply the tagged Track or Album Gain to the global gain fields in MP3, MP4 (AAC), or Opus files, and rewrite any existing tags to account for the peak change and compensate for the difference from 89&amp;amp;nbsp;dB. The 89&amp;amp;nbsp;dB reference level for tags isn&#039;t configurable, but the reference level applied to the global gain fields is.&lt;br /&gt;
** Can automatically copy Track or Album gain values to Apple&#039;s SoundCheck tag in MP4 files or any format that supports ID3v2 to effectively add ReplayGain support to Apple&#039;s players.&lt;br /&gt;
* https://foobar2000.org/&lt;br /&gt;
&lt;br /&gt;
=== [[MediaMonkey]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[WAV]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[MPC]]: Internal gain Structure.&lt;br /&gt;
* In addition to tags, all ReplayGain values are also stored in MediaMonkey&#039;s MDB database&lt;br /&gt;
* Album/Audiophile ReplayGain not supported until v3.0 (Dec 2007); support during burning &amp;amp; ripping added in 3.1 (Jun 2009)&lt;br /&gt;
* Also capable of (irreversibly) changing the volume of MP3 tracks, similar to [[MP3Gain]]&lt;br /&gt;
* http://www.mediamonkey.com/&lt;br /&gt;
&lt;br /&gt;
=== [[Winamp]] ReplayGain scanner===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in Windows Media Audio tags.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[MP4]]&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
* Support Album/Track Gain&lt;br /&gt;
&lt;br /&gt;
=== [[loudgain]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** MP2, [[MP3]]: Values written to [[ID3v2]] tags (ID3v2.3/ID3v2.4 selectable).&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Speex]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]], based on -23&amp;amp;nbsp;LUFS Opus standard. Only &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; are written, but the calculated &#039;&#039;true peak&#039;&#039; value can still be used to reduce the gain values ([[Clipping]] prevention).&lt;br /&gt;
** [[MP4]], [[M4A]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under &amp;lt;code&amp;gt;----:com.apple.iTunes:…&amp;lt;/code&amp;gt;. This is for [[AAC]] and [[ALAC]] in [[MPEG-4]] containers.&lt;br /&gt;
** [[ASF]], [[Windows Media Audio|WMA]]: Values written to WMA tags, no prefix.&lt;br /&gt;
** [[WAV]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] (ID3v2.3/ID3v2.4 selectable) format. Using the &amp;lt;code&amp;gt;bext&amp;lt;/code&amp;gt; chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.&lt;br /&gt;
** [[Audio Interchange File Format|AIFF]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] format.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[Monkey&#039;s Audio]] (APE): Values written to [[APEv2]] tags.&lt;br /&gt;
* Follows EBU R128, ITU BS.1770 and the [[ReplayGain 2.0 specification|revised ReplayGain specification]].&lt;br /&gt;
* &#039;&#039;Never&#039;&#039; touches the actual audio data but &#039;&#039;only writes RG2 tags&#039;&#039;.&lt;br /&gt;
* Uses &#039;&#039;true peak&#039;&#039; values calculated by oversampling to 192&amp;amp;nbsp;kHz, using a custom polyphase FIR interpolator that will oversample 4x for sample rates &amp;lt; 96&amp;amp;nbsp;kHz, 2x for sample rates &amp;lt; 192&amp;amp;nbsp;kHz and leave the signal unchanged for 192&amp;amp;nbsp;kHz.&lt;br /&gt;
* &#039;&#039;Clipping prevention&#039;&#039; can be used to lower the ReplayGain values to a safe margin (default -1&amp;amp;nbsp;dBTP, can be changed).&lt;br /&gt;
* Many options for special cases: force RG tags upper-/lowercase, add extra tags (LRA, Reference loudness), strip unwanted tag types (APEv2 from MP2/MP3, ID3 from WavPack), tab-delimited table output for analysis with CSV file.&lt;br /&gt;
* &#039;&#039;Linux&#039;&#039; Free and Open Source software, can be installed on &#039;&#039;MacOS&#039;&#039; using &#039;&#039;HomeBrew&#039;&#039;, on &#039;&#039;Windows 10&#039;&#039; using the Linux &#039;&#039;bash&#039;&#039;.&lt;br /&gt;
* Also installs a &amp;lt;code&amp;gt;rgbpm&amp;lt;/code&amp;gt; bash script for mass-tagging, which can be adapted to the user’s needs.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; Loudgain relies on standard libraries like &#039;&#039;TagLib&#039;&#039;. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of &#039;&#039;TagLib&#039;&#039;. Version 1.11.1 had a nasty bug for a while that [https://hydrogenaud.io/index.php/topic,118085.msg974957.html#msg974957 could corrupt Ogg Vorbis files]. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called &amp;lt;code&amp;gt;loudgain.static&amp;lt;/code&amp;gt; in the repo’s &amp;lt;code&amp;gt;/bin&amp;lt;/code&amp;gt; folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).&lt;br /&gt;
* https://github.com/Moonbase59/loudgain&lt;br /&gt;
* Bug tracker: https://github.com/Moonbase59/loudgain/issues&lt;br /&gt;
&lt;br /&gt;
=== [[rsgain]] ===&lt;br /&gt;
rsgain is a newer ReplayGain command line utility designed with a &amp;quot;batteries included&amp;quot; philosophy, use the newer ITU-R BS.1770 algorithm.&lt;br /&gt;
&lt;br /&gt;
Features:&lt;br /&gt;
* Cross-platform Windows&amp;amp;nbsp;/&amp;amp;nbsp;macOS&amp;amp;nbsp;/&amp;amp;nbsp;Linux&lt;br /&gt;
* Supports all popular audio formats&lt;br /&gt;
* Simplified &amp;quot;Easy Mode&amp;quot; command line syntax supports recursive, directory-based scanning&lt;br /&gt;
* Multithreaded scanning option that provides significant speed improvement with full library scans&lt;br /&gt;
* Option to skip files with existing ReplayGain metadata&lt;br /&gt;
* Scan presets allow the user to save advanced settings for consistent use&lt;br /&gt;
&lt;br /&gt;
== Players support ==&lt;br /&gt;
ReplayGain being present in the specs of the FLAC, Musepack, and APE formats, any player that support those formats usually supports ReplayGain.&lt;br /&gt;
&lt;br /&gt;
The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* [[foobar2000]] supports ReplayGain in all possible aspects.&lt;br /&gt;
* [[Winamp]] supports ReplayGain in album or track mode.&lt;br /&gt;
* [[MediaMonkey]] supports ReplayGain, with many configuration options.&lt;br /&gt;
* [[XMPlay]] recently implemented ReplayGain&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...and probably others.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
* [[XMMS]]. Reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], [[Musepack]], (Ogg) [[Vorbis]] ..&lt;br /&gt;
:For [[MP3]], use the CVS version of the [http://xmms-mad.sourceforge.net/ xmms-mad] mp3 plugin (it&#039;s not yet released as binary, furthermore not available in distribs&#039; versions for now. Meanwhile binaries are available here: [http://perso.crans.org/~krempp/xmms-mad/ custom binaries])&lt;br /&gt;
* [[amarok]]. By using the amarok-script [http://kde-apps.org/content/show.php?content=26073 ReplayGain]&lt;br /&gt;
:And possibly others, since [http://developer.kde.org/~wheeler/taglib.html TagLib] added support for [[APEv2]] tags in [[MP3]] files, players using this library (like [[amaroK]] and [[JuK]]) might support that kind of ReplayGain tags in the near future.&lt;br /&gt;
* [http://www.sacredchao.net/quodlibet Quod Libet] reads ReplayGain from (Ogg) [[Vorbis]], [[MP3]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support ReplayGain values stored in [[APEv2]] tags in [[MP3]]s. ReplayGain values are stored in RVA2 id3v2.4 frames. See the [http://www.sacredchao.net/quodlibet/wiki/Development/ID3Notes Quod Libet RVA2 / ReplayGain notes].&lt;br /&gt;
* [http://www.musicpd.org/ Music Player Daemon] (MPD) reads ReplayGain from (Ogg) [[Vorbis]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:foobar2000-style TXXX frames in [[MP3]]s are also supported in the latest development releases.&lt;br /&gt;
* [http://www.mplayerhq.hu/ MPlayer]. Mplayer support for ReplayGain is codec dependent.&lt;br /&gt;
:Codecs that are known to support ReplayGain: vorbis&lt;br /&gt;
:Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line.  To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed.  To prioritize the codecs by default, list them in a line in mplayer.conf:&lt;br /&gt;
 ac=[codec],[othercodec],vorbis,mad,&lt;br /&gt;
* [http://idjc.sourceforge.net/ IDJC] (Internet DJ Console) reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], (Ogg) FLAC, (Ogg) [[Vorbis]], MP2 (audio), [[MP3]], [[Opus]], but only the &#039;&#039;lowercase&#039;&#039; tags. There is a [https://sourceforge.net/p/idjc/bugs/100/ ticket] open to handle tags case-insensitively.&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
* [https://www.videolan.org/vlc/ VLC] supports ReplayGain in many file formats, but usually only the &#039;&#039;uppercase&#039;&#039; variant of the tags.&lt;br /&gt;
* [https://kodi.tv/ KODI] reads ReplayGain from nearly all formats, but usually only the &#039;&#039;lowercase&#039;&#039; variant of the tags.&lt;br /&gt;
&lt;br /&gt;
=== Portable devices ===&lt;br /&gt;
[http://www.rockbox.org/ Rockbox] supports ReplayGain (in album or track mode) for most formats, including  WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey&#039;s Audio, Wavpack, FLAC and Vorbis.  &amp;lt;br&amp;gt;Note that ReplayGain is only supported when using the respective codec&#039;s native tagging format.  For example:  ReplayGain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Fuze with firmware 1.02.26 and 2.02.26&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Clip+&lt;br /&gt;
&lt;br /&gt;
The iPod features &#039;&#039;Soundcheck&#039;&#039;, which seems to produce roughly the same normalization gains as ReplayGain, but doesn&#039;t provide an Album Gain.&lt;br /&gt;
&lt;br /&gt;
=== Hi-Fi ===&lt;br /&gt;
Slim Devices, a company owned by Logitech Inc, supports ReplayGain on both of their hi-end audiophile players, known as the [[Slim Devices Transporter|Transporter]] and the [[Slim Devices Squeezebox|Squeezebox]].&lt;br /&gt;
&lt;br /&gt;
BluOS also supports ReplayGain with the selection of album- or track-gain and a so called Smart option that decides between the two by itself.&lt;br /&gt;
NAD devices that use BluOS consequently also support ReplayGain.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;references/&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[ReplayGain specification]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Replay_Gain ReplayGain] at Wikipedia&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain.html ReplayGain using foobar2000] (how to use ReplayGain in Windows using foobar2000).&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html ReplayGain in Linux] (how to use ReplayGain in Linux using foobar2000 and Wine, or using metaflac or vorbisgain).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[index.php?title=Category:Technical]]&lt;br /&gt;
[[index.php?title=Category:Metadata]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38804</id>
		<title>ReplayGain</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38804"/>
		<updated>2026-01-23T08:18:48Z</updated>

		<summary type="html">&lt;p&gt;Case: /* foobar2000 ReplayGain scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;ReplayGain&#039;&#039;&#039; is the name of a technique invented to achieve the same perceived playback loudness of audio files. It defines an algorithm to measure the &#039;&#039;&#039;perceived&#039;&#039;&#039; loudness of audio data.&lt;br /&gt;
&lt;br /&gt;
ReplayGain allows the loudness of each song within a collection of songs to be consistent. This is called &#039;Track Gain&#039; (or &#039;Radio Gain&#039; in earlier parlance). It also allows the loudness of a specific sub-collection (an &amp;quot;album&amp;quot;) to be consistent with the rest of the collection, while allowing the dynamics from song to song on the album to remain intact. This is called &#039;Album Gain&#039; (or &#039;Audiophile Gain&#039; in earlier parlance). This is especially important when listening to classical music albums, because quiet tracks need to remain a certain degree quieter than the louder ones.&lt;br /&gt;
&lt;br /&gt;
ReplayGain is different from [[Normalization|peak normalization]]. Peak normalization merely ensures that the peak amplitude reaches a certain level. This does not ensure equal loudness. The ReplayGain technique measures the &#039;&#039;effective power&#039;&#039; of the waveform (i.e. the RMS power after applying an &amp;quot;equal loudness contour&amp;quot;), and then adjusts the amplitude of the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified than peak-normalized waveforms.&lt;br /&gt;
&lt;br /&gt;
==Target loudness==&lt;br /&gt;
The target loudness of almost all ReplayGain utilities is 89&amp;amp;nbsp;dB SPL when replayed in an SMPTE RP 200 calibrated system (an early departure from the proposal, endorsed by its author&amp;lt;ref&amp;gt;[http://www.hydrogenaudio.org/forums/index.php?s=&amp;amp;showtopic=83397&amp;amp;view=findpost&amp;amp;p=721854 Does Replay gain work differtly in Media monkey]&amp;lt;/ref&amp;gt;) &amp;amp;mdash; the ReplayGain proposal and SMPTE recommendation are 6&amp;amp;nbsp;dB lower.&amp;lt;ref&amp;gt;[http://www.mars.org/mailman/public/mad-dev/2004-February/000993.html ReplayGain discussion at mad-dev]&amp;lt;/ref&amp;gt; The target loudness may be more commonly known and understood as &#039;&#039;&#039;-18&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;[https://en.wikipedia.org/wiki/LUFS LUFS]&#039;&#039;&#039; (&#039;&#039;Loudness Units relative to Full Scale&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Some utilities have realized the inadequacies of the classic ReplayGain loudness calculation, switching to a more modern algorithm ([https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en ITU-R BS.1770]). However, the way it was integrated was extremely &#039;&#039;ad hoc&#039;&#039;, at least until a draft of a [[ReplayGain 2.0 specification|revised specification]] started being written.&lt;br /&gt;
&lt;br /&gt;
==Clipping==&lt;br /&gt;
Audio is generally recorded such that the loudest sounds don&#039;t clip, but the use of ReplayGain can cause clipping if the average volume of a song is below the target level. That is, upon playback, the volume of a quiet song is increased, so the parts of the song with above-average loudness, especially in the bass frequencies, will exceed the limits of the format and will be distorted. Whether this distortion is audible depends on the sounds in question, and the listener&#039;s sensitivity.&lt;br /&gt;
&lt;br /&gt;
Implementations deal with the risk of clipping in different ways. Some have a &amp;quot;pre-amp&amp;quot; feature which reduces (or boosts) the original audio&#039;s level by a certain amount before doing whatever is needed for ReplayGain. Some have a &amp;quot;prevent clipping&amp;quot; feature to reduce the amount of ReplayGain adjustment to whatever amount would keep clipping from occurring, based on peak info stored in the file&#039;s metadata (thus reducing the effectiveness of ReplayGain). Some recommend using a compressor/limiter DSP to prevent or reduce clipping, regardless of whether it was caused by ReplayGain.&lt;br /&gt;
&lt;br /&gt;
An alternative that may reduce the risk of clipping is the [https://tech.ebu.ch/docs/r/r128.pdf EBU R 128] recommendation of a &#039;&#039;&#039;-23&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;LUFS&#039;&#039;&#039; target, although some may find the additional reduction in volume excessive, particularly if it leads to maxing out volume on user hardware. [[Opus]] in particular has adopted that recommendation.&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
There are different ReplayGain implementations, each with its own uses and strength. Most use [[metadata]] to indicate the level of the volume change that the player should make. Some modify the audio data itself, and optionally use metadata as well. There are advantages and disadvantages to both methods.&lt;br /&gt;
&lt;br /&gt;
In the metadata method, information on both types of ReplayGain (Track Gain and Album Gain) can be stored. The volume-change information can be very precise. If audio data was also changed, the metadata can contain &amp;quot;undo&amp;quot; info. Not all audio players/decoders know how to read and use ReplayGain information stored in metadata. And there&#039;s no standard for where and how ReplayGain info is stored; each implementation uses different formats and puts the info in different locations.&lt;br /&gt;
&lt;br /&gt;
In the audio data method, the file&#039;s actual audio data is modified so that its natural/default playback volume is at the target level. In this scenario, only one type of ReplayGain (Track Gain or Album Gain) can be applied. If no &amp;quot;undo&amp;quot; info is saved somewhere, it may not be possible to restore the original audio data. Limitations of the audio file format may prevent precise (finely tuned) gain adjustments with this method. For example, MP3 and AAC files can only be losslessly modified in 1.5 dB steps. Depending on the audio file format, the process may also be lossy in the sense that it could irreversibly push a signal above the format&#039;s maximum amplitude (resulting in clipping) or below the minimum (resulting in silence).&lt;br /&gt;
&lt;br /&gt;
=== Old versus new algorithms ===&lt;br /&gt;
Since the ReplayGain standard does not define tags to specify which algorithm was used (classic or ITU-R BS.1770) or what target was set (RG&#039;s -18&amp;amp;nbsp;LUFS, EBU R 128&#039;s -23&amp;amp;nbsp;LUFS, or any other target set by the user or some piece of software), there may be confusion as to how the results were produced. Typically, utilities that ship with reference encoders (FLAC / metaflac, Vorbis / vorbisgain, WavPack / wvgain, Musepack / mpcgain…) use the original RG algorithm, which can produce values that differ from newer tools by several decibels in certain cases. Generally speaking, it is recommended to run other utilities or players that implement the ITU-R BS.1770 algorithm, although it may not be obvious which algorithm they use at first glance. Their documentation may provide that information.&lt;br /&gt;
&lt;br /&gt;
==== RG1, RG2 ====&lt;br /&gt;
Although there are many references online, and within ReplayGain scanners, about version 1 vs. version 2 of the ReplayGain standard, at the time of writing this, there is (admittedly) only one ReplayGain standard. The core principle, as well as the 4 tags from the original specification, have not changed. More tags have been proposed but they are still subject to debate. As a rule of thumb, tools that advertise &amp;quot;ReplayGain&amp;amp;nbsp;2&amp;quot; compliance employ the newer, more accurate ITU-R BS.1770 algorithm. [[foobar2000]] labels it &amp;quot;EBU R128&amp;quot; but it essentially means the same thing. Should a better algorithm be developed in the future, it will still work towards fulfilling ReplayGain&#039;s original goals, and probably write the same tags.&lt;br /&gt;
&lt;br /&gt;
=== MP3Gain ===&lt;br /&gt;
[[MP3Gain]] is an implementation of classic ReplayGain. It can be used to just analyze files &amp;amp; recommend changes or to also modify the gain. If modifying the gain, it always modifies the global gain fields in the MP3 audio data. It can add somewhat precise metadata, including undo info. The gain can be modified to any target dB, or it can be changed by a specified amount. For balance correction, user-specified changes can even be made on just one channel in simple L/R stereo-mode files (not joint stereo).&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]]&lt;br /&gt;
* Method: Audio + Meta (in APE tag), or Audio only&lt;br /&gt;
* APE tag fields (ASCII bytes):&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values for this file. 3 digits, zero-padded if necessary.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_ALBUM_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values across a set of files scanned as an album. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_UNDO +###,+###,N&amp;lt;/code&amp;gt; - the global gain adjustment to restore the original values in the left and right channels, respectively, followed by an indicator of whether to wrap at the extremes (&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; means no, &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; means yes). The adjustment values are 3 digits, zero-padded, preceded by a sign (&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;).&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Examples: &amp;lt;code&amp;gt;+0.424046&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-10.38500&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Example: &amp;lt;code&amp;gt;0.149923&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Optional.&lt;br /&gt;
* Limitations: Although the metadata, if written, contains precise adjustment &amp;amp; peak values, the audio data modifications are limited to 1.5dB steps and may become irreversible (however, that&#039;s a very rare condition; see the [https://hydrogenaud.io/index.php/topic,34154.0.html &amp;quot;mp3gain is NOT lossless&amp;quot; forum thread])&lt;br /&gt;
* http://mp3gain.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== AACGain ===&lt;br /&gt;
[[AACGain]] is a modified version of MP3Gain that works on both MP3 and AAC files.&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]], [[AAC]] (with or without MP4 container)&lt;br /&gt;
* Method: Audio + Meta, or Audio only&lt;br /&gt;
* Limitations: Limited to 1.5dB steps mode, may become irreversible (same caveat as for MP3Gain)&lt;br /&gt;
* http://aacgain.altosdesign.com/&lt;br /&gt;
&lt;br /&gt;
=== [[LAME]] ===&lt;br /&gt;
* Method: Header ([http://gabriel.mp3-tech.org/mp3infotag.html mp3infotag])&lt;br /&gt;
* Notes:&lt;br /&gt;
** Uses the classic RG algorithm.&lt;br /&gt;
** Tags added during encoding; not supported by any player yet; Track Gain only&lt;br /&gt;
** Replay Gaining MP3&#039;s is usually done using MP3Gain (see [[ReplayGain#MP3Gain|above]]) or [[ReplayGain#foobar2000 ReplayGain scanner|foobar2000]]&lt;br /&gt;
* http://lame.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== [[Musepack]] ReplayGain ===&lt;br /&gt;
* Method: Header (similar to Meta data method)&lt;br /&gt;
* Notes: Uses the classic RG algorithm. ReplayGain values are stored in the header and ReplayGain is part of the Musepack specifications; therefore any Musepack decoder that does not support ReplayGain can be considered broken.&lt;br /&gt;
* http://www.musepack.net/&lt;br /&gt;
&lt;br /&gt;
=== VorbisGain ===&lt;br /&gt;
* Format: (Ogg) [[Vorbis]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.sjeng.org/vorbisgain.html&lt;br /&gt;
** new compiles of VorbisGain at [http://www.rarewares.org/ogg.html www.rarewares.org]&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) [[Vorbis#ReplayGain|check this section]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== FLAC / METAFLAC ===&lt;br /&gt;
* Format: [[Free Lossless Audio Codec|FLAC]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://flac.sf.net&lt;br /&gt;
&lt;br /&gt;
=== WavPack / WVGAIN ===&lt;br /&gt;
* Format: [[WavPack]]&lt;br /&gt;
* Method: Meta (in [[APEv2]] tag)&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.wavpack.com&lt;br /&gt;
&lt;br /&gt;
=== Wavegain ===&lt;br /&gt;
* Format: waveform&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* Limitations: Irreversible&lt;br /&gt;
* http://www.rarewares.org/others.php#wavegain&lt;br /&gt;
&lt;br /&gt;
=== MusicPlayer ===&lt;br /&gt;
* Custom implementation, inspired by MP3Gain.&lt;br /&gt;
* Format: any that FFmpeg supports&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Limitations: Doesn&#039;t modify the files at all. Stores the value in own database. Used only for playback.&lt;br /&gt;
* https://github.com/albertz/music-player&lt;br /&gt;
&lt;br /&gt;
=== [[foobar2000]] ReplayGain scanner ===&lt;br /&gt;
* Since v1.1.6, defaults to ITU-R BS.1770 analysis (although it labels it EBU R128), but can be configured to use the &amp;quot;Classic ReplayGain&amp;quot; algorithm instead. The ITU-R BS.1770 implementation uses a reference level of -18&amp;amp;nbsp;LUFS instead of -23, in order to retain compatibility with the ReplayGain standard.&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] (default) or [[APEv2]] tags.&lt;br /&gt;
** [[Musepack]]: Values written to header.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]] and/or file header.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags. As with MP3, it is also an option to apply gain via a separate function.&lt;br /&gt;
** [[MP4]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). Can write chosen Gain value to Apple&#039;s SoundCheck&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TTA]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** [[WMA]]: Values written to WMA tags.&lt;br /&gt;
** Modules ([[MOD]] etc.): Optionally saved into [[APEv2]] tags.&lt;br /&gt;
** Any non-taggable format or format supported by FFmpeg can store RG values in a database or external tag with a component.&lt;br /&gt;
** A separate function can be invoked to apply the tagged Track or Album Gain to the global gain fields in MP3, MP4 (AAC), or Opus files, and rewrite any existing tags to account for the peak change and compensate for the difference from 89&amp;amp;nbsp;dB. The 89&amp;amp;nbsp;dB reference level for tags isn&#039;t configurable, but the reference level applied to the global gain fields is.&lt;br /&gt;
** Can automatically copy Track or Album gain values to Apple&#039;s SoundCheck tag in MP4 files or any format that supports ID3v2 to effectively add ReplayGain support to Apple&#039;s players.&lt;br /&gt;
* https://foobar2000.org/&lt;br /&gt;
&lt;br /&gt;
=== [[MediaMonkey]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[WAV]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[MPC]]: Internal gain Structure.&lt;br /&gt;
* In addition to tags, all ReplayGain values are also stored in MediaMonkey&#039;s MDB database&lt;br /&gt;
* Album/Audiophile ReplayGain not supported until v3.0 (Dec 2007); support during burning &amp;amp; ripping added in 3.1 (Jun 2009)&lt;br /&gt;
* Also capable of (irreversibly) changing the volume of MP3 tracks, similar to [[MP3Gain]]&lt;br /&gt;
* http://www.mediamonkey.com/&lt;br /&gt;
&lt;br /&gt;
=== [[Winamp]] ReplayGain scanner===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in Windows Media Audio tags.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[MP4]]&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
* Support Album/Track Gain&lt;br /&gt;
&lt;br /&gt;
=== [[loudgain]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** MP2, [[MP3]]: Values written to [[ID3v2]] tags (ID3v2.3/ID3v2.4 selectable).&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Speex]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]], based on -23&amp;amp;nbsp;LUFS Opus standard. Only &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; are written, but the calculated &#039;&#039;true peak&#039;&#039; value can still be used to reduce the gain values ([[Clipping]] prevention).&lt;br /&gt;
** [[MP4]], [[M4A]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under &amp;lt;code&amp;gt;----:com.apple.iTunes:…&amp;lt;/code&amp;gt;. This is for [[AAC]] and [[ALAC]] in [[MPEG-4]] containers.&lt;br /&gt;
** [[ASF]], [[Windows Media Audio|WMA]]: Values written to WMA tags, no prefix.&lt;br /&gt;
** [[WAV]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] (ID3v2.3/ID3v2.4 selectable) format. Using the &amp;lt;code&amp;gt;bext&amp;lt;/code&amp;gt; chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.&lt;br /&gt;
** [[Audio Interchange File Format|AIFF]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] format.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[Monkey&#039;s Audio]] (APE): Values written to [[APEv2]] tags.&lt;br /&gt;
* Follows EBU R128, ITU BS.1770 and the [[ReplayGain 2.0 specification|revised ReplayGain specification]].&lt;br /&gt;
* &#039;&#039;Never&#039;&#039; touches the actual audio data but &#039;&#039;only writes RG2 tags&#039;&#039;.&lt;br /&gt;
* Uses &#039;&#039;true peak&#039;&#039; values calculated by oversampling to 192&amp;amp;nbsp;kHz, using a custom polyphase FIR interpolator that will oversample 4x for sample rates &amp;lt; 96&amp;amp;nbsp;kHz, 2x for sample rates &amp;lt; 192&amp;amp;nbsp;kHz and leave the signal unchanged for 192&amp;amp;nbsp;kHz.&lt;br /&gt;
* &#039;&#039;Clipping prevention&#039;&#039; can be used to lower the ReplayGain values to a safe margin (default -1&amp;amp;nbsp;dBTP, can be changed).&lt;br /&gt;
* Many options for special cases: force RG tags upper-/lowercase, add extra tags (LRA, Reference loudness), strip unwanted tag types (APEv2 from MP2/MP3, ID3 from WavPack), tab-delimited table output for analysis with CSV file.&lt;br /&gt;
* &#039;&#039;Linux&#039;&#039; Free and Open Source software, can be installed on &#039;&#039;MacOS&#039;&#039; using &#039;&#039;HomeBrew&#039;&#039;, on &#039;&#039;Windows 10&#039;&#039; using the Linux &#039;&#039;bash&#039;&#039;.&lt;br /&gt;
* Also installs a &amp;lt;code&amp;gt;rgbpm&amp;lt;/code&amp;gt; bash script for mass-tagging, which can be adapted to the user’s needs.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; Loudgain relies on standard libraries like &#039;&#039;TagLib&#039;&#039;. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of &#039;&#039;TagLib&#039;&#039;. Version 1.11.1 had a nasty bug for a while that [https://hydrogenaud.io/index.php/topic,118085.msg974957.html#msg974957 could corrupt Ogg Vorbis files]. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called &amp;lt;code&amp;gt;loudgain.static&amp;lt;/code&amp;gt; in the repo’s &amp;lt;code&amp;gt;/bin&amp;lt;/code&amp;gt; folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).&lt;br /&gt;
* https://github.com/Moonbase59/loudgain&lt;br /&gt;
* Bug tracker: https://github.com/Moonbase59/loudgain/issues&lt;br /&gt;
&lt;br /&gt;
=== [[rsgain]] ===&lt;br /&gt;
rsgain is a newer ReplayGain command line utility designed with a &amp;quot;batteries included&amp;quot; philosophy, use the newer ITU-R BS.1770 algorithm.&lt;br /&gt;
&lt;br /&gt;
Features:&lt;br /&gt;
* Cross-platform Windows&amp;amp;nbsp;/&amp;amp;nbsp;macOS&amp;amp;nbsp;/&amp;amp;nbsp;Linux&lt;br /&gt;
* Supports all popular audio formats&lt;br /&gt;
* Simplified &amp;quot;Easy Mode&amp;quot; command line syntax supports recursive, directory-based scanning&lt;br /&gt;
* Multithreaded scanning option that provides significant speed improvement with full library scans&lt;br /&gt;
* Option to skip files with existing ReplayGain metadata&lt;br /&gt;
* Scan presets allow the user to save advanced settings for consistent use&lt;br /&gt;
&lt;br /&gt;
== Players support ==&lt;br /&gt;
ReplayGain being present in the specs of the FLAC, Musepack, and APE formats, any player that support those formats usually supports ReplayGain.&lt;br /&gt;
&lt;br /&gt;
The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* [[foobar2000]] supports ReplayGain in all possible aspects.&lt;br /&gt;
* [[Winamp]] supports ReplayGain in album or track mode.&lt;br /&gt;
* [[MediaMonkey]] supports ReplayGain, with many configuration options.&lt;br /&gt;
* [[XMPlay]] recently implemented ReplayGain&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...and probably others.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
* [[XMMS]]. Reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], [[Musepack]], (Ogg) [[Vorbis]] ..&lt;br /&gt;
:For [[MP3]], use the CVS version of the [http://xmms-mad.sourceforge.net/ xmms-mad] mp3 plugin (it&#039;s not yet released as binary, furthermore not available in distribs&#039; versions for now. Meanwhile binaries are available here: [http://perso.crans.org/~krempp/xmms-mad/ custom binaries])&lt;br /&gt;
* [[amarok]]. By using the amarok-script [http://kde-apps.org/content/show.php?content=26073 ReplayGain]&lt;br /&gt;
:And possibly others, since [http://developer.kde.org/~wheeler/taglib.html TagLib] added support for [[APEv2]] tags in [[MP3]] files, players using this library (like [[amaroK]] and [[JuK]]) might support that kind of ReplayGain tags in the near future.&lt;br /&gt;
* [http://www.sacredchao.net/quodlibet Quod Libet] reads ReplayGain from (Ogg) [[Vorbis]], [[MP3]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support ReplayGain values stored in [[APEv2]] tags in [[MP3]]s. ReplayGain values are stored in RVA2 id3v2.4 frames. See the [http://www.sacredchao.net/quodlibet/wiki/Development/ID3Notes Quod Libet RVA2 / ReplayGain notes].&lt;br /&gt;
* [http://www.musicpd.org/ Music Player Daemon] (MPD) reads ReplayGain from (Ogg) [[Vorbis]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:foobar2000-style TXXX frames in [[MP3]]s are also supported in the latest development releases.&lt;br /&gt;
* [http://www.mplayerhq.hu/ MPlayer]. Mplayer support for ReplayGain is codec dependent.&lt;br /&gt;
:Codecs that are known to support ReplayGain: vorbis&lt;br /&gt;
:Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line.  To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed.  To prioritize the codecs by default, list them in a line in mplayer.conf:&lt;br /&gt;
 ac=[codec],[othercodec],vorbis,mad,&lt;br /&gt;
* [http://idjc.sourceforge.net/ IDJC] (Internet DJ Console) reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], (Ogg) FLAC, (Ogg) [[Vorbis]], MP2 (audio), [[MP3]], [[Opus]], but only the &#039;&#039;lowercase&#039;&#039; tags. There is a [https://sourceforge.net/p/idjc/bugs/100/ ticket] open to handle tags case-insensitively.&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
* [https://www.videolan.org/vlc/ VLC] supports ReplayGain in many file formats, but usually only the &#039;&#039;uppercase&#039;&#039; variant of the tags.&lt;br /&gt;
* [https://kodi.tv/ KODI] reads ReplayGain from nearly all formats, but usually only the &#039;&#039;lowercase&#039;&#039; variant of the tags.&lt;br /&gt;
&lt;br /&gt;
=== Portable devices ===&lt;br /&gt;
[http://www.rockbox.org/ Rockbox] supports ReplayGain (in album or track mode) for most formats, including  WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey&#039;s Audio, Wavpack, FLAC and Vorbis.  &amp;lt;br&amp;gt;Note that ReplayGain is only supported when using the respective codec&#039;s native tagging format.  For example:  ReplayGain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Fuze with firmware 1.02.26 and 2.02.26&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Clip+&lt;br /&gt;
&lt;br /&gt;
The iPod features &#039;&#039;Soundcheck&#039;&#039;, which seems to produce roughly the same normalization gains as ReplayGain, but doesn&#039;t provide an Album Gain.&lt;br /&gt;
&lt;br /&gt;
=== Hi-Fi ===&lt;br /&gt;
Slim Devices, a company owned by Logitech Inc, supports ReplayGain on both of their hi-end audiophile players, known as the [[Slim Devices Transporter|Transporter]] and the [[Slim Devices Squeezebox|Squeezebox]].&lt;br /&gt;
&lt;br /&gt;
BluOS also supports ReplayGain with the selection of album- or track-gain and a so called Smart option that decides between the two by itself.&lt;br /&gt;
NAD devices that use BluOS consequently also support ReplayGain.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;references/&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[ReplayGain specification]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Replay_Gain ReplayGain] at Wikipedia&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain.html ReplayGain using foobar2000] (how to use ReplayGain in Windows using foobar2000).&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html ReplayGain in Linux] (how to use ReplayGain in Linux using foobar2000 and Wine, or using metaflac or vorbisgain).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[index.php?title=Category:Technical]]&lt;br /&gt;
[[index.php?title=Category:Metadata]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38803</id>
		<title>ReplayGain</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38803"/>
		<updated>2026-01-23T08:14:08Z</updated>

		<summary type="html">&lt;p&gt;Case: /* foobar2000 ReplayGain scanner */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;ReplayGain&#039;&#039;&#039; is the name of a technique invented to achieve the same perceived playback loudness of audio files. It defines an algorithm to measure the &#039;&#039;&#039;perceived&#039;&#039;&#039; loudness of audio data.&lt;br /&gt;
&lt;br /&gt;
ReplayGain allows the loudness of each song within a collection of songs to be consistent. This is called &#039;Track Gain&#039; (or &#039;Radio Gain&#039; in earlier parlance). It also allows the loudness of a specific sub-collection (an &amp;quot;album&amp;quot;) to be consistent with the rest of the collection, while allowing the dynamics from song to song on the album to remain intact. This is called &#039;Album Gain&#039; (or &#039;Audiophile Gain&#039; in earlier parlance). This is especially important when listening to classical music albums, because quiet tracks need to remain a certain degree quieter than the louder ones.&lt;br /&gt;
&lt;br /&gt;
ReplayGain is different from [[Normalization|peak normalization]]. Peak normalization merely ensures that the peak amplitude reaches a certain level. This does not ensure equal loudness. The ReplayGain technique measures the &#039;&#039;effective power&#039;&#039; of the waveform (i.e. the RMS power after applying an &amp;quot;equal loudness contour&amp;quot;), and then adjusts the amplitude of the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified than peak-normalized waveforms.&lt;br /&gt;
&lt;br /&gt;
==Target loudness==&lt;br /&gt;
The target loudness of almost all ReplayGain utilities is 89&amp;amp;nbsp;dB SPL when replayed in an SMPTE RP 200 calibrated system (an early departure from the proposal, endorsed by its author&amp;lt;ref&amp;gt;[http://www.hydrogenaudio.org/forums/index.php?s=&amp;amp;showtopic=83397&amp;amp;view=findpost&amp;amp;p=721854 Does Replay gain work differtly in Media monkey]&amp;lt;/ref&amp;gt;) &amp;amp;mdash; the ReplayGain proposal and SMPTE recommendation are 6&amp;amp;nbsp;dB lower.&amp;lt;ref&amp;gt;[http://www.mars.org/mailman/public/mad-dev/2004-February/000993.html ReplayGain discussion at mad-dev]&amp;lt;/ref&amp;gt; The target loudness may be more commonly known and understood as &#039;&#039;&#039;-18&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;[https://en.wikipedia.org/wiki/LUFS LUFS]&#039;&#039;&#039; (&#039;&#039;Loudness Units relative to Full Scale&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Some utilities have realized the inadequacies of the classic ReplayGain loudness calculation, switching to a more modern algorithm ([https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en ITU-R BS.1770]). However, the way it was integrated was extremely &#039;&#039;ad hoc&#039;&#039;, at least until a draft of a [[ReplayGain 2.0 specification|revised specification]] started being written.&lt;br /&gt;
&lt;br /&gt;
==Clipping==&lt;br /&gt;
Audio is generally recorded such that the loudest sounds don&#039;t clip, but the use of ReplayGain can cause clipping if the average volume of a song is below the target level. That is, upon playback, the volume of a quiet song is increased, so the parts of the song with above-average loudness, especially in the bass frequencies, will exceed the limits of the format and will be distorted. Whether this distortion is audible depends on the sounds in question, and the listener&#039;s sensitivity.&lt;br /&gt;
&lt;br /&gt;
Implementations deal with the risk of clipping in different ways. Some have a &amp;quot;pre-amp&amp;quot; feature which reduces (or boosts) the original audio&#039;s level by a certain amount before doing whatever is needed for ReplayGain. Some have a &amp;quot;prevent clipping&amp;quot; feature to reduce the amount of ReplayGain adjustment to whatever amount would keep clipping from occurring, based on peak info stored in the file&#039;s metadata (thus reducing the effectiveness of ReplayGain). Some recommend using a compressor/limiter DSP to prevent or reduce clipping, regardless of whether it was caused by ReplayGain.&lt;br /&gt;
&lt;br /&gt;
An alternative that may reduce the risk of clipping is the [https://tech.ebu.ch/docs/r/r128.pdf EBU R 128] recommendation of a &#039;&#039;&#039;-23&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;LUFS&#039;&#039;&#039; target, although some may find the additional reduction in volume excessive, particularly if it leads to maxing out volume on user hardware. [[Opus]] in particular has adopted that recommendation.&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
There are different ReplayGain implementations, each with its own uses and strength. Most use [[metadata]] to indicate the level of the volume change that the player should make. Some modify the audio data itself, and optionally use metadata as well. There are advantages and disadvantages to both methods.&lt;br /&gt;
&lt;br /&gt;
In the metadata method, information on both types of ReplayGain (Track Gain and Album Gain) can be stored. The volume-change information can be very precise. If audio data was also changed, the metadata can contain &amp;quot;undo&amp;quot; info. Not all audio players/decoders know how to read and use ReplayGain information stored in metadata. And there&#039;s no standard for where and how ReplayGain info is stored; each implementation uses different formats and puts the info in different locations.&lt;br /&gt;
&lt;br /&gt;
In the audio data method, the file&#039;s actual audio data is modified so that its natural/default playback volume is at the target level. In this scenario, only one type of ReplayGain (Track Gain or Album Gain) can be applied. If no &amp;quot;undo&amp;quot; info is saved somewhere, it may not be possible to restore the original audio data. Limitations of the audio file format may prevent precise (finely tuned) gain adjustments with this method. For example, MP3 and AAC files can only be losslessly modified in 1.5 dB steps. Depending on the audio file format, the process may also be lossy in the sense that it could irreversibly push a signal above the format&#039;s maximum amplitude (resulting in clipping) or below the minimum (resulting in silence).&lt;br /&gt;
&lt;br /&gt;
=== Old versus new algorithms ===&lt;br /&gt;
Since the ReplayGain standard does not define tags to specify which algorithm was used (classic or ITU-R BS.1770) or what target was set (RG&#039;s -18&amp;amp;nbsp;LUFS, EBU R 128&#039;s -23&amp;amp;nbsp;LUFS, or any other target set by the user or some piece of software), there may be confusion as to how the results were produced. Typically, utilities that ship with reference encoders (FLAC / metaflac, Vorbis / vorbisgain, WavPack / wvgain, Musepack / mpcgain…) use the original RG algorithm, which can produce values that differ from newer tools by several decibels in certain cases. Generally speaking, it is recommended to run other utilities or players that implement the ITU-R BS.1770 algorithm, although it may not be obvious which algorithm they use at first glance. Their documentation may provide that information.&lt;br /&gt;
&lt;br /&gt;
==== RG1, RG2 ====&lt;br /&gt;
Although there are many references online, and within ReplayGain scanners, about version 1 vs. version 2 of the ReplayGain standard, at the time of writing this, there is (admittedly) only one ReplayGain standard. The core principle, as well as the 4 tags from the original specification, have not changed. More tags have been proposed but they are still subject to debate. As a rule of thumb, tools that advertise &amp;quot;ReplayGain&amp;amp;nbsp;2&amp;quot; compliance employ the newer, more accurate ITU-R BS.1770 algorithm. [[foobar2000]] labels it &amp;quot;EBU R128&amp;quot; but it essentially means the same thing. Should a better algorithm be developed in the future, it will still work towards fulfilling ReplayGain&#039;s original goals, and probably write the same tags.&lt;br /&gt;
&lt;br /&gt;
=== MP3Gain ===&lt;br /&gt;
[[MP3Gain]] is an implementation of classic ReplayGain. It can be used to just analyze files &amp;amp; recommend changes or to also modify the gain. If modifying the gain, it always modifies the global gain fields in the MP3 audio data. It can add somewhat precise metadata, including undo info. The gain can be modified to any target dB, or it can be changed by a specified amount. For balance correction, user-specified changes can even be made on just one channel in simple L/R stereo-mode files (not joint stereo).&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]]&lt;br /&gt;
* Method: Audio + Meta (in APE tag), or Audio only&lt;br /&gt;
* APE tag fields (ASCII bytes):&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values for this file. 3 digits, zero-padded if necessary.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_ALBUM_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values across a set of files scanned as an album. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_UNDO +###,+###,N&amp;lt;/code&amp;gt; - the global gain adjustment to restore the original values in the left and right channels, respectively, followed by an indicator of whether to wrap at the extremes (&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; means no, &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; means yes). The adjustment values are 3 digits, zero-padded, preceded by a sign (&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;).&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Examples: &amp;lt;code&amp;gt;+0.424046&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-10.38500&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Example: &amp;lt;code&amp;gt;0.149923&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Optional.&lt;br /&gt;
* Limitations: Although the metadata, if written, contains precise adjustment &amp;amp; peak values, the audio data modifications are limited to 1.5dB steps and may become irreversible (however, that&#039;s a very rare condition; see the [https://hydrogenaud.io/index.php/topic,34154.0.html &amp;quot;mp3gain is NOT lossless&amp;quot; forum thread])&lt;br /&gt;
* http://mp3gain.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== AACGain ===&lt;br /&gt;
[[AACGain]] is a modified version of MP3Gain that works on both MP3 and AAC files.&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]], [[AAC]] (with or without MP4 container)&lt;br /&gt;
* Method: Audio + Meta, or Audio only&lt;br /&gt;
* Limitations: Limited to 1.5dB steps mode, may become irreversible (same caveat as for MP3Gain)&lt;br /&gt;
* http://aacgain.altosdesign.com/&lt;br /&gt;
&lt;br /&gt;
=== [[LAME]] ===&lt;br /&gt;
* Method: Header ([http://gabriel.mp3-tech.org/mp3infotag.html mp3infotag])&lt;br /&gt;
* Notes:&lt;br /&gt;
** Uses the classic RG algorithm.&lt;br /&gt;
** Tags added during encoding; not supported by any player yet; Track Gain only&lt;br /&gt;
** Replay Gaining MP3&#039;s is usually done using MP3Gain (see [[ReplayGain#MP3Gain|above]]) or [[ReplayGain#foobar2000 ReplayGain scanner|foobar2000]]&lt;br /&gt;
* http://lame.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== [[Musepack]] ReplayGain ===&lt;br /&gt;
* Method: Header (similar to Meta data method)&lt;br /&gt;
* Notes: Uses the classic RG algorithm. ReplayGain values are stored in the header and ReplayGain is part of the Musepack specifications; therefore any Musepack decoder that does not support ReplayGain can be considered broken.&lt;br /&gt;
* http://www.musepack.net/&lt;br /&gt;
&lt;br /&gt;
=== VorbisGain ===&lt;br /&gt;
* Format: (Ogg) [[Vorbis]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.sjeng.org/vorbisgain.html&lt;br /&gt;
** new compiles of VorbisGain at [http://www.rarewares.org/ogg.html www.rarewares.org]&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) [[Vorbis#ReplayGain|check this section]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== FLAC / METAFLAC ===&lt;br /&gt;
* Format: [[Free Lossless Audio Codec|FLAC]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://flac.sf.net&lt;br /&gt;
&lt;br /&gt;
=== WavPack / WVGAIN ===&lt;br /&gt;
* Format: [[WavPack]]&lt;br /&gt;
* Method: Meta (in [[APEv2]] tag)&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.wavpack.com&lt;br /&gt;
&lt;br /&gt;
=== Wavegain ===&lt;br /&gt;
* Format: waveform&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* Limitations: Irreversible&lt;br /&gt;
* http://www.rarewares.org/others.php#wavegain&lt;br /&gt;
&lt;br /&gt;
=== MusicPlayer ===&lt;br /&gt;
* Custom implementation, inspired by MP3Gain.&lt;br /&gt;
* Format: any that FFmpeg supports&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Limitations: Doesn&#039;t modify the files at all. Stores the value in own database. Used only for playback.&lt;br /&gt;
* https://github.com/albertz/music-player&lt;br /&gt;
&lt;br /&gt;
=== [[foobar2000]] ReplayGain scanner ===&lt;br /&gt;
* Since v1.1.6, defaults to ITU-R BS.1770 analysis (although it labels it EBU R128), but can be configured to use the &amp;quot;Classic ReplayGain&amp;quot; algorithm instead. The ITU-R BS.1770 implementation uses a reference level of -18&amp;amp;nbsp;LUFS instead of -23, in order to retain compatibility with the ReplayGain standard.&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] (default) or [[APEv2]] tags.&lt;br /&gt;
** [[Musepack]]: Values written to header.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]] and/or file header.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags. As with MP3, it is also an option to apply gain via a separate function.&lt;br /&gt;
** [[MP4]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). Can write chosen Gain value to Apple&#039;s SoundCheck&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[TTA]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** [[WMA]]: Values written to WMA tags.&lt;br /&gt;
** Modules ([[MOD]] etc.): Optionally saved into [[APEv2]] tags.&lt;br /&gt;
** Any non-taggable format or format supported by FFmpeg can store RG values in a database or external tag with a component.&lt;br /&gt;
** A separate function can be invoked to apply the tagged Track or Album Gain to the global gain fields in MP3, MP4 (AAC), or Opus files, and rewrite any existing tags to account for the peak change and compensate for the difference from 89&amp;amp;nbsp;dB. The 89&amp;amp;nbsp;dB reference level for tags isn&#039;t configurable, but the reference level applied to the global gain fields is.&lt;br /&gt;
* https://foobar2000.org/&lt;br /&gt;
&lt;br /&gt;
=== [[MediaMonkey]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[WAV]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[MPC]]: Internal gain Structure.&lt;br /&gt;
* In addition to tags, all ReplayGain values are also stored in MediaMonkey&#039;s MDB database&lt;br /&gt;
* Album/Audiophile ReplayGain not supported until v3.0 (Dec 2007); support during burning &amp;amp; ripping added in 3.1 (Jun 2009)&lt;br /&gt;
* Also capable of (irreversibly) changing the volume of MP3 tracks, similar to [[MP3Gain]]&lt;br /&gt;
* http://www.mediamonkey.com/&lt;br /&gt;
&lt;br /&gt;
=== [[Winamp]] ReplayGain scanner===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in Windows Media Audio tags.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[MP4]]&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
* Support Album/Track Gain&lt;br /&gt;
&lt;br /&gt;
=== [[loudgain]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** MP2, [[MP3]]: Values written to [[ID3v2]] tags (ID3v2.3/ID3v2.4 selectable).&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Speex]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]], based on -23&amp;amp;nbsp;LUFS Opus standard. Only &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; are written, but the calculated &#039;&#039;true peak&#039;&#039; value can still be used to reduce the gain values ([[Clipping]] prevention).&lt;br /&gt;
** [[MP4]], [[M4A]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under &amp;lt;code&amp;gt;----:com.apple.iTunes:…&amp;lt;/code&amp;gt;. This is for [[AAC]] and [[ALAC]] in [[MPEG-4]] containers.&lt;br /&gt;
** [[ASF]], [[Windows Media Audio|WMA]]: Values written to WMA tags, no prefix.&lt;br /&gt;
** [[WAV]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] (ID3v2.3/ID3v2.4 selectable) format. Using the &amp;lt;code&amp;gt;bext&amp;lt;/code&amp;gt; chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.&lt;br /&gt;
** [[Audio Interchange File Format|AIFF]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] format.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[Monkey&#039;s Audio]] (APE): Values written to [[APEv2]] tags.&lt;br /&gt;
* Follows EBU R128, ITU BS.1770 and the [[ReplayGain 2.0 specification|revised ReplayGain specification]].&lt;br /&gt;
* &#039;&#039;Never&#039;&#039; touches the actual audio data but &#039;&#039;only writes RG2 tags&#039;&#039;.&lt;br /&gt;
* Uses &#039;&#039;true peak&#039;&#039; values calculated by oversampling to 192&amp;amp;nbsp;kHz, using a custom polyphase FIR interpolator that will oversample 4x for sample rates &amp;lt; 96&amp;amp;nbsp;kHz, 2x for sample rates &amp;lt; 192&amp;amp;nbsp;kHz and leave the signal unchanged for 192&amp;amp;nbsp;kHz.&lt;br /&gt;
* &#039;&#039;Clipping prevention&#039;&#039; can be used to lower the ReplayGain values to a safe margin (default -1&amp;amp;nbsp;dBTP, can be changed).&lt;br /&gt;
* Many options for special cases: force RG tags upper-/lowercase, add extra tags (LRA, Reference loudness), strip unwanted tag types (APEv2 from MP2/MP3, ID3 from WavPack), tab-delimited table output for analysis with CSV file.&lt;br /&gt;
* &#039;&#039;Linux&#039;&#039; Free and Open Source software, can be installed on &#039;&#039;MacOS&#039;&#039; using &#039;&#039;HomeBrew&#039;&#039;, on &#039;&#039;Windows 10&#039;&#039; using the Linux &#039;&#039;bash&#039;&#039;.&lt;br /&gt;
* Also installs a &amp;lt;code&amp;gt;rgbpm&amp;lt;/code&amp;gt; bash script for mass-tagging, which can be adapted to the user’s needs.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; Loudgain relies on standard libraries like &#039;&#039;TagLib&#039;&#039;. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of &#039;&#039;TagLib&#039;&#039;. Version 1.11.1 had a nasty bug for a while that [https://hydrogenaud.io/index.php/topic,118085.msg974957.html#msg974957 could corrupt Ogg Vorbis files]. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called &amp;lt;code&amp;gt;loudgain.static&amp;lt;/code&amp;gt; in the repo’s &amp;lt;code&amp;gt;/bin&amp;lt;/code&amp;gt; folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).&lt;br /&gt;
* https://github.com/Moonbase59/loudgain&lt;br /&gt;
* Bug tracker: https://github.com/Moonbase59/loudgain/issues&lt;br /&gt;
&lt;br /&gt;
=== [[rsgain]] ===&lt;br /&gt;
rsgain is a newer ReplayGain command line utility designed with a &amp;quot;batteries included&amp;quot; philosophy, use the newer ITU-R BS.1770 algorithm.&lt;br /&gt;
&lt;br /&gt;
Features:&lt;br /&gt;
* Cross-platform Windows&amp;amp;nbsp;/&amp;amp;nbsp;macOS&amp;amp;nbsp;/&amp;amp;nbsp;Linux&lt;br /&gt;
* Supports all popular audio formats&lt;br /&gt;
* Simplified &amp;quot;Easy Mode&amp;quot; command line syntax supports recursive, directory-based scanning&lt;br /&gt;
* Multithreaded scanning option that provides significant speed improvement with full library scans&lt;br /&gt;
* Option to skip files with existing ReplayGain metadata&lt;br /&gt;
* Scan presets allow the user to save advanced settings for consistent use&lt;br /&gt;
&lt;br /&gt;
== Players support ==&lt;br /&gt;
ReplayGain being present in the specs of the FLAC, Musepack, and APE formats, any player that support those formats usually supports ReplayGain.&lt;br /&gt;
&lt;br /&gt;
The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* [[foobar2000]] supports ReplayGain in all possible aspects.&lt;br /&gt;
* [[Winamp]] supports ReplayGain in album or track mode.&lt;br /&gt;
* [[MediaMonkey]] supports ReplayGain, with many configuration options.&lt;br /&gt;
* [[XMPlay]] recently implemented ReplayGain&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...and probably others.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
* [[XMMS]]. Reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], [[Musepack]], (Ogg) [[Vorbis]] ..&lt;br /&gt;
:For [[MP3]], use the CVS version of the [http://xmms-mad.sourceforge.net/ xmms-mad] mp3 plugin (it&#039;s not yet released as binary, furthermore not available in distribs&#039; versions for now. Meanwhile binaries are available here: [http://perso.crans.org/~krempp/xmms-mad/ custom binaries])&lt;br /&gt;
* [[amarok]]. By using the amarok-script [http://kde-apps.org/content/show.php?content=26073 ReplayGain]&lt;br /&gt;
:And possibly others, since [http://developer.kde.org/~wheeler/taglib.html TagLib] added support for [[APEv2]] tags in [[MP3]] files, players using this library (like [[amaroK]] and [[JuK]]) might support that kind of ReplayGain tags in the near future.&lt;br /&gt;
* [http://www.sacredchao.net/quodlibet Quod Libet] reads ReplayGain from (Ogg) [[Vorbis]], [[MP3]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support ReplayGain values stored in [[APEv2]] tags in [[MP3]]s. ReplayGain values are stored in RVA2 id3v2.4 frames. See the [http://www.sacredchao.net/quodlibet/wiki/Development/ID3Notes Quod Libet RVA2 / ReplayGain notes].&lt;br /&gt;
* [http://www.musicpd.org/ Music Player Daemon] (MPD) reads ReplayGain from (Ogg) [[Vorbis]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:foobar2000-style TXXX frames in [[MP3]]s are also supported in the latest development releases.&lt;br /&gt;
* [http://www.mplayerhq.hu/ MPlayer]. Mplayer support for ReplayGain is codec dependent.&lt;br /&gt;
:Codecs that are known to support ReplayGain: vorbis&lt;br /&gt;
:Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line.  To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed.  To prioritize the codecs by default, list them in a line in mplayer.conf:&lt;br /&gt;
 ac=[codec],[othercodec],vorbis,mad,&lt;br /&gt;
* [http://idjc.sourceforge.net/ IDJC] (Internet DJ Console) reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], (Ogg) FLAC, (Ogg) [[Vorbis]], MP2 (audio), [[MP3]], [[Opus]], but only the &#039;&#039;lowercase&#039;&#039; tags. There is a [https://sourceforge.net/p/idjc/bugs/100/ ticket] open to handle tags case-insensitively.&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
* [https://www.videolan.org/vlc/ VLC] supports ReplayGain in many file formats, but usually only the &#039;&#039;uppercase&#039;&#039; variant of the tags.&lt;br /&gt;
* [https://kodi.tv/ KODI] reads ReplayGain from nearly all formats, but usually only the &#039;&#039;lowercase&#039;&#039; variant of the tags.&lt;br /&gt;
&lt;br /&gt;
=== Portable devices ===&lt;br /&gt;
[http://www.rockbox.org/ Rockbox] supports ReplayGain (in album or track mode) for most formats, including  WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey&#039;s Audio, Wavpack, FLAC and Vorbis.  &amp;lt;br&amp;gt;Note that ReplayGain is only supported when using the respective codec&#039;s native tagging format.  For example:  ReplayGain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Fuze with firmware 1.02.26 and 2.02.26&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Clip+&lt;br /&gt;
&lt;br /&gt;
The iPod features &#039;&#039;Soundcheck&#039;&#039;, which seems to produce roughly the same normalization gains as ReplayGain, but doesn&#039;t provide an Album Gain.&lt;br /&gt;
&lt;br /&gt;
=== Hi-Fi ===&lt;br /&gt;
Slim Devices, a company owned by Logitech Inc, supports ReplayGain on both of their hi-end audiophile players, known as the [[Slim Devices Transporter|Transporter]] and the [[Slim Devices Squeezebox|Squeezebox]].&lt;br /&gt;
&lt;br /&gt;
BluOS also supports ReplayGain with the selection of album- or track-gain and a so called Smart option that decides between the two by itself.&lt;br /&gt;
NAD devices that use BluOS consequently also support ReplayGain.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;references/&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[ReplayGain specification]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Replay_Gain ReplayGain] at Wikipedia&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain.html ReplayGain using foobar2000] (how to use ReplayGain in Windows using foobar2000).&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html ReplayGain in Linux] (how to use ReplayGain in Linux using foobar2000 and Wine, or using metaflac or vorbisgain).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[index.php?title=Category:Technical]]&lt;br /&gt;
[[index.php?title=Category:Metadata]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38802</id>
		<title>ReplayGain</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=ReplayGain&amp;diff=38802"/>
		<updated>2026-01-23T07:48:40Z</updated>

		<summary type="html">&lt;p&gt;Case: /* MusicPlayer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;ReplayGain&#039;&#039;&#039; is the name of a technique invented to achieve the same perceived playback loudness of audio files. It defines an algorithm to measure the &#039;&#039;&#039;perceived&#039;&#039;&#039; loudness of audio data.&lt;br /&gt;
&lt;br /&gt;
ReplayGain allows the loudness of each song within a collection of songs to be consistent. This is called &#039;Track Gain&#039; (or &#039;Radio Gain&#039; in earlier parlance). It also allows the loudness of a specific sub-collection (an &amp;quot;album&amp;quot;) to be consistent with the rest of the collection, while allowing the dynamics from song to song on the album to remain intact. This is called &#039;Album Gain&#039; (or &#039;Audiophile Gain&#039; in earlier parlance). This is especially important when listening to classical music albums, because quiet tracks need to remain a certain degree quieter than the louder ones.&lt;br /&gt;
&lt;br /&gt;
ReplayGain is different from [[Normalization|peak normalization]]. Peak normalization merely ensures that the peak amplitude reaches a certain level. This does not ensure equal loudness. The ReplayGain technique measures the &#039;&#039;effective power&#039;&#039; of the waveform (i.e. the RMS power after applying an &amp;quot;equal loudness contour&amp;quot;), and then adjusts the amplitude of the waveform accordingly. The result is that Replay Gained waveforms are usually more uniformly amplified than peak-normalized waveforms.&lt;br /&gt;
&lt;br /&gt;
==Target loudness==&lt;br /&gt;
The target loudness of almost all ReplayGain utilities is 89&amp;amp;nbsp;dB SPL when replayed in an SMPTE RP 200 calibrated system (an early departure from the proposal, endorsed by its author&amp;lt;ref&amp;gt;[http://www.hydrogenaudio.org/forums/index.php?s=&amp;amp;showtopic=83397&amp;amp;view=findpost&amp;amp;p=721854 Does Replay gain work differtly in Media monkey]&amp;lt;/ref&amp;gt;) &amp;amp;mdash; the ReplayGain proposal and SMPTE recommendation are 6&amp;amp;nbsp;dB lower.&amp;lt;ref&amp;gt;[http://www.mars.org/mailman/public/mad-dev/2004-February/000993.html ReplayGain discussion at mad-dev]&amp;lt;/ref&amp;gt; The target loudness may be more commonly known and understood as &#039;&#039;&#039;-18&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;[https://en.wikipedia.org/wiki/LUFS LUFS]&#039;&#039;&#039; (&#039;&#039;Loudness Units relative to Full Scale&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Some utilities have realized the inadequacies of the classic ReplayGain loudness calculation, switching to a more modern algorithm ([https://www.itu.int/rec/R-REC-BS.1770-5-202311-I/en ITU-R BS.1770]). However, the way it was integrated was extremely &#039;&#039;ad hoc&#039;&#039;, at least until a draft of a [[ReplayGain 2.0 specification|revised specification]] started being written.&lt;br /&gt;
&lt;br /&gt;
==Clipping==&lt;br /&gt;
Audio is generally recorded such that the loudest sounds don&#039;t clip, but the use of ReplayGain can cause clipping if the average volume of a song is below the target level. That is, upon playback, the volume of a quiet song is increased, so the parts of the song with above-average loudness, especially in the bass frequencies, will exceed the limits of the format and will be distorted. Whether this distortion is audible depends on the sounds in question, and the listener&#039;s sensitivity.&lt;br /&gt;
&lt;br /&gt;
Implementations deal with the risk of clipping in different ways. Some have a &amp;quot;pre-amp&amp;quot; feature which reduces (or boosts) the original audio&#039;s level by a certain amount before doing whatever is needed for ReplayGain. Some have a &amp;quot;prevent clipping&amp;quot; feature to reduce the amount of ReplayGain adjustment to whatever amount would keep clipping from occurring, based on peak info stored in the file&#039;s metadata (thus reducing the effectiveness of ReplayGain). Some recommend using a compressor/limiter DSP to prevent or reduce clipping, regardless of whether it was caused by ReplayGain.&lt;br /&gt;
&lt;br /&gt;
An alternative that may reduce the risk of clipping is the [https://tech.ebu.ch/docs/r/r128.pdf EBU R 128] recommendation of a &#039;&#039;&#039;-23&#039;&#039;&#039;&amp;amp;nbsp;&#039;&#039;&#039;LUFS&#039;&#039;&#039; target, although some may find the additional reduction in volume excessive, particularly if it leads to maxing out volume on user hardware. [[Opus]] in particular has adopted that recommendation.&lt;br /&gt;
&lt;br /&gt;
== Implementations ==&lt;br /&gt;
There are different ReplayGain implementations, each with its own uses and strength. Most use [[metadata]] to indicate the level of the volume change that the player should make. Some modify the audio data itself, and optionally use metadata as well. There are advantages and disadvantages to both methods.&lt;br /&gt;
&lt;br /&gt;
In the metadata method, information on both types of ReplayGain (Track Gain and Album Gain) can be stored. The volume-change information can be very precise. If audio data was also changed, the metadata can contain &amp;quot;undo&amp;quot; info. Not all audio players/decoders know how to read and use ReplayGain information stored in metadata. And there&#039;s no standard for where and how ReplayGain info is stored; each implementation uses different formats and puts the info in different locations.&lt;br /&gt;
&lt;br /&gt;
In the audio data method, the file&#039;s actual audio data is modified so that its natural/default playback volume is at the target level. In this scenario, only one type of ReplayGain (Track Gain or Album Gain) can be applied. If no &amp;quot;undo&amp;quot; info is saved somewhere, it may not be possible to restore the original audio data. Limitations of the audio file format may prevent precise (finely tuned) gain adjustments with this method. For example, MP3 and AAC files can only be losslessly modified in 1.5 dB steps. Depending on the audio file format, the process may also be lossy in the sense that it could irreversibly push a signal above the format&#039;s maximum amplitude (resulting in clipping) or below the minimum (resulting in silence).&lt;br /&gt;
&lt;br /&gt;
=== Old versus new algorithms ===&lt;br /&gt;
Since the ReplayGain standard does not define tags to specify which algorithm was used (classic or ITU-R BS.1770) or what target was set (RG&#039;s -18&amp;amp;nbsp;LUFS, EBU R 128&#039;s -23&amp;amp;nbsp;LUFS, or any other target set by the user or some piece of software), there may be confusion as to how the results were produced. Typically, utilities that ship with reference encoders (FLAC / metaflac, Vorbis / vorbisgain, WavPack / wvgain, Musepack / mpcgain…) use the original RG algorithm, which can produce values that differ from newer tools by several decibels in certain cases. Generally speaking, it is recommended to run other utilities or players that implement the ITU-R BS.1770 algorithm, although it may not be obvious which algorithm they use at first glance. Their documentation may provide that information.&lt;br /&gt;
&lt;br /&gt;
==== RG1, RG2 ====&lt;br /&gt;
Although there are many references online, and within ReplayGain scanners, about version 1 vs. version 2 of the ReplayGain standard, at the time of writing this, there is (admittedly) only one ReplayGain standard. The core principle, as well as the 4 tags from the original specification, have not changed. More tags have been proposed but they are still subject to debate. As a rule of thumb, tools that advertise &amp;quot;ReplayGain&amp;amp;nbsp;2&amp;quot; compliance employ the newer, more accurate ITU-R BS.1770 algorithm. [[foobar2000]] labels it &amp;quot;EBU R128&amp;quot; but it essentially means the same thing. Should a better algorithm be developed in the future, it will still work towards fulfilling ReplayGain&#039;s original goals, and probably write the same tags.&lt;br /&gt;
&lt;br /&gt;
=== MP3Gain ===&lt;br /&gt;
[[MP3Gain]] is an implementation of classic ReplayGain. It can be used to just analyze files &amp;amp; recommend changes or to also modify the gain. If modifying the gain, it always modifies the global gain fields in the MP3 audio data. It can add somewhat precise metadata, including undo info. The gain can be modified to any target dB, or it can be changed by a specified amount. For balance correction, user-specified changes can even be made on just one channel in simple L/R stereo-mode files (not joint stereo).&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]]&lt;br /&gt;
* Method: Audio + Meta (in APE tag), or Audio only&lt;br /&gt;
* APE tag fields (ASCII bytes):&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values for this file. 3 digits, zero-padded if necessary.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_ALBUM_MINMAX ###,###&amp;lt;/code&amp;gt; - minimum &amp;amp; maximum global gain values across a set of files scanned as an album. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;MP3GAIN_UNDO +###,+###,N&amp;lt;/code&amp;gt; - the global gain adjustment to restore the original values in the left and right channels, respectively, followed by an indicator of whether to wrap at the extremes (&amp;lt;code&amp;gt;N&amp;lt;/code&amp;gt; means no, &amp;lt;code&amp;gt;W&amp;lt;/code&amp;gt; means yes). The adjustment values are 3 digits, zero-padded, preceded by a sign (&amp;lt;code&amp;gt;+&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-&amp;lt;/code&amp;gt;).&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Examples: &amp;lt;code&amp;gt;+0.424046&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;-10.38500&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_TRACK_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Example: &amp;lt;code&amp;gt;0.149923&amp;lt;/code&amp;gt;&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_GAIN +#.###### dB&amp;lt;/code&amp;gt; - The value is always 9 characters including the sign and decimal point. Optional.&lt;br /&gt;
** &amp;lt;code&amp;gt;REPLAYGAIN_ALBUM_PEAK #.###### dB&amp;lt;/code&amp;gt; - The value is always 8 characters including the decimal point. Optional.&lt;br /&gt;
* Limitations: Although the metadata, if written, contains precise adjustment &amp;amp; peak values, the audio data modifications are limited to 1.5dB steps and may become irreversible (however, that&#039;s a very rare condition; see the [https://hydrogenaud.io/index.php/topic,34154.0.html &amp;quot;mp3gain is NOT lossless&amp;quot; forum thread])&lt;br /&gt;
* http://mp3gain.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== AACGain ===&lt;br /&gt;
[[AACGain]] is a modified version of MP3Gain that works on both MP3 and AAC files.&lt;br /&gt;
&lt;br /&gt;
* Format: [[MP3]], [[AAC]] (with or without MP4 container)&lt;br /&gt;
* Method: Audio + Meta, or Audio only&lt;br /&gt;
* Limitations: Limited to 1.5dB steps mode, may become irreversible (same caveat as for MP3Gain)&lt;br /&gt;
* http://aacgain.altosdesign.com/&lt;br /&gt;
&lt;br /&gt;
=== [[LAME]] ===&lt;br /&gt;
* Method: Header ([http://gabriel.mp3-tech.org/mp3infotag.html mp3infotag])&lt;br /&gt;
* Notes:&lt;br /&gt;
** Uses the classic RG algorithm.&lt;br /&gt;
** Tags added during encoding; not supported by any player yet; Track Gain only&lt;br /&gt;
** Replay Gaining MP3&#039;s is usually done using MP3Gain (see [[ReplayGain#MP3Gain|above]]) or [[ReplayGain#foobar2000 ReplayGain scanner|foobar2000]]&lt;br /&gt;
* http://lame.sourceforge.net/&lt;br /&gt;
&lt;br /&gt;
=== [[Musepack]] ReplayGain ===&lt;br /&gt;
* Method: Header (similar to Meta data method)&lt;br /&gt;
* Notes: Uses the classic RG algorithm. ReplayGain values are stored in the header and ReplayGain is part of the Musepack specifications; therefore any Musepack decoder that does not support ReplayGain can be considered broken.&lt;br /&gt;
* http://www.musepack.net/&lt;br /&gt;
&lt;br /&gt;
=== VorbisGain ===&lt;br /&gt;
* Format: (Ogg) [[Vorbis]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.sjeng.org/vorbisgain.html&lt;br /&gt;
** new compiles of VorbisGain at [http://www.rarewares.org/ogg.html www.rarewares.org]&lt;br /&gt;
:&#039;&#039;&#039;&#039;&#039;Note:&#039;&#039;&#039; Andavari has provided a very useful script to integrate VorbisGain, which is a CLI tool, into Windows Explorer. Please (Ogg) [[Vorbis#ReplayGain|check this section]].&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== FLAC / METAFLAC ===&lt;br /&gt;
* Format: [[Free Lossless Audio Codec|FLAC]]&lt;br /&gt;
* Method: Meta (in [[Vorbis comment]])&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://flac.sf.net&lt;br /&gt;
&lt;br /&gt;
=== WavPack / WVGAIN ===&lt;br /&gt;
* Format: [[WavPack]]&lt;br /&gt;
* Method: Meta (in [[APEv2]] tag)&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* http://www.wavpack.com&lt;br /&gt;
&lt;br /&gt;
=== Wavegain ===&lt;br /&gt;
* Format: waveform&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Uses the classic RG algorithm.&lt;br /&gt;
* Limitations: Irreversible&lt;br /&gt;
* http://www.rarewares.org/others.php#wavegain&lt;br /&gt;
&lt;br /&gt;
=== MusicPlayer ===&lt;br /&gt;
* Custom implementation, inspired by MP3Gain.&lt;br /&gt;
* Format: any that FFmpeg supports&lt;br /&gt;
* Method: Audio&lt;br /&gt;
* Limitations: Doesn&#039;t modify the files at all. Stores the value in own database. Used only for playback.&lt;br /&gt;
* https://github.com/albertz/music-player&lt;br /&gt;
&lt;br /&gt;
=== [[foobar2000]] ReplayGain scanner ===&lt;br /&gt;
* Since v1.1.6, defaults to ITU-R BS.1770 analysis (although it labels it EBU R128), but can be configured to use the &amp;quot;Classic ReplayGain&amp;quot; algorithm instead. The ITU-R BS.1770 implementation uses a reference level of -18&amp;amp;nbsp;LUFS instead of -23, in order to retain compatibility with the ReplayGain standard.&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] (default) or [[APEv2]] tags. A separate function can be invoked to apply the tagged Track or Album Gain to the MP3 global gain fields (as MP3Gain does), and rewrite any existing tags to account for the peak change and compensate for the difference from 89&amp;amp;nbsp;dB. The 89&amp;amp;nbsp;dB reference level for tags isn&#039;t configurable, but the reference level applied to the global gain fields is (it&#039;s under Preferences &amp;gt; Advanced &amp;gt; Tools &amp;gt; ReplayGain Scanner &amp;gt; Target MP3 alteration volume level).&lt;br /&gt;
** [[Musepack]]: Values written to header.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags. As with MP3, it is also an option to apply gain via a separate function.&lt;br /&gt;
** [[MP4]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain).&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** Modules ([[MOD]] etc.): Optionally saved into [[APEv2]] tags.&lt;br /&gt;
* https://foobar2000.org/&lt;br /&gt;
&lt;br /&gt;
=== [[MediaMonkey]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[APEv2]] or [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[WAV]]: Values stored in MediaMonkey&#039;s MDB database.&lt;br /&gt;
** [[MPC]]: Internal gain Structure.&lt;br /&gt;
* In addition to tags, all ReplayGain values are also stored in MediaMonkey&#039;s MDB database&lt;br /&gt;
* Album/Audiophile ReplayGain not supported until v3.0 (Dec 2007); support during burning &amp;amp; ripping added in 3.1 (Jun 2009)&lt;br /&gt;
* Also capable of (irreversibly) changing the volume of MP3 tracks, similar to [[MP3Gain]]&lt;br /&gt;
* http://www.mediamonkey.com/&lt;br /&gt;
&lt;br /&gt;
=== [[Winamp]] ReplayGain scanner===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[MP3]]: Values written to [[ID3v2]] tags.&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[WMA]]: Values stored in Windows Media Audio tags.&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[APE]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[AAC]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[MP4]]&lt;br /&gt;
** [[TAK]]: Values written to [[APEv2]] tags.&lt;br /&gt;
* Support Album/Track Gain&lt;br /&gt;
&lt;br /&gt;
=== [[loudgain]] ===&lt;br /&gt;
* Format:&lt;br /&gt;
** [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** MP2, [[MP3]]: Values written to [[ID3v2]] tags (ID3v2.3/ID3v2.4 selectable).&lt;br /&gt;
** (Ogg) [[Vorbis]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Free Lossless Audio Codec|FLAC]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** (Ogg) [[Speex]]: Values written to [[Vorbis comment]].&lt;br /&gt;
** [[Opus]]: Values written to [[Vorbis comment]], based on -23&amp;amp;nbsp;LUFS Opus standard. Only &amp;lt;code&amp;gt;R128_TRACK_GAIN&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;R128_ALBUM_GAIN&amp;lt;/code&amp;gt; are written, but the calculated &#039;&#039;true peak&#039;&#039; value can still be used to reduce the gain values ([[Clipping]] prevention).&lt;br /&gt;
** [[MP4]], [[M4A]]: Uses its own iTunes-compatible tagging system (though iTunes does not support ReplayGain). ReplayGain values are stored under &amp;lt;code&amp;gt;----:com.apple.iTunes:…&amp;lt;/code&amp;gt;. This is for [[AAC]] and [[ALAC]] in [[MPEG-4]] containers.&lt;br /&gt;
** [[ASF]], [[Windows Media Audio|WMA]]: Values written to WMA tags, no prefix.&lt;br /&gt;
** [[WAV]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] (ID3v2.3/ID3v2.4 selectable) format. Using the &amp;lt;code&amp;gt;bext&amp;lt;/code&amp;gt; chunk (for BWF v2) isn’t (yet) supported, but won’t be destroyed on writing.&lt;br /&gt;
** [[Audio Interchange File Format|AIFF]]: Values written to the &amp;lt;code&amp;gt;ID3 &amp;lt;/code&amp;gt; chunk, in [[ID3v2]] format.&lt;br /&gt;
** [[WavPack]]: Values written to [[APEv2]] tags.&lt;br /&gt;
** [[Monkey&#039;s Audio]] (APE): Values written to [[APEv2]] tags.&lt;br /&gt;
* Follows EBU R128, ITU BS.1770 and the [[ReplayGain 2.0 specification|revised ReplayGain specification]].&lt;br /&gt;
* &#039;&#039;Never&#039;&#039; touches the actual audio data but &#039;&#039;only writes RG2 tags&#039;&#039;.&lt;br /&gt;
* Uses &#039;&#039;true peak&#039;&#039; values calculated by oversampling to 192&amp;amp;nbsp;kHz, using a custom polyphase FIR interpolator that will oversample 4x for sample rates &amp;lt; 96&amp;amp;nbsp;kHz, 2x for sample rates &amp;lt; 192&amp;amp;nbsp;kHz and leave the signal unchanged for 192&amp;amp;nbsp;kHz.&lt;br /&gt;
* &#039;&#039;Clipping prevention&#039;&#039; can be used to lower the ReplayGain values to a safe margin (default -1&amp;amp;nbsp;dBTP, can be changed).&lt;br /&gt;
* Many options for special cases: force RG tags upper-/lowercase, add extra tags (LRA, Reference loudness), strip unwanted tag types (APEv2 from MP2/MP3, ID3 from WavPack), tab-delimited table output for analysis with CSV file.&lt;br /&gt;
* &#039;&#039;Linux&#039;&#039; Free and Open Source software, can be installed on &#039;&#039;MacOS&#039;&#039; using &#039;&#039;HomeBrew&#039;&#039;, on &#039;&#039;Windows 10&#039;&#039; using the Linux &#039;&#039;bash&#039;&#039;.&lt;br /&gt;
* Also installs a &amp;lt;code&amp;gt;rgbpm&amp;lt;/code&amp;gt; bash script for mass-tagging, which can be adapted to the user’s needs.&lt;br /&gt;
* &#039;&#039;&#039;Warning:&#039;&#039;&#039; Loudgain relies on standard libraries like &#039;&#039;TagLib&#039;&#039;. Linux distros (except rolling releases) sometimes deliver outdated libraries, so be sure you use the latest version of &#039;&#039;TagLib&#039;&#039;. Version 1.11.1 had a nasty bug for a while that [https://hydrogenaud.io/index.php/topic,118085.msg974957.html#msg974957 could corrupt Ogg Vorbis files]. This has been fixed in the meantime but the TagLib version not updated. Loudgain comes with a (slower) static version called &amp;lt;code&amp;gt;loudgain.static&amp;lt;/code&amp;gt; in the repo’s &amp;lt;code&amp;gt;/bin&amp;lt;/code&amp;gt; folder that doesn’t expose the bug and can also be used on older Linux versions (like Ubuntu 14.04, Linux Mint 17).&lt;br /&gt;
* https://github.com/Moonbase59/loudgain&lt;br /&gt;
* Bug tracker: https://github.com/Moonbase59/loudgain/issues&lt;br /&gt;
&lt;br /&gt;
=== [[rsgain]] ===&lt;br /&gt;
rsgain is a newer ReplayGain command line utility designed with a &amp;quot;batteries included&amp;quot; philosophy, use the newer ITU-R BS.1770 algorithm.&lt;br /&gt;
&lt;br /&gt;
Features:&lt;br /&gt;
* Cross-platform Windows&amp;amp;nbsp;/&amp;amp;nbsp;macOS&amp;amp;nbsp;/&amp;amp;nbsp;Linux&lt;br /&gt;
* Supports all popular audio formats&lt;br /&gt;
* Simplified &amp;quot;Easy Mode&amp;quot; command line syntax supports recursive, directory-based scanning&lt;br /&gt;
* Multithreaded scanning option that provides significant speed improvement with full library scans&lt;br /&gt;
* Option to skip files with existing ReplayGain metadata&lt;br /&gt;
* Scan presets allow the user to save advanced settings for consistent use&lt;br /&gt;
&lt;br /&gt;
== Players support ==&lt;br /&gt;
ReplayGain being present in the specs of the FLAC, Musepack, and APE formats, any player that support those formats usually supports ReplayGain.&lt;br /&gt;
&lt;br /&gt;
The situation with MP3 is rather different, as it was not part of the MP3 specs. The APEv2 tags metadata implementation is somewhat becoming the de-facto standard.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
* [[foobar2000]] supports ReplayGain in all possible aspects.&lt;br /&gt;
* [[Winamp]] supports ReplayGain in album or track mode.&lt;br /&gt;
* [[MediaMonkey]] supports ReplayGain, with many configuration options.&lt;br /&gt;
* [[XMPlay]] recently implemented ReplayGain&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;...and probably others.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
* [[XMMS]]. Reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], [[Musepack]], (Ogg) [[Vorbis]] ..&lt;br /&gt;
:For [[MP3]], use the CVS version of the [http://xmms-mad.sourceforge.net/ xmms-mad] mp3 plugin (it&#039;s not yet released as binary, furthermore not available in distribs&#039; versions for now. Meanwhile binaries are available here: [http://perso.crans.org/~krempp/xmms-mad/ custom binaries])&lt;br /&gt;
* [[amarok]]. By using the amarok-script [http://kde-apps.org/content/show.php?content=26073 ReplayGain]&lt;br /&gt;
:And possibly others, since [http://developer.kde.org/~wheeler/taglib.html TagLib] added support for [[APEv2]] tags in [[MP3]] files, players using this library (like [[amaroK]] and [[JuK]]) might support that kind of ReplayGain tags in the near future.&lt;br /&gt;
* [http://www.sacredchao.net/quodlibet Quod Libet] reads ReplayGain from (Ogg) [[Vorbis]], [[MP3]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:Requires support to be enabled (via the appropriate python bindings and libraries) for the above formats. Does not support ReplayGain values stored in [[APEv2]] tags in [[MP3]]s. ReplayGain values are stored in RVA2 id3v2.4 frames. See the [http://www.sacredchao.net/quodlibet/wiki/Development/ID3Notes Quod Libet RVA2 / ReplayGain notes].&lt;br /&gt;
* [http://www.musicpd.org/ Music Player Daemon] (MPD) reads ReplayGain from (Ogg) [[Vorbis]], [[Free Lossless Audio Codec|FLAC]], and [[Musepack]].&lt;br /&gt;
:foobar2000-style TXXX frames in [[MP3]]s are also supported in the latest development releases.&lt;br /&gt;
* [http://www.mplayerhq.hu/ MPlayer]. Mplayer support for ReplayGain is codec dependent.&lt;br /&gt;
:Codecs that are known to support ReplayGain: vorbis&lt;br /&gt;
:Because of this, you need to prioritize the codecs that support it, or choose it individually on the command line.  To add it to the command line, add an -ac [codec] option after each file that you want to choose the codec for, or at the beginning to make it apply to all files listed.  To prioritize the codecs by default, list them in a line in mplayer.conf:&lt;br /&gt;
 ac=[codec],[othercodec],vorbis,mad,&lt;br /&gt;
* [http://idjc.sourceforge.net/ IDJC] (Internet DJ Console) reads ReplayGain from [[Free Lossless Audio Codec|FLAC]], (Ogg) FLAC, (Ogg) [[Vorbis]], MP2 (audio), [[MP3]], [[Opus]], but only the &#039;&#039;lowercase&#039;&#039; tags. There is a [https://sourceforge.net/p/idjc/bugs/100/ ticket] open to handle tags case-insensitively.&lt;br /&gt;
* [https://picard.musicbrainz.org/ MusicBrainz Picard] is a tagger (and player) that tags using metadata from the MusicBrainz.org database. Picard supports ReplayGain tags for files tagged with APE, ASF, ID3, MP4 and Vorbis tags. There is a ReplayGain plugin that can be used to calculate the ReplayGain values for both Albums and Tracks.&lt;br /&gt;
* [https://www.videolan.org/vlc/ VLC] supports ReplayGain in many file formats, but usually only the &#039;&#039;uppercase&#039;&#039; variant of the tags.&lt;br /&gt;
* [https://kodi.tv/ KODI] reads ReplayGain from nearly all formats, but usually only the &#039;&#039;lowercase&#039;&#039; variant of the tags.&lt;br /&gt;
&lt;br /&gt;
=== Portable devices ===&lt;br /&gt;
[http://www.rockbox.org/ Rockbox] supports ReplayGain (in album or track mode) for most formats, including  WMA, MP1/2/3, AAC, ALAC, Musepack, Monkey&#039;s Audio, Wavpack, FLAC and Vorbis.  &amp;lt;br&amp;gt;Note that ReplayGain is only supported when using the respective codec&#039;s native tagging format.  For example:  ReplayGain stored in APEv2 tags is not supported for MP3, rather ID3v2.x tags are expected.&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Fuze with firmware 1.02.26 and 2.02.26&lt;br /&gt;
&lt;br /&gt;
Sandisk Sansa Clip+&lt;br /&gt;
&lt;br /&gt;
The iPod features &#039;&#039;Soundcheck&#039;&#039;, which seems to produce roughly the same normalization gains as ReplayGain, but doesn&#039;t provide an Album Gain.&lt;br /&gt;
&lt;br /&gt;
=== Hi-Fi ===&lt;br /&gt;
Slim Devices, a company owned by Logitech Inc, supports ReplayGain on both of their hi-end audiophile players, known as the [[Slim Devices Transporter|Transporter]] and the [[Slim Devices Squeezebox|Squeezebox]].&lt;br /&gt;
&lt;br /&gt;
BluOS also supports ReplayGain with the selection of album- or track-gain and a so called Smart option that decides between the two by itself.&lt;br /&gt;
NAD devices that use BluOS consequently also support ReplayGain.&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;small&amp;gt;&amp;lt;references/&amp;gt;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[ReplayGain specification]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Replay_Gain ReplayGain] at Wikipedia&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain.html ReplayGain using foobar2000] (how to use ReplayGain in Windows using foobar2000).&lt;br /&gt;
* [http://www.bobulous.org.uk/misc/Replay-Gain-in-Linux.html ReplayGain in Linux] (how to use ReplayGain in Linux using foobar2000 and Wine, or using metaflac or vorbisgain).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[index.php?title=Category:Technical]]&lt;br /&gt;
[[index.php?title=Category:Metadata]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38286</id>
		<title>Foobar2000:Title Formatting Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38286"/>
		<updated>2024-11-19T08:38:00Z</updated>

		<summary type="html">&lt;p&gt;Case: /* $info(name) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{sidebar foobar2000 title formatting}}&lt;br /&gt;
This article contains information about built-in title formatting functions and field references, plus additional documentation about fields and functions which can only be used in specific components or which are provided by specific components.&lt;br /&gt;
&lt;br /&gt;
Please see [[Foobar2000:Title Formatting Introduction|Title Formatting Introduction]] for a general overview of title format syntax and its basic rules. The article [[foobar2000:Titleformat Examples|Titleformat Examples]] offers user-submitted examples of code for specific purposes; feel free to add your own if you think it can be of use to others.&lt;br /&gt;
&lt;br /&gt;
For details of the query syntax, which uses some of these fields to find files for playlists, etc., see the [[Foobar2000:Query_syntax|Query Syntax]] article.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
A title formatting script consists of any combination of literal text, field references, function calls, comments, and line break characters. The script always outputs a text string (which can be empty).&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;comment&#039;&#039;&#039; is a line starting with two slashes, e.g. {{code|// this is a comment}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;field reference&#039;&#039;&#039; is a field name enclosed in percent signs, for example {{code|%artist%}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;function call&#039;&#039;&#039; starts with a dollar sign, followed by the function name and the parameter list. A parameter list can either be empty – denoted as {{code|()}} – or contain one or more parameters separated by commas, for example {{code|$abbr(%artist%)}}. A parameter can be literal text, a field reference, or another function call. Note that there must be no whitespace between the dollar sign and the function name, or the function name and the opening parenthesis of the parameter list.&lt;br /&gt;
&lt;br /&gt;
Any other text is &#039;&#039;&#039;literal text&#039;&#039;&#039;. In literal text, the character {{code|%}}, {{code|$}}, {{code|[}}, {{code|]}}, or {{code|&#039;}} (apostrophe/single quote) must be escaped by enclosing it in {{code|&#039;}} (apostrophe/single quote) characters. For example, {{code|&#039;[&#039;}} (a left bracket in single quotes) results in a literal {{code|[}} (left bracket). As a special case, {{code|&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;}} (two single quotes in a row) results in one single quote. In the playlist, {{code|&amp;amp;lt;}} and {{code|&amp;amp;gt;}} are also special; see [[#Dimmed and highlighted text|Dimmed and highlighted text]].&lt;br /&gt;
&lt;br /&gt;
When the script is evaluated, the output string is assembled by evaluating the function parameters, function calls, and field references. Comments and line break characters (CR and LF/newline) are ignored; to output a line break, use {{code|$crlf()}}. Each field reference becomes the field&#039;s value, as a string. Each function becomes a string or number, and/or a truth value (not output) which can be used by another function.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The interface for entering custom columns and grouping schemes for the Default UI playlist does not support line breaks; scripts must be written all on one line, without comments.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Arithmetic functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string that can be interpreted as number. Leading whitespace is ignored. Decimal points are not supported. Examples:&lt;br /&gt;
* &#039;&#039;c3po&#039;&#039; → 0&lt;br /&gt;
* &#039;&#039;4.8&#039;&#039; → 4&lt;br /&gt;
* &#039;&#039;-12&#039;&#039; → -12&lt;br /&gt;
* &#039;&#039;- 12&#039;&#039; → 0&lt;br /&gt;
&lt;br /&gt;
=== $add(a,b, ...) ===&lt;br /&gt;
&lt;br /&gt;
Adds &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$add(a,b,...)&#039;&#039; is the same as &#039;&#039;$add($add(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $div(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Divides &#039;&#039;a&#039;&#039; by &#039;&#039;b&#039;&#039; and rounds down to an integer. If &#039;&#039;b&#039;&#039; evaluates to zero, it returns &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$div(a,b,...)&#039;&#039; is the same as &#039;&#039;$div($div(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $greater(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns true, if &#039;&#039;a&#039;&#039; is greater than &#039;&#039;b&#039;&#039;, otherwise false.&lt;br /&gt;
&lt;br /&gt;
=== $max(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the maximum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$max(a,b,...)&#039;&#039; is the same as &#039;&#039;$max($max(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $min(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the minimum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$min(a,b,...)&#039;&#039; is the same as &#039;&#039;$min($min(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mod(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Computes the remainder of dividing &#039;&#039;a&#039;&#039; through &#039;&#039;b&#039;&#039;. The result has the same sign as &#039;&#039;a&#039;&#039;. If &#039;&#039;b&#039;&#039; evaluates to zero, the result is &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mod(a,b,...)&#039;&#039; is the same as &#039;&#039;$mod($mod(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mul(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mul(a,b,...)&#039;&#039; is the same as &#039;&#039;$mul($mul(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $muldiv(a,b,c) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;, then divides by &#039;&#039;c&#039;&#039;. The result is rounded to the nearest integer.&lt;br /&gt;
&lt;br /&gt;
=== $rand() ===&lt;br /&gt;
&lt;br /&gt;
Generates a random number in the range from 0 to 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1. Available only in sort-related contexts, such as the &#039;&#039;Edit → Sort → Sort by ...&#039;&#039; menu command.&lt;br /&gt;
&lt;br /&gt;
=== $sub(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Subtracts &#039;&#039;b&#039;&#039; from &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$sub(a,b,...)&#039;&#039; is the same as &#039;&#039;$sub($sub(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Boolean functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to work with truth values (&#039;&#039;true&#039;&#039; and &#039;&#039;false&#039;&#039;), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with &#039;&#039;$if&#039;&#039; and related functions.&lt;br /&gt;
&lt;br /&gt;
Foobar does not have a concept of TRUE and FALSE in a programming language sense where 0 or empty string are considered FALSE and other values TRUE. Therefore there is no difference between numeric 0 and string representation &#039;0&#039; which both are considered as values, and being attached a boolean value FALSE. Apostrophes are only required to escape certain syntax characters. Values are treated as numbers during arithmetic operations like&#039;&#039; $add()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $and(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical And of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if and only if all &#039;&#039;expr&#039;&#039; arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $or(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if at least one expression evaluates to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $not(expr) ===&lt;br /&gt;
&lt;br /&gt;
Logical Not. Returns the logical opposite of EXPR: &#039;&#039;false&#039;&#039;, if &#039;&#039;expr&#039;&#039; is &#039;&#039;true&#039;&#039; and &#039;&#039;true&#039;&#039; if &#039;&#039;expr&#039;&#039; is false.&lt;br /&gt;
&lt;br /&gt;
=== $xor(expr,...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Exclusive-or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if an odd number of arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Special case: &#039;&#039;$xor(expr1,expr2)&#039;&#039; returns &#039;&#039;true&#039;&#039;, if EXPR1 or EXPR2 is &#039;&#039;true&#039;&#039;. If both expressions are true, returns &#039;&#039;false&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Control flow functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to conditionally execute statements.&lt;br /&gt;
&lt;br /&gt;
=== [...] (conditional section) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates the expression between &#039;&#039;[&#039;&#039; and &#039;&#039;]&#039;&#039;. If it has the truth value &#039;&#039;true&#039;&#039;, its string value and the truth value &#039;&#039;true&#039;&#039; are returned. Otherwise an empty string and &#039;&#039;false&#039;&#039; are returned.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;[%artist%]&#039;&#039; returns the value of the artist tag, if it exists. Otherwise it returns nothing, when &#039;&#039;artist&#039;&#039; would return &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
Plain strings are FALSE. Field lookups and functions can introduce a boolean value of TRUE. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Examples&amp;lt;/u&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;1&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #False: &lt;br /&gt;
 $if(0,True,False)&lt;br /&gt;
 # False: &lt;br /&gt;
 $if(&#039;0&#039;,True,False)&lt;br /&gt;
 # True or False: &lt;br /&gt;
 [$add(%rating%,1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The last one would display the value of %rating% plus one, if and only if %rating% is set for the track.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;2&amp;lt;/u&amp;gt;&lt;br /&gt;
Ignore inserting the %album artist%, if it contains the word &amp;quot;various&amp;quot;. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # Wrong: &lt;br /&gt;
 $if([%album artist%=Various],,%artist%-)&lt;br /&gt;
 # Good approach:&lt;br /&gt;
 $if($stricmp(%album artist%,Various),,%artist%-) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then,else) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $if2(expr,else) ===&lt;br /&gt;
&lt;br /&gt;
Like &#039;&#039;$if(expr,expr,else)&#039;&#039; except that &#039;&#039;expr&#039;&#039; is only evaluated once. In other words, if expression &#039;&#039;expr&#039;&#039; is true, &#039;&#039;expr&#039;&#039; is returned, otherwise the &#039;&#039;else&#039;&#039; part is evaluated and &#039;&#039;expr&#039;&#039; is returned as true.&lt;br /&gt;
&lt;br /&gt;
=== $if3(a1,a2,...,aN,else) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates arguments &#039;&#039;a1&#039;&#039; ... &#039;&#039;aN&#039;&#039;, until one is found that evaluates to &#039;&#039;true&#039;&#039;. If that happens, its value is returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifequal(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is equal to &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifgreater(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is greater than &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $iflonger(str,n,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the length of the string &#039;&#039;str&#039;&#039; to the number &#039;&#039;n&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;n&#039;&#039; characters, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $select(n,a1,...,aN) ===&lt;br /&gt;
&lt;br /&gt;
If the value of &#039;&#039;n&#039;&#039; is between 1 and N, &#039;&#039;an&#039;&#039; is evaluated and its value returned. Otherwise &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
== String functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to manipulate character strings.&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of string &#039;&#039;str&#039;&#039;. Words which begin with an alphanumeric character are shortened to the first character. Spaces and parentheses are stripped. Example:&lt;br /&gt;
* $abbr(&#039;This is a Long Title (12-inch version) [needs tags]&#039;) → TiaLT1v[needst&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters, otherwise returns &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $ansi(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.&lt;br /&gt;
&lt;br /&gt;
=== $ascii(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to ASCII. Any characters that are not present in ASCII will be removed / replaced.&lt;br /&gt;
&lt;br /&gt;
=== $caps(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and all other letters to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $caps2(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and leaves all other letters as they are.&lt;br /&gt;
&lt;br /&gt;
=== $char(nbr) ===&lt;br /&gt;
&lt;br /&gt;
Returns Unicode character of &#039;&#039;nbr&#039;&#039;. You can search for characters and find the matching decimal number on this [http://www.fileformat.info/info/unicode/char/search.htm site].&lt;br /&gt;
&lt;br /&gt;
=== $crc32(str) ===&lt;br /&gt;
&lt;br /&gt;
Computes the CRC32 of the string &#039;&#039;str&#039;&#039; as a number. Intended for use in coloring scripts.&lt;br /&gt;
&lt;br /&gt;
Example: $rgb($mod($crc32(%album%),256),128,128)&lt;br /&gt;
&lt;br /&gt;
=== $crlf() ===&lt;br /&gt;
&lt;br /&gt;
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system  notification area (&amp;quot;systray&amp;quot;) icon.&lt;br /&gt;
&lt;br /&gt;
=== $cut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $left(a,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $directory(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts only the directory name (not full path, ie given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;jazz&#039;) from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $directory(path,n) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory name from the file &#039;&#039;path&#039;&#039;; goes up by &#039;&#039;n&#039;&#039; levels.&lt;br /&gt;
&lt;br /&gt;
=== $directory_path(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory path from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
ie. given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;D:\music\jazz&#039;&lt;br /&gt;
&lt;br /&gt;
=== $ext(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file extension from string &#039;&#039;path&#039;&#039;; a file name or full path.&lt;br /&gt;
&lt;br /&gt;
=== $filename(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file name from full &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &amp;quot; (...)&amp;quot;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str,indicator) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &#039;&#039;indicator&#039;&#039;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $hex(int,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in hexadecimal notation with &#039;&#039;len&#039;&#039; digits. Pads with zeros from the left if necessary.&lt;br /&gt;
&lt;br /&gt;
=== $insert(str,insert,n) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;insert&#039;&#039; into &#039;&#039;str&#039;&#039; after &#039;&#039;n&#039;&#039; characters.&lt;br /&gt;
&lt;br /&gt;
=== $left(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $cut(str,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $len(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters.&lt;br /&gt;
&lt;br /&gt;
=== $len2(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters, respecting double-width character rules (double-width characters will be counted as two).&lt;br /&gt;
&lt;br /&gt;
=== $longer(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;true&#039;&#039;, if string &#039;&#039;str1&#039;&#039; is longer than string &#039;&#039;str2&#039;&#039;, false otherwise.&lt;br /&gt;
&lt;br /&gt;
=== $lower(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $longest(arg,...) ===&lt;br /&gt;
&lt;br /&gt;
Returns the longest of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $num(nbr,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;nbr&#039;&#039; in decimal notation with &#039;&#039;len&#039;&#039; characters. Pads with zeros from the left if necessary. &#039;&#039;len&#039;&#039; includes the dash when the number is negative. If &#039;&#039;nbr&#039;&#039; is not numeric, it is treated as zero. Examples:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;$num(123,5)&#039;&#039; → 00123&lt;br /&gt;
* &#039;&#039;$num(-123,5)&#039;&#039; → -0123&lt;br /&gt;
* &#039;&#039;$num(4.8,5)&#039;&#039; → 00004&lt;br /&gt;
* &#039;&#039;$num(A1,5)&#039;&#039; → 00000&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $progress(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with.&lt;br /&gt;
&lt;br /&gt;
Example:&#039;&#039;$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,&#039;#&#039;,&#039;=&#039;)&#039;&#039; produces &amp;quot;====#===============&amp;quot;, the # character is moving with playback position.&lt;br /&gt;
&lt;br /&gt;
=== $progress2(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with. Produces different appearance than &#039;&#039;$progress&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $repeat(expr,count) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;count&#039;&#039; copies of &#039;&#039;expr&#039;&#039;. Note that &#039;&#039;expr&#039;&#039; is evaluated once before its value is used, so &#039;&#039;$repeat&#039;&#039; cannot be used for loops.&lt;br /&gt;
&lt;br /&gt;
=== $replace(str,search,replace) ===&lt;br /&gt;
&lt;br /&gt;
Replaces all occurrences of string &#039;&#039;search&#039;&#039; in string &#039;&#039;str&#039;&#039; with string &#039;&#039;replace&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can also be used with an arbitrary number of arguments. Note that &#039;&#039;$replace(str,search1,replace1,search2,replace2)&#039;&#039; is generally not the same as &#039;&#039;$replace($replace(str,search1,replace1),search2,replace2)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$replace(ab,a,b,b,c)&#039;&#039; → &amp;quot;bc&amp;quot;, &#039;&#039;$replace($replace(ab,a,b),b,c)&#039;&#039; → &amp;quot;cc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== $right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first &#039;&#039;len&#039;&#039; characters from the right of string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $roman(int) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in roman notation.&lt;br /&gt;
&lt;br /&gt;
=== $rot13(str) ===&lt;br /&gt;
&lt;br /&gt;
Performs [http://en.wikipedia.org/wiki/ROT13 ROT13] transformation to given string.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$rot13(&#039;foobar2000&#039;)&#039;&#039; → &amp;quot;sbbone2000&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $shortest(str,...strN) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first shortest element of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $strchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strchr(abca,a)&#039;&#039; → 1&lt;br /&gt;
&lt;br /&gt;
=== $strrchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns positions of last occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strrchr(abca,a)&#039;&#039; → 4&lt;br /&gt;
&lt;br /&gt;
=== $strstr(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of string &#039;&#039;str2&#039;&#039; in string &#039;&#039;str1&#039;&#039;. Function is case-sensitive.&lt;br /&gt;
&lt;br /&gt;
=== $strcmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-sensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stricmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-insensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Removes the specified prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $substr(str,from,to) ===&lt;br /&gt;
&lt;br /&gt;
Returns substring of string &#039;&#039;str&#039;&#039;, starting from &#039;&#039;FROM&#039;&#039;-th character and ending at &#039;&#039;TO&#039;&#039;-th character.&lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Moves &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Moves the specified prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $trim(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes leading and trailing spaces from string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $tab() ===&lt;br /&gt;
&lt;br /&gt;
Inserts one tabulator character.&lt;br /&gt;
&lt;br /&gt;
=== $tab(count) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;count&#039;&#039; tabulator characters.&lt;br /&gt;
&lt;br /&gt;
=== $upper(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to uppercase.&lt;br /&gt;
&lt;br /&gt;
== Track info fields and functions ==&lt;br /&gt;
&lt;br /&gt;
The functions and fields in this section can be used to access information about tracks.&lt;br /&gt;
&lt;br /&gt;
=== Metadata fields and functions ===&lt;br /&gt;
&lt;br /&gt;
Generally, metadata from the files (whether in tags or a cue sheet) is mapped directly to a field which can be referenced case-insensitively. For example, the first tag named &#039;&#039;URL&#039;&#039; can be referenced as &#039;&#039;%url%&#039;&#039;, and the first standard comment tag can be referenced as &#039;&#039;%comment%&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following functions are also available for accessing metadata:&lt;br /&gt;
&lt;br /&gt;
==== $meta(name) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &amp;quot;, &amp;quot; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist)&#039;&#039; → &amp;quot;He, She, They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta(name,n) ====&lt;br /&gt;
Returns value of &#039;&#039;n&#039;&#039;-th (0,1,2 and so on) tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist,1)&#039;&#039; → &amp;quot;She&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039; + &#039;)&#039;&#039; → &amp;quot;He + She + They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep,lastsep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator between all but the last two values which are concatenated with &#039;&#039;lastsep&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039;, &#039;,&#039;, and &#039;)&#039;&#039; → &amp;quot;He, She, and They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_test(...) ====&lt;br /&gt;
Returns &#039;&#039;1&#039;&#039;, if all given tags exist, &#039;&#039;undefined&#039;&#039; otherwise.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_test(artist,title)&#039;&#039; → true&lt;br /&gt;
&lt;br /&gt;
==== $meta_num(name) ====&lt;br /&gt;
Returns the number of values for the tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_num(artist)&#039;&#039; → 3&lt;br /&gt;
&lt;br /&gt;
=== Remapped metadata fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields have special remapped values to make writing title format scripts more convenient:&lt;br /&gt;
&lt;br /&gt;
==== %album artist% ====&lt;br /&gt;
Name of the artist of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album artist&amp;quot;, &amp;quot;artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. The difference between this and &#039;&#039;%artist%&#039;&#039; is that &#039;&#039;%album artist%&#039;&#039; is intended for use where consistent value across entire album is needed even when per-track artists values vary.&lt;br /&gt;
&lt;br /&gt;
==== %album% ====&lt;br /&gt;
Name of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album&amp;quot;, &amp;quot;venue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %artist% ====&lt;br /&gt;
Name of the artist of the track. Checks following metadata fields, in this order: &amp;quot;artist&amp;quot;, &amp;quot;album artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. For a SHOUTcast stream which contains metadata, it is the StreamTitle up to the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %discnumber% ====&lt;br /&gt;
Index of disc specified track belongs to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %totaldiscs% ====&lt;br /&gt;
Index of total discs specified tracks belong to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %track artist% ====&lt;br /&gt;
Name of the artist of the track; present only if &#039;&#039;%album artist%&#039;&#039; is different than &#039;&#039;%artist%&#039;&#039; for specific track. Intended for use together with &#039;&#039;%album artist%&#039;&#039;, to indicate track-specific artist info, e.g. &amp;quot;%album artist% - %title%[ &#039;//&#039; %track artist%]&amp;quot;. In this case, the last part will be displayed only when track-specific artist info is present.&lt;br /&gt;
&lt;br /&gt;
==== %title% ====&lt;br /&gt;
Title of the track. If &amp;quot;title&amp;quot; metadata field is missing, file name is used instead. For a SHOUTcast stream which contains metadata, it is the StreamTitle after the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %tracknumber% ====&lt;br /&gt;
Two-digit index of specified track within the album. Available only when &amp;quot;tracknumber&amp;quot; field is present in track’s metadata. An extra &#039;0&#039; is placed in front of single digit track numbers (5 becomes 05) &amp;amp;ndash; otherwise the tracknumber field is returned unchanged (e.g. the following values remain as they are: 006, 05, 104, A3, two, -1, -).&lt;br /&gt;
&lt;br /&gt;
==== %track number% ====&lt;br /&gt;
Similar to %tracknumber%, however single digit track numbers are not reformatted to have an extra 0.&lt;br /&gt;
&lt;br /&gt;
==== %totaltracks% ====&lt;br /&gt;
Index of total tracks specified tracks belong to, within the album. Available only when &amp;quot;totaltracks&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
=== Technical information fields ===&lt;br /&gt;
&lt;br /&gt;
==== %bitrate% ====&lt;br /&gt;
Bitrate of the track in kilobits per second. VBR files will show a dynamic display for currently played track (outside of the playlist).&lt;br /&gt;
&lt;br /&gt;
==== %channels% ====&lt;br /&gt;
Number of channels in the track, as text; either &amp;quot;mono&amp;quot;, &amp;quot;stereo&amp;quot; for 1 or 2 channels, respectively, otherwise a number followed by &amp;quot;ch&amp;quot;, e.g. &amp;quot;6ch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %channel_mask% ====&lt;br /&gt;
Description of the used audio channels in the track, e.g. &amp;quot;FL FR FC LFE SL SR&amp;quot;. Introduced in foobar2000 preview 2024-06-30.&lt;br /&gt;
&lt;br /&gt;
==== %codec% ====&lt;br /&gt;
Name of codec used to encode the track, e.g. &amp;quot;PCM&amp;quot;, &amp;quot;FLAC&amp;quot;, &amp;quot;MP3&amp;quot;, or &amp;quot;AAC&amp;quot;. If exact codec name is not available, file extension is used.&lt;br /&gt;
&lt;br /&gt;
==== %codec_profile% ====&lt;br /&gt;
Additional information about encoding settings used, e.g. &amp;quot;CBR&amp;quot;. Not always available.&lt;br /&gt;
&lt;br /&gt;
==== %codec_long% ====&lt;br /&gt;
Long name of the codec, including profile, e.g. &amp;quot;HE-AACv2&amp;quot;. Some codecs, such as HE-AAC, supply this. If long name isn&#039;t supplied by the codec, %codec_long% falls back to %codec% / %codec_profile%. The Default UI&#039;s standard Codec column displays the same info.&lt;br /&gt;
&lt;br /&gt;
==== %filesize% ====&lt;br /&gt;
The exact file size in bytes.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_filesize%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %filesize_natural% ====&lt;br /&gt;
The approximate file size, automatically formatted in appropriate units such as megabytes or kilobytes, e.g. &amp;quot;8.49 MB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %length% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_ex% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, seconds, and milliseconds, rounded to the nearest millisecond.&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds% ====&lt;br /&gt;
The length of the track in seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds_fp% ====&lt;br /&gt;
The length of the track in seconds as a floating point number.&lt;br /&gt;
&lt;br /&gt;
==== %length_samples% ====&lt;br /&gt;
The length of the track in samples.&lt;br /&gt;
&lt;br /&gt;
==== %samplerate% ====&lt;br /&gt;
Sample rate of the track, in Hz.&lt;br /&gt;
&lt;br /&gt;
=== Technical information functions ===&lt;br /&gt;
&lt;br /&gt;
==== $info(name) ====&lt;br /&gt;
Returns value of technical information field called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For convenience, the &#039;&#039;&#039;%__name%&#039;&#039;&#039; alias is also available.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$info(channels)&#039;&#039; → 2&lt;br /&gt;
&lt;br /&gt;
Here is an &#039;&#039;&#039;informative&#039;&#039;&#039; list of recognized fields. Some of these depend on the media file type being queried.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! field name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;General&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|codec&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; MP3)&lt;br /&gt;
|-&lt;br /&gt;
|codec_profile&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec Profile&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; CBR)&lt;br /&gt;
|-&lt;br /&gt;
|samplerate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Sample Rate&#039;&#039;&#039;, in hertz (&#039;&#039;e.g.&#039;&#039; 44100)&lt;br /&gt;
|-&lt;br /&gt;
|bitrate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bitrate&#039;&#039;&#039;, in kilobits per second (&#039;&#039;e.g.&#039;&#039; 320)&lt;br /&gt;
|-&lt;br /&gt;
|tool&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tool&#039;&#039;&#039; used to produce the file, possibly guessed (&#039;&#039;e.g.&#039;&#039; LAME3.97)&lt;br /&gt;
|-&lt;br /&gt;
|encoding&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Encoding&#039;&#039;&#039; lossiness (&#039;&#039;e.g.&#039;&#039; lossy)&lt;br /&gt;
|-&lt;br /&gt;
|channels&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channels&#039;&#039;&#039; count (&#039;&#039;e.g.&#039;&#039; 2 &amp;lt;nowiki&amp;gt;[for stereo]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 16)&lt;br /&gt;
|-&lt;br /&gt;
|decoded_bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039;  after decoding (&#039;&#039;e.g.&#039;&#039; 24)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample_extra&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Format&#039;&#039;&#039;  of 32-bit audio data (floating-point or fixed-point)&lt;br /&gt;
|-&lt;br /&gt;
|tagtype&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tag Type&#039;&#039;&#039;, comma-separated list of tag formats (&#039;&#039;e.g.&#039;&#039; id3v2|apev2)&lt;br /&gt;
|-&lt;br /&gt;
|cue_embedded&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Embedded Cuesheet&#039;&#039;&#039; presence (&#039;&#039;e.g.&#039;&#039; no &amp;lt;nowiki&amp;gt;[may be empty!]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|md5&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Audio MD5&#039;&#039;&#039; hash, if container defines it (&#039;&#039;e.g.&#039;&#039; 1E24A910D91EF09A8CF403C9B6963961)&lt;br /&gt;
|-&lt;br /&gt;
|WAVEFORMATEXTENSIBLE_CHANNEL_MASK&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel mask&#039;&#039;&#039;, channel layout of the track coded as hex (&#039;&#039;e.g.&#039;&#039; 0x0003 for regular stereo)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ENC_DELAY&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_delay&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 576)&lt;br /&gt;
|-&lt;br /&gt;
|ENC_PADDING&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_padding&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 1536)&lt;br /&gt;
|-&lt;br /&gt;
|MP3_ACCURATE_LENGTH&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|MP3 duration (%length% etc.) takes into account LAME or iTunes gapless playback info (&#039;&#039;e.g.&#039;&#039; yes)*&lt;br /&gt;
|-&lt;br /&gt;
|MP3_STEREO_MODE&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|Stereo mode used in MP3 file (&#039;&#039;e.g.&#039;&#039; mono, stereo, joint stereo, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|VERSION&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Version&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 3.99)&lt;br /&gt;
|-&lt;br /&gt;
|FLAGS&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Flags&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 22)&lt;br /&gt;
|-&lt;br /&gt;
|channel_mode&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel Mode&#039;&#039;&#039;, description of channels (note: this field was only used by obsolete foo_ac3. &#039;&#039;e.g.&#039;&#039; 3 front, 2 rear surround channels + LFE)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 90%&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; &#039;&#039;MP3_ACCURATE_LENGTH won&#039;t exist if gapless playback info isn&#039;t present or the file is not an MP3. The info can be in a LAME tag in the VBR header, or in an iTunSMPB ID3v2 comment tag. Gapless playback info is taken into account in .m4a files, but there&#039;s no special field to say so.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== $channels() ====&lt;br /&gt;
The number of channels in text format.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$channels()&#039;&#039; → &amp;quot;stereo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_gain% ====&lt;br /&gt;
The ReplayGain album gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak% ====&lt;br /&gt;
The ReplayGain album peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak_db% ====&lt;br /&gt;
The ReplayGain album peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_gain% ====&lt;br /&gt;
The ReplayGain track gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak% ====&lt;br /&gt;
The ReplayGain track peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak_db% ====&lt;br /&gt;
The ReplayGain track peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
=== Special fields ===&lt;br /&gt;
&lt;br /&gt;
==== %filename% ====&lt;br /&gt;
The filename without directory and extension.&lt;br /&gt;
&lt;br /&gt;
==== %filename_ext% ====&lt;br /&gt;
The filename with extension, but without the directory.&lt;br /&gt;
&lt;br /&gt;
==== %directoryname% ====&lt;br /&gt;
The name of the parent directory only, not the complete path.&lt;br /&gt;
&lt;br /&gt;
==== %last_modified% ====&lt;br /&gt;
The date and time the file was last modified. Eg: &#039;&#039;2005-12-22 00:04:10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== %path% ====&lt;br /&gt;
The complete path, including the filename and extension.&lt;br /&gt;
&lt;br /&gt;
==== %_path_raw% ====&lt;br /&gt;
The path as URL including the protocol scheme.&lt;br /&gt;
&lt;br /&gt;
==== %subsong% ====&lt;br /&gt;
The subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.&lt;br /&gt;
&lt;br /&gt;
==== %_foobar2000_version% ====&lt;br /&gt;
A string representing the version of foobar2000.&lt;br /&gt;
&lt;br /&gt;
== Time and date functions ==&lt;br /&gt;
&lt;br /&gt;
These functions are used to manipulate time/date strings, notably (but not limited to), [[Foobar2000:Titleformat_Playback_Statistics|those gathered]] by the [[Foobar2000:Components/Playback Statistics v3.x (foo playcount)|Playback Statistics component]].&lt;br /&gt;
&lt;br /&gt;
=== $year(time) ===&lt;br /&gt;
Retrieves the year part (formatted as four digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $month(time) ===&lt;br /&gt;
Retrieves the month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $day_of_month(time) ===&lt;br /&gt;
Retrieves the day of month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $date(time) ===&lt;br /&gt;
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $time(time) ===&lt;br /&gt;
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string.&lt;br /&gt;
&lt;br /&gt;
== Variable operations ==&lt;br /&gt;
&lt;br /&gt;
Variables can be used to store strings and numbers. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! code&lt;br /&gt;
! output&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre&amp;gt;$put(foo,bar)$char(10)&lt;br /&gt;
$get(foo)$char(10)&lt;br /&gt;
$get(Foo)$char(10)&lt;br /&gt;
$puts(foo,2000)$char(10)&lt;br /&gt;
$get(foo)$char(10)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot; |&amp;lt;pre&amp;gt;bar&lt;br /&gt;
bar&lt;br /&gt;
bar&lt;br /&gt;
&lt;br /&gt;
2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== $get(name) ===&lt;br /&gt;
Returns the value that was last stored in the variable &#039;&#039;name&#039;&#039;, if the variable was not defined (yet), it returns nothing. The truth value returned by &#039;&#039;$get&#039;&#039; indicates if the variable &#039;&#039;name&#039;&#039; was defined and is a non-empty string.&lt;br /&gt;
&lt;br /&gt;
=== $put(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns &#039;&#039;value&#039;&#039; unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $puts(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns nothing.&lt;br /&gt;
&lt;br /&gt;
== Component-specific fields and functions ==&lt;br /&gt;
&lt;br /&gt;
This section lists fields and functions which are specific to certain components. Unless otherwise stated, the fields and functions are only usable in the context of those components.&lt;br /&gt;
&lt;br /&gt;
=== Now playing info ===&lt;br /&gt;
&lt;br /&gt;
The following fields related to the currently playing item are only usable in certain locations outside of the playlist, e.g. in the status bar, the main window title and the copy command script.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time% ====&lt;br /&gt;
The elapsed time formatted as [HH:]MM:SS.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_seconds% ====&lt;br /&gt;
The elapsed time in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_elapsed%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining% ====&lt;br /&gt;
The time remaining until the track ends, formatted as [HH:]MM:SS.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining_seconds% ====&lt;br /&gt;
The time remaining until the track ends, in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Playlist-only fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields are only usable in playlist display formatting (i.e., the column title formatting patterns).&lt;br /&gt;
&lt;br /&gt;
==== %isplaying% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if file is currently playing, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %ispaused% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if playback is paused, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %list_index% ====&lt;br /&gt;
A zero-padded playlist index of specified item. The first item is at index 1.&lt;br /&gt;
&lt;br /&gt;
==== %list_total% ====&lt;br /&gt;
The number of items in the playlist.&lt;br /&gt;
&lt;br /&gt;
==== %queue_index% ====&lt;br /&gt;
Index of the specified item in the playback queue. If the item has been queued multiple times, %queue_index% evaluates to the first index.&lt;br /&gt;
&lt;br /&gt;
==== %queue_indexes% ====&lt;br /&gt;
List of indexes of the specified item in the playback queue. Same as %queue_index% unless the item has been queued more than once.&lt;br /&gt;
&lt;br /&gt;
==== %queue_total% ====&lt;br /&gt;
Total amount of tracks in playback queue. Available only for queued tracks, for technical reasons. &lt;br /&gt;
&lt;br /&gt;
=== Playlist text color ===&lt;br /&gt;
&lt;br /&gt;
==== Dimmed and highlighted text ====&lt;br /&gt;
&lt;br /&gt;
In the Default UI playlist, text color can be adjusted by enclosing it in angle-brackets. The only options are to make the text dimmer (mixing the default color with the background color) or brighter (mixing the default color with the highlight color):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;text&amp;gt;&#039;&#039; – dim &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&#039;&#039; – dimmer &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&amp;gt;&#039;&#039; – dimmest &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;text&amp;amp;lt;&#039;&#039; – bright &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brighter &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brightest &#039;&#039;text&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Historical and Columns UI color functions ====&lt;br /&gt;
&lt;br /&gt;
Prior to version 1.0, the default UI playlist supported the following color functions, which are still available in the Columns UI playlist:&lt;br /&gt;
&lt;br /&gt;
===== $blend(color1,color2,part,total) =====&lt;br /&gt;
Returns a color that is a blend between &#039;&#039;color1&#039;&#039; and &#039;&#039;color2&#039;&#039;. If &#039;&#039;part&#039;&#039; is smaller than or equal to zero, &#039;&#039;color1&#039;&#039; is returned. If &#039;&#039;part&#039;&#039; is greater than or equal to &#039;&#039;total&#039;&#039;, &#039;&#039;color2&#039;&#039; is returned. Otherwise a blended color is returned that is &#039;&#039;part&#039;&#039; parts &#039;&#039;color1&#039;&#039; and &#039;&#039;total&#039;&#039;-&#039;&#039;part&#039;&#039; parts &#039;&#039;color2&#039;&#039;. The blending is performed in the RGB color space.&lt;br /&gt;
&lt;br /&gt;
===== $hsl() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h,s,l) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039; and &#039;&#039;l&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
The ranges of &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039;, and &#039;&#039;l&#039;&#039; are from 0 to 240; the function is designed to interpret those values in the same way as the standard Windows color dialog.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h1,s1,l1,h2,s2,l2) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h1&#039;&#039;, &#039;&#039;s1&#039;&#039; and &#039;&#039;l1&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. &#039;&#039;h2&#039;&#039;, &#039;&#039;s2&#039;&#039; and &#039;&#039;l2&#039;&#039; are the hue, saturation, and lightness of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $rgb() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r,g,b) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r&#039;&#039;, &#039;&#039;g&#039;&#039; and &#039;&#039;b&#039;&#039; are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r1,g1,b1,r2,g2,b2) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r1&#039;&#039;, &#039;&#039;g1&#039;&#039; and &#039;&#039;b1&#039;&#039; are the red, green and blue component of the color for unselected text. &#039;&#039;r2&#039;&#039;, &#039;&#039;g2&#039;&#039; and &#039;&#039;b2&#039;&#039; are the red, green and blue component of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $transition(string,color1,color2) =====&lt;br /&gt;
Inserts color codes into &#039;&#039;string&#039;&#039;, so that the first character has &#039;&#039;color1&#039;&#039;, the last character has &#039;&#039;color2&#039;&#039;, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying &#039;&#039;$transition&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Album List ===&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Titleformat_Album_List|Album List Title Formatting]]&lt;br /&gt;
* [[Foobar2000:Preferences:Album List|Preferences: Album List]]&lt;br /&gt;
&lt;br /&gt;
=== Playback Statistics ===&lt;br /&gt;
&lt;br /&gt;
The foo_playcount component adds a number of fields for playback statistics and ratings. The fields can be used anywhere track info can be displayed. See the documentation for details:&lt;br /&gt;
* [http://www.foobar2000.org/components/view/foo_playcount Playback statistics homepage]&lt;br /&gt;
* [[Foobar2000:Titleformat Playback Statistics|Playback statistics titleformat reference]]&lt;br /&gt;
&lt;br /&gt;
=== Playlist Organizer ===&lt;br /&gt;
&lt;br /&gt;
This component adds a number of fields to control the display of a list of playlists. See the documentation for details:&lt;br /&gt;
* [[Foobar2000:Components/Playlist Organizer (foo_plorg)#Nodes|Playlist Organizer: Nodes Title Formatting]]&lt;br /&gt;
&lt;br /&gt;
=== Columns UI ===&lt;br /&gt;
&lt;br /&gt;
This component replaces the Default UI framework, including the playlist. See the documentation for details:&lt;br /&gt;
* [http://yuo.be/columns.php Columns UI homepage]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:global_variables Global variables reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:colour_string Playlist colors reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:playlist_switcher_titleformatting Playlist switcher reference]&lt;br /&gt;
&lt;br /&gt;
== Additional Reading ==&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Title Formatting Introduction|Introduction to titleformat scripts]]&lt;br /&gt;
* The file &#039;&#039;&#039;titleformat_help.html&#039;&#039;&#039; in your Foobar2000 directory, e.g. file:///C:/Program%20Files%20(x86)/foobar2000/titleformat_help.html&lt;br /&gt;
&lt;br /&gt;
[[Category:foobar2000 Guides|Titleformat Reference]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38285</id>
		<title>Foobar2000:Title Formatting Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38285"/>
		<updated>2024-11-19T08:36:45Z</updated>

		<summary type="html">&lt;p&gt;Case: /* $info(name) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{sidebar foobar2000 title formatting}}&lt;br /&gt;
This article contains information about built-in title formatting functions and field references, plus additional documentation about fields and functions which can only be used in specific components or which are provided by specific components.&lt;br /&gt;
&lt;br /&gt;
Please see [[Foobar2000:Title Formatting Introduction|Title Formatting Introduction]] for a general overview of title format syntax and its basic rules. The article [[foobar2000:Titleformat Examples|Titleformat Examples]] offers user-submitted examples of code for specific purposes; feel free to add your own if you think it can be of use to others.&lt;br /&gt;
&lt;br /&gt;
For details of the query syntax, which uses some of these fields to find files for playlists, etc., see the [[Foobar2000:Query_syntax|Query Syntax]] article.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
A title formatting script consists of any combination of literal text, field references, function calls, comments, and line break characters. The script always outputs a text string (which can be empty).&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;comment&#039;&#039;&#039; is a line starting with two slashes, e.g. {{code|// this is a comment}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;field reference&#039;&#039;&#039; is a field name enclosed in percent signs, for example {{code|%artist%}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;function call&#039;&#039;&#039; starts with a dollar sign, followed by the function name and the parameter list. A parameter list can either be empty – denoted as {{code|()}} – or contain one or more parameters separated by commas, for example {{code|$abbr(%artist%)}}. A parameter can be literal text, a field reference, or another function call. Note that there must be no whitespace between the dollar sign and the function name, or the function name and the opening parenthesis of the parameter list.&lt;br /&gt;
&lt;br /&gt;
Any other text is &#039;&#039;&#039;literal text&#039;&#039;&#039;. In literal text, the character {{code|%}}, {{code|$}}, {{code|[}}, {{code|]}}, or {{code|&#039;}} (apostrophe/single quote) must be escaped by enclosing it in {{code|&#039;}} (apostrophe/single quote) characters. For example, {{code|&#039;[&#039;}} (a left bracket in single quotes) results in a literal {{code|[}} (left bracket). As a special case, {{code|&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;}} (two single quotes in a row) results in one single quote. In the playlist, {{code|&amp;amp;lt;}} and {{code|&amp;amp;gt;}} are also special; see [[#Dimmed and highlighted text|Dimmed and highlighted text]].&lt;br /&gt;
&lt;br /&gt;
When the script is evaluated, the output string is assembled by evaluating the function parameters, function calls, and field references. Comments and line break characters (CR and LF/newline) are ignored; to output a line break, use {{code|$crlf()}}. Each field reference becomes the field&#039;s value, as a string. Each function becomes a string or number, and/or a truth value (not output) which can be used by another function.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The interface for entering custom columns and grouping schemes for the Default UI playlist does not support line breaks; scripts must be written all on one line, without comments.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Arithmetic functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string that can be interpreted as number. Leading whitespace is ignored. Decimal points are not supported. Examples:&lt;br /&gt;
* &#039;&#039;c3po&#039;&#039; → 0&lt;br /&gt;
* &#039;&#039;4.8&#039;&#039; → 4&lt;br /&gt;
* &#039;&#039;-12&#039;&#039; → -12&lt;br /&gt;
* &#039;&#039;- 12&#039;&#039; → 0&lt;br /&gt;
&lt;br /&gt;
=== $add(a,b, ...) ===&lt;br /&gt;
&lt;br /&gt;
Adds &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$add(a,b,...)&#039;&#039; is the same as &#039;&#039;$add($add(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $div(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Divides &#039;&#039;a&#039;&#039; by &#039;&#039;b&#039;&#039; and rounds down to an integer. If &#039;&#039;b&#039;&#039; evaluates to zero, it returns &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$div(a,b,...)&#039;&#039; is the same as &#039;&#039;$div($div(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $greater(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns true, if &#039;&#039;a&#039;&#039; is greater than &#039;&#039;b&#039;&#039;, otherwise false.&lt;br /&gt;
&lt;br /&gt;
=== $max(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the maximum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$max(a,b,...)&#039;&#039; is the same as &#039;&#039;$max($max(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $min(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the minimum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$min(a,b,...)&#039;&#039; is the same as &#039;&#039;$min($min(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mod(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Computes the remainder of dividing &#039;&#039;a&#039;&#039; through &#039;&#039;b&#039;&#039;. The result has the same sign as &#039;&#039;a&#039;&#039;. If &#039;&#039;b&#039;&#039; evaluates to zero, the result is &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mod(a,b,...)&#039;&#039; is the same as &#039;&#039;$mod($mod(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mul(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mul(a,b,...)&#039;&#039; is the same as &#039;&#039;$mul($mul(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $muldiv(a,b,c) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;, then divides by &#039;&#039;c&#039;&#039;. The result is rounded to the nearest integer.&lt;br /&gt;
&lt;br /&gt;
=== $rand() ===&lt;br /&gt;
&lt;br /&gt;
Generates a random number in the range from 0 to 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1. Available only in sort-related contexts, such as the &#039;&#039;Edit → Sort → Sort by ...&#039;&#039; menu command.&lt;br /&gt;
&lt;br /&gt;
=== $sub(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Subtracts &#039;&#039;b&#039;&#039; from &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$sub(a,b,...)&#039;&#039; is the same as &#039;&#039;$sub($sub(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Boolean functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to work with truth values (&#039;&#039;true&#039;&#039; and &#039;&#039;false&#039;&#039;), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with &#039;&#039;$if&#039;&#039; and related functions.&lt;br /&gt;
&lt;br /&gt;
Foobar does not have a concept of TRUE and FALSE in a programming language sense where 0 or empty string are considered FALSE and other values TRUE. Therefore there is no difference between numeric 0 and string representation &#039;0&#039; which both are considered as values, and being attached a boolean value FALSE. Apostrophes are only required to escape certain syntax characters. Values are treated as numbers during arithmetic operations like&#039;&#039; $add()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $and(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical And of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if and only if all &#039;&#039;expr&#039;&#039; arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $or(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if at least one expression evaluates to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $not(expr) ===&lt;br /&gt;
&lt;br /&gt;
Logical Not. Returns the logical opposite of EXPR: &#039;&#039;false&#039;&#039;, if &#039;&#039;expr&#039;&#039; is &#039;&#039;true&#039;&#039; and &#039;&#039;true&#039;&#039; if &#039;&#039;expr&#039;&#039; is false.&lt;br /&gt;
&lt;br /&gt;
=== $xor(expr,...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Exclusive-or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if an odd number of arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Special case: &#039;&#039;$xor(expr1,expr2)&#039;&#039; returns &#039;&#039;true&#039;&#039;, if EXPR1 or EXPR2 is &#039;&#039;true&#039;&#039;. If both expressions are true, returns &#039;&#039;false&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Control flow functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to conditionally execute statements.&lt;br /&gt;
&lt;br /&gt;
=== [...] (conditional section) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates the expression between &#039;&#039;[&#039;&#039; and &#039;&#039;]&#039;&#039;. If it has the truth value &#039;&#039;true&#039;&#039;, its string value and the truth value &#039;&#039;true&#039;&#039; are returned. Otherwise an empty string and &#039;&#039;false&#039;&#039; are returned.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;[%artist%]&#039;&#039; returns the value of the artist tag, if it exists. Otherwise it returns nothing, when &#039;&#039;artist&#039;&#039; would return &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
Plain strings are FALSE. Field lookups and functions can introduce a boolean value of TRUE. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Examples&amp;lt;/u&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;1&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #False: &lt;br /&gt;
 $if(0,True,False)&lt;br /&gt;
 # False: &lt;br /&gt;
 $if(&#039;0&#039;,True,False)&lt;br /&gt;
 # True or False: &lt;br /&gt;
 [$add(%rating%,1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The last one would display the value of %rating% plus one, if and only if %rating% is set for the track.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;2&amp;lt;/u&amp;gt;&lt;br /&gt;
Ignore inserting the %album artist%, if it contains the word &amp;quot;various&amp;quot;. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # Wrong: &lt;br /&gt;
 $if([%album artist%=Various],,%artist%-)&lt;br /&gt;
 # Good approach:&lt;br /&gt;
 $if($stricmp(%album artist%,Various),,%artist%-) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then,else) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $if2(expr,else) ===&lt;br /&gt;
&lt;br /&gt;
Like &#039;&#039;$if(expr,expr,else)&#039;&#039; except that &#039;&#039;expr&#039;&#039; is only evaluated once. In other words, if expression &#039;&#039;expr&#039;&#039; is true, &#039;&#039;expr&#039;&#039; is returned, otherwise the &#039;&#039;else&#039;&#039; part is evaluated and &#039;&#039;expr&#039;&#039; is returned as true.&lt;br /&gt;
&lt;br /&gt;
=== $if3(a1,a2,...,aN,else) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates arguments &#039;&#039;a1&#039;&#039; ... &#039;&#039;aN&#039;&#039;, until one is found that evaluates to &#039;&#039;true&#039;&#039;. If that happens, its value is returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifequal(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is equal to &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifgreater(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is greater than &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $iflonger(str,n,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the length of the string &#039;&#039;str&#039;&#039; to the number &#039;&#039;n&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;n&#039;&#039; characters, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $select(n,a1,...,aN) ===&lt;br /&gt;
&lt;br /&gt;
If the value of &#039;&#039;n&#039;&#039; is between 1 and N, &#039;&#039;an&#039;&#039; is evaluated and its value returned. Otherwise &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
== String functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to manipulate character strings.&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of string &#039;&#039;str&#039;&#039;. Words which begin with an alphanumeric character are shortened to the first character. Spaces and parentheses are stripped. Example:&lt;br /&gt;
* $abbr(&#039;This is a Long Title (12-inch version) [needs tags]&#039;) → TiaLT1v[needst&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters, otherwise returns &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $ansi(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.&lt;br /&gt;
&lt;br /&gt;
=== $ascii(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to ASCII. Any characters that are not present in ASCII will be removed / replaced.&lt;br /&gt;
&lt;br /&gt;
=== $caps(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and all other letters to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $caps2(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and leaves all other letters as they are.&lt;br /&gt;
&lt;br /&gt;
=== $char(nbr) ===&lt;br /&gt;
&lt;br /&gt;
Returns Unicode character of &#039;&#039;nbr&#039;&#039;. You can search for characters and find the matching decimal number on this [http://www.fileformat.info/info/unicode/char/search.htm site].&lt;br /&gt;
&lt;br /&gt;
=== $crc32(str) ===&lt;br /&gt;
&lt;br /&gt;
Computes the CRC32 of the string &#039;&#039;str&#039;&#039; as a number. Intended for use in coloring scripts.&lt;br /&gt;
&lt;br /&gt;
Example: $rgb($mod($crc32(%album%),256),128,128)&lt;br /&gt;
&lt;br /&gt;
=== $crlf() ===&lt;br /&gt;
&lt;br /&gt;
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system  notification area (&amp;quot;systray&amp;quot;) icon.&lt;br /&gt;
&lt;br /&gt;
=== $cut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $left(a,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $directory(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts only the directory name (not full path, ie given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;jazz&#039;) from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $directory(path,n) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory name from the file &#039;&#039;path&#039;&#039;; goes up by &#039;&#039;n&#039;&#039; levels.&lt;br /&gt;
&lt;br /&gt;
=== $directory_path(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory path from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
ie. given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;D:\music\jazz&#039;&lt;br /&gt;
&lt;br /&gt;
=== $ext(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file extension from string &#039;&#039;path&#039;&#039;; a file name or full path.&lt;br /&gt;
&lt;br /&gt;
=== $filename(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file name from full &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &amp;quot; (...)&amp;quot;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str,indicator) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &#039;&#039;indicator&#039;&#039;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $hex(int,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in hexadecimal notation with &#039;&#039;len&#039;&#039; digits. Pads with zeros from the left if necessary.&lt;br /&gt;
&lt;br /&gt;
=== $insert(str,insert,n) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;insert&#039;&#039; into &#039;&#039;str&#039;&#039; after &#039;&#039;n&#039;&#039; characters.&lt;br /&gt;
&lt;br /&gt;
=== $left(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $cut(str,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $len(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters.&lt;br /&gt;
&lt;br /&gt;
=== $len2(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters, respecting double-width character rules (double-width characters will be counted as two).&lt;br /&gt;
&lt;br /&gt;
=== $longer(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;true&#039;&#039;, if string &#039;&#039;str1&#039;&#039; is longer than string &#039;&#039;str2&#039;&#039;, false otherwise.&lt;br /&gt;
&lt;br /&gt;
=== $lower(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $longest(arg,...) ===&lt;br /&gt;
&lt;br /&gt;
Returns the longest of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $num(nbr,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;nbr&#039;&#039; in decimal notation with &#039;&#039;len&#039;&#039; characters. Pads with zeros from the left if necessary. &#039;&#039;len&#039;&#039; includes the dash when the number is negative. If &#039;&#039;nbr&#039;&#039; is not numeric, it is treated as zero. Examples:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;$num(123,5)&#039;&#039; → 00123&lt;br /&gt;
* &#039;&#039;$num(-123,5)&#039;&#039; → -0123&lt;br /&gt;
* &#039;&#039;$num(4.8,5)&#039;&#039; → 00004&lt;br /&gt;
* &#039;&#039;$num(A1,5)&#039;&#039; → 00000&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $progress(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with.&lt;br /&gt;
&lt;br /&gt;
Example:&#039;&#039;$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,&#039;#&#039;,&#039;=&#039;)&#039;&#039; produces &amp;quot;====#===============&amp;quot;, the # character is moving with playback position.&lt;br /&gt;
&lt;br /&gt;
=== $progress2(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with. Produces different appearance than &#039;&#039;$progress&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $repeat(expr,count) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;count&#039;&#039; copies of &#039;&#039;expr&#039;&#039;. Note that &#039;&#039;expr&#039;&#039; is evaluated once before its value is used, so &#039;&#039;$repeat&#039;&#039; cannot be used for loops.&lt;br /&gt;
&lt;br /&gt;
=== $replace(str,search,replace) ===&lt;br /&gt;
&lt;br /&gt;
Replaces all occurrences of string &#039;&#039;search&#039;&#039; in string &#039;&#039;str&#039;&#039; with string &#039;&#039;replace&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can also be used with an arbitrary number of arguments. Note that &#039;&#039;$replace(str,search1,replace1,search2,replace2)&#039;&#039; is generally not the same as &#039;&#039;$replace($replace(str,search1,replace1),search2,replace2)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$replace(ab,a,b,b,c)&#039;&#039; → &amp;quot;bc&amp;quot;, &#039;&#039;$replace($replace(ab,a,b),b,c)&#039;&#039; → &amp;quot;cc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== $right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first &#039;&#039;len&#039;&#039; characters from the right of string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $roman(int) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in roman notation.&lt;br /&gt;
&lt;br /&gt;
=== $rot13(str) ===&lt;br /&gt;
&lt;br /&gt;
Performs [http://en.wikipedia.org/wiki/ROT13 ROT13] transformation to given string.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$rot13(&#039;foobar2000&#039;)&#039;&#039; → &amp;quot;sbbone2000&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $shortest(str,...strN) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first shortest element of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $strchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strchr(abca,a)&#039;&#039; → 1&lt;br /&gt;
&lt;br /&gt;
=== $strrchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns positions of last occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strrchr(abca,a)&#039;&#039; → 4&lt;br /&gt;
&lt;br /&gt;
=== $strstr(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of string &#039;&#039;str2&#039;&#039; in string &#039;&#039;str1&#039;&#039;. Function is case-sensitive.&lt;br /&gt;
&lt;br /&gt;
=== $strcmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-sensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stricmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-insensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Removes the specified prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $substr(str,from,to) ===&lt;br /&gt;
&lt;br /&gt;
Returns substring of string &#039;&#039;str&#039;&#039;, starting from &#039;&#039;FROM&#039;&#039;-th character and ending at &#039;&#039;TO&#039;&#039;-th character.&lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Moves &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Moves the specified prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $trim(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes leading and trailing spaces from string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $tab() ===&lt;br /&gt;
&lt;br /&gt;
Inserts one tabulator character.&lt;br /&gt;
&lt;br /&gt;
=== $tab(count) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;count&#039;&#039; tabulator characters.&lt;br /&gt;
&lt;br /&gt;
=== $upper(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to uppercase.&lt;br /&gt;
&lt;br /&gt;
== Track info fields and functions ==&lt;br /&gt;
&lt;br /&gt;
The functions and fields in this section can be used to access information about tracks.&lt;br /&gt;
&lt;br /&gt;
=== Metadata fields and functions ===&lt;br /&gt;
&lt;br /&gt;
Generally, metadata from the files (whether in tags or a cue sheet) is mapped directly to a field which can be referenced case-insensitively. For example, the first tag named &#039;&#039;URL&#039;&#039; can be referenced as &#039;&#039;%url%&#039;&#039;, and the first standard comment tag can be referenced as &#039;&#039;%comment%&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following functions are also available for accessing metadata:&lt;br /&gt;
&lt;br /&gt;
==== $meta(name) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &amp;quot;, &amp;quot; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist)&#039;&#039; → &amp;quot;He, She, They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta(name,n) ====&lt;br /&gt;
Returns value of &#039;&#039;n&#039;&#039;-th (0,1,2 and so on) tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist,1)&#039;&#039; → &amp;quot;She&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039; + &#039;)&#039;&#039; → &amp;quot;He + She + They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep,lastsep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator between all but the last two values which are concatenated with &#039;&#039;lastsep&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039;, &#039;,&#039;, and &#039;)&#039;&#039; → &amp;quot;He, She, and They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_test(...) ====&lt;br /&gt;
Returns &#039;&#039;1&#039;&#039;, if all given tags exist, &#039;&#039;undefined&#039;&#039; otherwise.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_test(artist,title)&#039;&#039; → true&lt;br /&gt;
&lt;br /&gt;
==== $meta_num(name) ====&lt;br /&gt;
Returns the number of values for the tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_num(artist)&#039;&#039; → 3&lt;br /&gt;
&lt;br /&gt;
=== Remapped metadata fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields have special remapped values to make writing title format scripts more convenient:&lt;br /&gt;
&lt;br /&gt;
==== %album artist% ====&lt;br /&gt;
Name of the artist of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album artist&amp;quot;, &amp;quot;artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. The difference between this and &#039;&#039;%artist%&#039;&#039; is that &#039;&#039;%album artist%&#039;&#039; is intended for use where consistent value across entire album is needed even when per-track artists values vary.&lt;br /&gt;
&lt;br /&gt;
==== %album% ====&lt;br /&gt;
Name of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album&amp;quot;, &amp;quot;venue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %artist% ====&lt;br /&gt;
Name of the artist of the track. Checks following metadata fields, in this order: &amp;quot;artist&amp;quot;, &amp;quot;album artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. For a SHOUTcast stream which contains metadata, it is the StreamTitle up to the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %discnumber% ====&lt;br /&gt;
Index of disc specified track belongs to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %totaldiscs% ====&lt;br /&gt;
Index of total discs specified tracks belong to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %track artist% ====&lt;br /&gt;
Name of the artist of the track; present only if &#039;&#039;%album artist%&#039;&#039; is different than &#039;&#039;%artist%&#039;&#039; for specific track. Intended for use together with &#039;&#039;%album artist%&#039;&#039;, to indicate track-specific artist info, e.g. &amp;quot;%album artist% - %title%[ &#039;//&#039; %track artist%]&amp;quot;. In this case, the last part will be displayed only when track-specific artist info is present.&lt;br /&gt;
&lt;br /&gt;
==== %title% ====&lt;br /&gt;
Title of the track. If &amp;quot;title&amp;quot; metadata field is missing, file name is used instead. For a SHOUTcast stream which contains metadata, it is the StreamTitle after the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %tracknumber% ====&lt;br /&gt;
Two-digit index of specified track within the album. Available only when &amp;quot;tracknumber&amp;quot; field is present in track’s metadata. An extra &#039;0&#039; is placed in front of single digit track numbers (5 becomes 05) &amp;amp;ndash; otherwise the tracknumber field is returned unchanged (e.g. the following values remain as they are: 006, 05, 104, A3, two, -1, -).&lt;br /&gt;
&lt;br /&gt;
==== %track number% ====&lt;br /&gt;
Similar to %tracknumber%, however single digit track numbers are not reformatted to have an extra 0.&lt;br /&gt;
&lt;br /&gt;
==== %totaltracks% ====&lt;br /&gt;
Index of total tracks specified tracks belong to, within the album. Available only when &amp;quot;totaltracks&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
=== Technical information fields ===&lt;br /&gt;
&lt;br /&gt;
==== %bitrate% ====&lt;br /&gt;
Bitrate of the track in kilobits per second. VBR files will show a dynamic display for currently played track (outside of the playlist).&lt;br /&gt;
&lt;br /&gt;
==== %channels% ====&lt;br /&gt;
Number of channels in the track, as text; either &amp;quot;mono&amp;quot;, &amp;quot;stereo&amp;quot; for 1 or 2 channels, respectively, otherwise a number followed by &amp;quot;ch&amp;quot;, e.g. &amp;quot;6ch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %channel_mask% ====&lt;br /&gt;
Description of the used audio channels in the track, e.g. &amp;quot;FL FR FC LFE SL SR&amp;quot;. Introduced in foobar2000 preview 2024-06-30.&lt;br /&gt;
&lt;br /&gt;
==== %codec% ====&lt;br /&gt;
Name of codec used to encode the track, e.g. &amp;quot;PCM&amp;quot;, &amp;quot;FLAC&amp;quot;, &amp;quot;MP3&amp;quot;, or &amp;quot;AAC&amp;quot;. If exact codec name is not available, file extension is used.&lt;br /&gt;
&lt;br /&gt;
==== %codec_profile% ====&lt;br /&gt;
Additional information about encoding settings used, e.g. &amp;quot;CBR&amp;quot;. Not always available.&lt;br /&gt;
&lt;br /&gt;
==== %codec_long% ====&lt;br /&gt;
Long name of the codec, including profile, e.g. &amp;quot;HE-AACv2&amp;quot;. Some codecs, such as HE-AAC, supply this. If long name isn&#039;t supplied by the codec, %codec_long% falls back to %codec% / %codec_profile%. The Default UI&#039;s standard Codec column displays the same info.&lt;br /&gt;
&lt;br /&gt;
==== %filesize% ====&lt;br /&gt;
The exact file size in bytes.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_filesize%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %filesize_natural% ====&lt;br /&gt;
The approximate file size, automatically formatted in appropriate units such as megabytes or kilobytes, e.g. &amp;quot;8.49 MB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %length% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_ex% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, seconds, and milliseconds, rounded to the nearest millisecond.&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds% ====&lt;br /&gt;
The length of the track in seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds_fp% ====&lt;br /&gt;
The length of the track in seconds as a floating point number.&lt;br /&gt;
&lt;br /&gt;
==== %length_samples% ====&lt;br /&gt;
The length of the track in samples.&lt;br /&gt;
&lt;br /&gt;
==== %samplerate% ====&lt;br /&gt;
Sample rate of the track, in Hz.&lt;br /&gt;
&lt;br /&gt;
=== Technical information functions ===&lt;br /&gt;
&lt;br /&gt;
==== $info(name) ====&lt;br /&gt;
Returns value of technical information field called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For convenience, the &#039;&#039;&#039;%__name%&#039;&#039;&#039; alias is also available.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$info(channels)&#039;&#039; → 2&lt;br /&gt;
&lt;br /&gt;
Here is an &#039;&#039;&#039;informative&#039;&#039;&#039; list of recognized fields. Some of these depend on the media file type being queried.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! field name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;General&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|codec&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; MP3)&lt;br /&gt;
|-&lt;br /&gt;
|codec_profile&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec Profile&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; CBR)&lt;br /&gt;
|-&lt;br /&gt;
|samplerate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Sample Rate&#039;&#039;&#039;, in hertz (&#039;&#039;e.g.&#039;&#039; 44100)&lt;br /&gt;
|-&lt;br /&gt;
|bitrate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bitrate&#039;&#039;&#039;, in kilobits per second (&#039;&#039;e.g.&#039;&#039; 320)&lt;br /&gt;
|-&lt;br /&gt;
|tool&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tool&#039;&#039;&#039; used to produce the file, possibly guessed (&#039;&#039;e.g.&#039;&#039; LAME3.97)&lt;br /&gt;
|-&lt;br /&gt;
|encoding&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Encoding&#039;&#039;&#039; lossiness (&#039;&#039;e.g.&#039;&#039; lossy)&lt;br /&gt;
|-&lt;br /&gt;
|channels&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channels&#039;&#039;&#039; count (&#039;&#039;e.g.&#039;&#039; 2 &amp;lt;nowiki&amp;gt;[for stereo]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 16)&lt;br /&gt;
|-&lt;br /&gt;
|decoded_bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample after decoding&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 24)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample_extra&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Format of 32-bit audio data&#039;&#039;&#039; (floating-point or fixed-point)&lt;br /&gt;
|-&lt;br /&gt;
|tagtype&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tag Type&#039;&#039;&#039;, comma-separated list of tag formats (&#039;&#039;e.g.&#039;&#039; id3v2|apev2)&lt;br /&gt;
|-&lt;br /&gt;
|cue_embedded&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Embedded Cuesheet&#039;&#039;&#039; presence (&#039;&#039;e.g.&#039;&#039; no &amp;lt;nowiki&amp;gt;[may be empty!]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|md5&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Audio MD5&#039;&#039;&#039; hash, if container defines it (&#039;&#039;e.g.&#039;&#039; 1E24A910D91EF09A8CF403C9B6963961)&lt;br /&gt;
|-&lt;br /&gt;
|WAVEFORMATEXTENSIBLE_CHANNEL_MASK&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel mask&#039;&#039;&#039;, channel layout of the track coded as hex (&#039;&#039;e.g.&#039;&#039; 0x0003 for regular stereo)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ENC_DELAY&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_delay&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 576)&lt;br /&gt;
|-&lt;br /&gt;
|ENC_PADDING&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_padding&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 1536)&lt;br /&gt;
|-&lt;br /&gt;
|MP3_ACCURATE_LENGTH&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|MP3 duration (%length% etc.) takes into account LAME or iTunes gapless playback info (&#039;&#039;e.g.&#039;&#039; yes)*&lt;br /&gt;
|-&lt;br /&gt;
|MP3_STEREO_MODE&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|Stereo mode used in MP3 file (&#039;&#039;e.g.&#039;&#039; mono, stereo, joint stereo, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|VERSION&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Version&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 3.99)&lt;br /&gt;
|-&lt;br /&gt;
|FLAGS&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Flags&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 22)&lt;br /&gt;
|-&lt;br /&gt;
|channel_mode&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel Mode&#039;&#039;&#039;, description of channels (note: this field was only used by obsolete foo_ac3. &#039;&#039;e.g.&#039;&#039; 3 front, 2 rear surround channels + LFE)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 90%&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; &#039;&#039;MP3_ACCURATE_LENGTH won&#039;t exist if gapless playback info isn&#039;t present or the file is not an MP3. The info can be in a LAME tag in the VBR header, or in an iTunSMPB ID3v2 comment tag. Gapless playback info is taken into account in .m4a files, but there&#039;s no special field to say so.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== $channels() ====&lt;br /&gt;
The number of channels in text format.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$channels()&#039;&#039; → &amp;quot;stereo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_gain% ====&lt;br /&gt;
The ReplayGain album gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak% ====&lt;br /&gt;
The ReplayGain album peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak_db% ====&lt;br /&gt;
The ReplayGain album peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_gain% ====&lt;br /&gt;
The ReplayGain track gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak% ====&lt;br /&gt;
The ReplayGain track peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak_db% ====&lt;br /&gt;
The ReplayGain track peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
=== Special fields ===&lt;br /&gt;
&lt;br /&gt;
==== %filename% ====&lt;br /&gt;
The filename without directory and extension.&lt;br /&gt;
&lt;br /&gt;
==== %filename_ext% ====&lt;br /&gt;
The filename with extension, but without the directory.&lt;br /&gt;
&lt;br /&gt;
==== %directoryname% ====&lt;br /&gt;
The name of the parent directory only, not the complete path.&lt;br /&gt;
&lt;br /&gt;
==== %last_modified% ====&lt;br /&gt;
The date and time the file was last modified. Eg: &#039;&#039;2005-12-22 00:04:10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== %path% ====&lt;br /&gt;
The complete path, including the filename and extension.&lt;br /&gt;
&lt;br /&gt;
==== %_path_raw% ====&lt;br /&gt;
The path as URL including the protocol scheme.&lt;br /&gt;
&lt;br /&gt;
==== %subsong% ====&lt;br /&gt;
The subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.&lt;br /&gt;
&lt;br /&gt;
==== %_foobar2000_version% ====&lt;br /&gt;
A string representing the version of foobar2000.&lt;br /&gt;
&lt;br /&gt;
== Time and date functions ==&lt;br /&gt;
&lt;br /&gt;
These functions are used to manipulate time/date strings, notably (but not limited to), [[Foobar2000:Titleformat_Playback_Statistics|those gathered]] by the [[Foobar2000:Components/Playback Statistics v3.x (foo playcount)|Playback Statistics component]].&lt;br /&gt;
&lt;br /&gt;
=== $year(time) ===&lt;br /&gt;
Retrieves the year part (formatted as four digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $month(time) ===&lt;br /&gt;
Retrieves the month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $day_of_month(time) ===&lt;br /&gt;
Retrieves the day of month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $date(time) ===&lt;br /&gt;
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $time(time) ===&lt;br /&gt;
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string.&lt;br /&gt;
&lt;br /&gt;
== Variable operations ==&lt;br /&gt;
&lt;br /&gt;
Variables can be used to store strings and numbers. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! code&lt;br /&gt;
! output&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre&amp;gt;$put(foo,bar)$char(10)&lt;br /&gt;
$get(foo)$char(10)&lt;br /&gt;
$get(Foo)$char(10)&lt;br /&gt;
$puts(foo,2000)$char(10)&lt;br /&gt;
$get(foo)$char(10)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot; |&amp;lt;pre&amp;gt;bar&lt;br /&gt;
bar&lt;br /&gt;
bar&lt;br /&gt;
&lt;br /&gt;
2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== $get(name) ===&lt;br /&gt;
Returns the value that was last stored in the variable &#039;&#039;name&#039;&#039;, if the variable was not defined (yet), it returns nothing. The truth value returned by &#039;&#039;$get&#039;&#039; indicates if the variable &#039;&#039;name&#039;&#039; was defined and is a non-empty string.&lt;br /&gt;
&lt;br /&gt;
=== $put(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns &#039;&#039;value&#039;&#039; unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $puts(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns nothing.&lt;br /&gt;
&lt;br /&gt;
== Component-specific fields and functions ==&lt;br /&gt;
&lt;br /&gt;
This section lists fields and functions which are specific to certain components. Unless otherwise stated, the fields and functions are only usable in the context of those components.&lt;br /&gt;
&lt;br /&gt;
=== Now playing info ===&lt;br /&gt;
&lt;br /&gt;
The following fields related to the currently playing item are only usable in certain locations outside of the playlist, e.g. in the status bar, the main window title and the copy command script.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time% ====&lt;br /&gt;
The elapsed time formatted as [HH:]MM:SS.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_seconds% ====&lt;br /&gt;
The elapsed time in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_elapsed%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining% ====&lt;br /&gt;
The time remaining until the track ends, formatted as [HH:]MM:SS.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining_seconds% ====&lt;br /&gt;
The time remaining until the track ends, in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Playlist-only fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields are only usable in playlist display formatting (i.e., the column title formatting patterns).&lt;br /&gt;
&lt;br /&gt;
==== %isplaying% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if file is currently playing, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %ispaused% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if playback is paused, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %list_index% ====&lt;br /&gt;
A zero-padded playlist index of specified item. The first item is at index 1.&lt;br /&gt;
&lt;br /&gt;
==== %list_total% ====&lt;br /&gt;
The number of items in the playlist.&lt;br /&gt;
&lt;br /&gt;
==== %queue_index% ====&lt;br /&gt;
Index of the specified item in the playback queue. If the item has been queued multiple times, %queue_index% evaluates to the first index.&lt;br /&gt;
&lt;br /&gt;
==== %queue_indexes% ====&lt;br /&gt;
List of indexes of the specified item in the playback queue. Same as %queue_index% unless the item has been queued more than once.&lt;br /&gt;
&lt;br /&gt;
==== %queue_total% ====&lt;br /&gt;
Total amount of tracks in playback queue. Available only for queued tracks, for technical reasons. &lt;br /&gt;
&lt;br /&gt;
=== Playlist text color ===&lt;br /&gt;
&lt;br /&gt;
==== Dimmed and highlighted text ====&lt;br /&gt;
&lt;br /&gt;
In the Default UI playlist, text color can be adjusted by enclosing it in angle-brackets. The only options are to make the text dimmer (mixing the default color with the background color) or brighter (mixing the default color with the highlight color):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;text&amp;gt;&#039;&#039; – dim &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&#039;&#039; – dimmer &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&amp;gt;&#039;&#039; – dimmest &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;text&amp;amp;lt;&#039;&#039; – bright &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brighter &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brightest &#039;&#039;text&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Historical and Columns UI color functions ====&lt;br /&gt;
&lt;br /&gt;
Prior to version 1.0, the default UI playlist supported the following color functions, which are still available in the Columns UI playlist:&lt;br /&gt;
&lt;br /&gt;
===== $blend(color1,color2,part,total) =====&lt;br /&gt;
Returns a color that is a blend between &#039;&#039;color1&#039;&#039; and &#039;&#039;color2&#039;&#039;. If &#039;&#039;part&#039;&#039; is smaller than or equal to zero, &#039;&#039;color1&#039;&#039; is returned. If &#039;&#039;part&#039;&#039; is greater than or equal to &#039;&#039;total&#039;&#039;, &#039;&#039;color2&#039;&#039; is returned. Otherwise a blended color is returned that is &#039;&#039;part&#039;&#039; parts &#039;&#039;color1&#039;&#039; and &#039;&#039;total&#039;&#039;-&#039;&#039;part&#039;&#039; parts &#039;&#039;color2&#039;&#039;. The blending is performed in the RGB color space.&lt;br /&gt;
&lt;br /&gt;
===== $hsl() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h,s,l) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039; and &#039;&#039;l&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
The ranges of &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039;, and &#039;&#039;l&#039;&#039; are from 0 to 240; the function is designed to interpret those values in the same way as the standard Windows color dialog.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h1,s1,l1,h2,s2,l2) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h1&#039;&#039;, &#039;&#039;s1&#039;&#039; and &#039;&#039;l1&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. &#039;&#039;h2&#039;&#039;, &#039;&#039;s2&#039;&#039; and &#039;&#039;l2&#039;&#039; are the hue, saturation, and lightness of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $rgb() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r,g,b) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r&#039;&#039;, &#039;&#039;g&#039;&#039; and &#039;&#039;b&#039;&#039; are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r1,g1,b1,r2,g2,b2) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r1&#039;&#039;, &#039;&#039;g1&#039;&#039; and &#039;&#039;b1&#039;&#039; are the red, green and blue component of the color for unselected text. &#039;&#039;r2&#039;&#039;, &#039;&#039;g2&#039;&#039; and &#039;&#039;b2&#039;&#039; are the red, green and blue component of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $transition(string,color1,color2) =====&lt;br /&gt;
Inserts color codes into &#039;&#039;string&#039;&#039;, so that the first character has &#039;&#039;color1&#039;&#039;, the last character has &#039;&#039;color2&#039;&#039;, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying &#039;&#039;$transition&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Album List ===&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Titleformat_Album_List|Album List Title Formatting]]&lt;br /&gt;
* [[Foobar2000:Preferences:Album List|Preferences: Album List]]&lt;br /&gt;
&lt;br /&gt;
=== Playback Statistics ===&lt;br /&gt;
&lt;br /&gt;
The foo_playcount component adds a number of fields for playback statistics and ratings. The fields can be used anywhere track info can be displayed. See the documentation for details:&lt;br /&gt;
* [http://www.foobar2000.org/components/view/foo_playcount Playback statistics homepage]&lt;br /&gt;
* [[Foobar2000:Titleformat Playback Statistics|Playback statistics titleformat reference]]&lt;br /&gt;
&lt;br /&gt;
=== Playlist Organizer ===&lt;br /&gt;
&lt;br /&gt;
This component adds a number of fields to control the display of a list of playlists. See the documentation for details:&lt;br /&gt;
* [[Foobar2000:Components/Playlist Organizer (foo_plorg)#Nodes|Playlist Organizer: Nodes Title Formatting]]&lt;br /&gt;
&lt;br /&gt;
=== Columns UI ===&lt;br /&gt;
&lt;br /&gt;
This component replaces the Default UI framework, including the playlist. See the documentation for details:&lt;br /&gt;
* [http://yuo.be/columns.php Columns UI homepage]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:global_variables Global variables reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:colour_string Playlist colors reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:playlist_switcher_titleformatting Playlist switcher reference]&lt;br /&gt;
&lt;br /&gt;
== Additional Reading ==&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Title Formatting Introduction|Introduction to titleformat scripts]]&lt;br /&gt;
* The file &#039;&#039;&#039;titleformat_help.html&#039;&#039;&#039; in your Foobar2000 directory, e.g. file:///C:/Program%20Files%20(x86)/foobar2000/titleformat_help.html&lt;br /&gt;
&lt;br /&gt;
[[Category:foobar2000 Guides|Titleformat Reference]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38283</id>
		<title>Foobar2000:Title Formatting Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38283"/>
		<updated>2024-10-27T07:37:41Z</updated>

		<summary type="html">&lt;p&gt;Case: /* Technical information fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{sidebar foobar2000 title formatting}}&lt;br /&gt;
This article contains information about built-in title formatting functions and field references, plus additional documentation about fields and functions which can only be used in specific components or which are provided by specific components.&lt;br /&gt;
&lt;br /&gt;
Please see [[Foobar2000:Title Formatting Introduction|Title Formatting Introduction]] for a general overview of title format syntax and its basic rules. The article [[foobar2000:Titleformat Examples|Titleformat Examples]] offers user-submitted examples of code for specific purposes; feel free to add your own if you think it can be of use to others.&lt;br /&gt;
&lt;br /&gt;
For details of the query syntax, which uses some of these fields to find files for playlists, etc., see the [[Foobar2000:Query_syntax|Query Syntax]] article.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
A title formatting script consists of any combination of literal text, field references, function calls, comments, and line break characters. The script always outputs a text string (which can be empty).&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;comment&#039;&#039;&#039; is a line starting with two slashes, e.g. {{code|// this is a comment}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;field reference&#039;&#039;&#039; is a field name enclosed in percent signs, for example {{code|%artist%}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;function call&#039;&#039;&#039; starts with a dollar sign, followed by the function name and the parameter list. A parameter list can either be empty – denoted as {{code|()}} – or contain one or more parameters separated by commas, for example {{code|$abbr(%artist%)}}. A parameter can be literal text, a field reference, or another function call. Note that there must be no whitespace between the dollar sign and the function name, or the function name and the opening parenthesis of the parameter list.&lt;br /&gt;
&lt;br /&gt;
Any other text is &#039;&#039;&#039;literal text&#039;&#039;&#039;. In literal text, the character {{code|%}}, {{code|$}}, {{code|[}}, {{code|]}}, or {{code|&#039;}} (apostrophe/single quote) must be escaped by enclosing it in {{code|&#039;}} (apostrophe/single quote) characters. For example, {{code|&#039;[&#039;}} (a left bracket in single quotes) results in a literal {{code|[}} (left bracket). As a special case, {{code|&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;}} (two single quotes in a row) results in one single quote. In the playlist, {{code|&amp;amp;lt;}} and {{code|&amp;amp;gt;}} are also special; see [[#Dimmed and highlighted text|Dimmed and highlighted text]].&lt;br /&gt;
&lt;br /&gt;
When the script is evaluated, the output string is assembled by evaluating the function parameters, function calls, and field references. Comments and line break characters (CR and LF/newline) are ignored; to output a line break, use {{code|$crlf()}}. Each field reference becomes the field&#039;s value, as a string. Each function becomes a string or number, and/or a truth value (not output) which can be used by another function.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The interface for entering custom columns and grouping schemes for the Default UI playlist does not support line breaks; scripts must be written all on one line, without comments.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Arithmetic functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string that can be interpreted as number. Leading whitespace is ignored. Decimal points are not supported. Examples:&lt;br /&gt;
* &#039;&#039;c3po&#039;&#039; → 0&lt;br /&gt;
* &#039;&#039;4.8&#039;&#039; → 4&lt;br /&gt;
* &#039;&#039;-12&#039;&#039; → -12&lt;br /&gt;
* &#039;&#039;- 12&#039;&#039; → 0&lt;br /&gt;
&lt;br /&gt;
=== $add(a,b, ...) ===&lt;br /&gt;
&lt;br /&gt;
Adds &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$add(a,b,...)&#039;&#039; is the same as &#039;&#039;$add($add(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $div(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Divides &#039;&#039;a&#039;&#039; by &#039;&#039;b&#039;&#039; and rounds down to an integer. If &#039;&#039;b&#039;&#039; evaluates to zero, it returns &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$div(a,b,...)&#039;&#039; is the same as &#039;&#039;$div($div(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $greater(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns true, if &#039;&#039;a&#039;&#039; is greater than &#039;&#039;b&#039;&#039;, otherwise false.&lt;br /&gt;
&lt;br /&gt;
=== $max(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the maximum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$max(a,b,...)&#039;&#039; is the same as &#039;&#039;$max($max(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $min(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the minimum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$min(a,b,...)&#039;&#039; is the same as &#039;&#039;$min($min(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mod(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Computes the remainder of dividing &#039;&#039;a&#039;&#039; through &#039;&#039;b&#039;&#039;. The result has the same sign as &#039;&#039;a&#039;&#039;. If &#039;&#039;b&#039;&#039; evaluates to zero, the result is &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mod(a,b,...)&#039;&#039; is the same as &#039;&#039;$mod($mod(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mul(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mul(a,b,...)&#039;&#039; is the same as &#039;&#039;$mul($mul(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $muldiv(a,b,c) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;, then divides by &#039;&#039;c&#039;&#039;. The result is rounded to the nearest integer.&lt;br /&gt;
&lt;br /&gt;
=== $rand() ===&lt;br /&gt;
&lt;br /&gt;
Generates a random number in the range from 0 to 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1. Available only in sort-related contexts, such as the &#039;&#039;Edit → Sort → Sort by ...&#039;&#039; menu command.&lt;br /&gt;
&lt;br /&gt;
=== $sub(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Subtracts &#039;&#039;b&#039;&#039; from &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$sub(a,b,...)&#039;&#039; is the same as &#039;&#039;$sub($sub(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Boolean functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to work with truth values (&#039;&#039;true&#039;&#039; and &#039;&#039;false&#039;&#039;), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with &#039;&#039;$if&#039;&#039; and related functions.&lt;br /&gt;
&lt;br /&gt;
Foobar does not have a concept of TRUE and FALSE in a programming language sense where 0 or empty string are considered FALSE and other values TRUE. Therefore there is no difference between numeric 0 and string representation &#039;0&#039; which both are considered as values, and being attached a boolean value FALSE. Apostrophes are only required to escape certain syntax characters. Values are treated as numbers during arithmetic operations like&#039;&#039; $add()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $and(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical And of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if and only if all &#039;&#039;expr&#039;&#039; arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $or(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if at least one expression evaluates to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $not(expr) ===&lt;br /&gt;
&lt;br /&gt;
Logical Not. Returns the logical opposite of EXPR: &#039;&#039;false&#039;&#039;, if &#039;&#039;expr&#039;&#039; is &#039;&#039;true&#039;&#039; and &#039;&#039;true&#039;&#039; if &#039;&#039;expr&#039;&#039; is false.&lt;br /&gt;
&lt;br /&gt;
=== $xor(expr,...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Exclusive-or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if an odd number of arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Special case: &#039;&#039;$xor(expr1,expr2)&#039;&#039; returns &#039;&#039;true&#039;&#039;, if EXPR1 or EXPR2 is &#039;&#039;true&#039;&#039;. If both expressions are true, returns &#039;&#039;false&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Control flow functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to conditionally execute statements.&lt;br /&gt;
&lt;br /&gt;
=== [...] (conditional section) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates the expression between &#039;&#039;[&#039;&#039; and &#039;&#039;]&#039;&#039;. If it has the truth value &#039;&#039;true&#039;&#039;, its string value and the truth value &#039;&#039;true&#039;&#039; are returned. Otherwise an empty string and &#039;&#039;false&#039;&#039; are returned.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;[%artist%]&#039;&#039; returns the value of the artist tag, if it exists. Otherwise it returns nothing, when &#039;&#039;artist&#039;&#039; would return &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
Plain strings are FALSE. Field lookups and functions can introduce a boolean value of TRUE. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Examples&amp;lt;/u&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;1&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #False: &lt;br /&gt;
 $if(0,True,False)&lt;br /&gt;
 # False: &lt;br /&gt;
 $if(&#039;0&#039;,True,False)&lt;br /&gt;
 # True or False: &lt;br /&gt;
 [$add(%rating%,1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The last one would display the value of %rating% plus one, if and only if %rating% is set for the track.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;2&amp;lt;/u&amp;gt;&lt;br /&gt;
Ignore inserting the %album artist%, if it contains the word &amp;quot;various&amp;quot;. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # Wrong: &lt;br /&gt;
 $if([%album artist%=Various],,%artist%-)&lt;br /&gt;
 # Good approach:&lt;br /&gt;
 $if($stricmp(%album artist%,Various),,%artist%-) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then,else) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $if2(expr,else) ===&lt;br /&gt;
&lt;br /&gt;
Like &#039;&#039;$if(expr,expr,else)&#039;&#039; except that &#039;&#039;expr&#039;&#039; is only evaluated once. In other words, if expression &#039;&#039;expr&#039;&#039; is true, &#039;&#039;expr&#039;&#039; is returned, otherwise the &#039;&#039;else&#039;&#039; part is evaluated and &#039;&#039;expr&#039;&#039; is returned as true.&lt;br /&gt;
&lt;br /&gt;
=== $if3(a1,a2,...,aN,else) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates arguments &#039;&#039;a1&#039;&#039; ... &#039;&#039;aN&#039;&#039;, until one is found that evaluates to &#039;&#039;true&#039;&#039;. If that happens, its value is returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifequal(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is equal to &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifgreater(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is greater than &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $iflonger(str,n,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the length of the string &#039;&#039;str&#039;&#039; to the number &#039;&#039;n&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;n&#039;&#039; characters, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $select(n,a1,...,aN) ===&lt;br /&gt;
&lt;br /&gt;
If the value of &#039;&#039;n&#039;&#039; is between 1 and N, &#039;&#039;an&#039;&#039; is evaluated and its value returned. Otherwise &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
== String functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to manipulate character strings.&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of string &#039;&#039;str&#039;&#039;. Words which begin with an alphanumeric character are shortened to the first character. Spaces and parentheses are stripped. Example:&lt;br /&gt;
* $abbr(&#039;This is a Long Title (12-inch version) [needs tags]&#039;) → TiaLT1v[needst&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters, otherwise returns &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $ansi(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.&lt;br /&gt;
&lt;br /&gt;
=== $ascii(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to ASCII. Any characters that are not present in ASCII will be removed / replaced.&lt;br /&gt;
&lt;br /&gt;
=== $caps(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and all other letters to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $caps2(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and leaves all other letters as they are.&lt;br /&gt;
&lt;br /&gt;
=== $char(nbr) ===&lt;br /&gt;
&lt;br /&gt;
Returns Unicode character of &#039;&#039;nbr&#039;&#039;. You can search for characters and find the matching decimal number on this [http://www.fileformat.info/info/unicode/char/search.htm site].&lt;br /&gt;
&lt;br /&gt;
=== $crc32(str) ===&lt;br /&gt;
&lt;br /&gt;
Computes the CRC32 of the string &#039;&#039;str&#039;&#039; as a number. Intended for use in coloring scripts.&lt;br /&gt;
&lt;br /&gt;
Example: $rgb($mod($crc32(%album%),256),128,128)&lt;br /&gt;
&lt;br /&gt;
=== $crlf() ===&lt;br /&gt;
&lt;br /&gt;
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system  notification area (&amp;quot;systray&amp;quot;) icon.&lt;br /&gt;
&lt;br /&gt;
=== $cut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $left(a,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $directory(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts only the directory name (not full path, ie given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;jazz&#039;) from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $directory(path,n) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory name from the file &#039;&#039;path&#039;&#039;; goes up by &#039;&#039;n&#039;&#039; levels.&lt;br /&gt;
&lt;br /&gt;
=== $directory_path(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory path from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
ie. given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;D:\music\jazz&#039;&lt;br /&gt;
&lt;br /&gt;
=== $ext(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file extension from string &#039;&#039;path&#039;&#039;; a file name or full path.&lt;br /&gt;
&lt;br /&gt;
=== $filename(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file name from full &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &amp;quot; (...)&amp;quot;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str,indicator) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &#039;&#039;indicator&#039;&#039;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $hex(int,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in hexadecimal notation with &#039;&#039;len&#039;&#039; digits. Pads with zeros from the left if necessary.&lt;br /&gt;
&lt;br /&gt;
=== $insert(str,insert,n) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;insert&#039;&#039; into &#039;&#039;str&#039;&#039; after &#039;&#039;n&#039;&#039; characters.&lt;br /&gt;
&lt;br /&gt;
=== $left(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $cut(str,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $len(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters.&lt;br /&gt;
&lt;br /&gt;
=== $len2(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters, respecting double-width character rules (double-width characters will be counted as two).&lt;br /&gt;
&lt;br /&gt;
=== $longer(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;true&#039;&#039;, if string &#039;&#039;str1&#039;&#039; is longer than string &#039;&#039;str2&#039;&#039;, false otherwise.&lt;br /&gt;
&lt;br /&gt;
=== $lower(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $longest(arg,...) ===&lt;br /&gt;
&lt;br /&gt;
Returns the longest of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $num(nbr,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;nbr&#039;&#039; in decimal notation with &#039;&#039;len&#039;&#039; characters. Pads with zeros from the left if necessary. &#039;&#039;len&#039;&#039; includes the dash when the number is negative. If &#039;&#039;nbr&#039;&#039; is not numeric, it is treated as zero. Examples:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;$num(123,5)&#039;&#039; → 00123&lt;br /&gt;
* &#039;&#039;$num(-123,5)&#039;&#039; → -0123&lt;br /&gt;
* &#039;&#039;$num(4.8,5)&#039;&#039; → 00004&lt;br /&gt;
* &#039;&#039;$num(A1,5)&#039;&#039; → 00000&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $progress(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with.&lt;br /&gt;
&lt;br /&gt;
Example:&#039;&#039;$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,&#039;#&#039;,&#039;=&#039;)&#039;&#039; produces &amp;quot;====#===============&amp;quot;, the # character is moving with playback position.&lt;br /&gt;
&lt;br /&gt;
=== $progress2(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with. Produces different appearance than &#039;&#039;$progress&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $repeat(expr,count) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;count&#039;&#039; copies of &#039;&#039;expr&#039;&#039;. Note that &#039;&#039;expr&#039;&#039; is evaluated once before its value is used, so &#039;&#039;$repeat&#039;&#039; cannot be used for loops.&lt;br /&gt;
&lt;br /&gt;
=== $replace(str,search,replace) ===&lt;br /&gt;
&lt;br /&gt;
Replaces all occurrences of string &#039;&#039;search&#039;&#039; in string &#039;&#039;str&#039;&#039; with string &#039;&#039;replace&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can also be used with an arbitrary number of arguments. Note that &#039;&#039;$replace(str,search1,replace1,search2,replace2)&#039;&#039; is generally not the same as &#039;&#039;$replace($replace(str,search1,replace1),search2,replace2)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$replace(ab,a,b,b,c)&#039;&#039; → &amp;quot;bc&amp;quot;, &#039;&#039;$replace($replace(ab,a,b),b,c)&#039;&#039; → &amp;quot;cc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== $right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first &#039;&#039;len&#039;&#039; characters from the right of string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $roman(int) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in roman notation.&lt;br /&gt;
&lt;br /&gt;
=== $rot13(str) ===&lt;br /&gt;
&lt;br /&gt;
Performs [http://en.wikipedia.org/wiki/ROT13 ROT13] transformation to given string.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$rot13(&#039;foobar2000&#039;)&#039;&#039; → &amp;quot;sbbone2000&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $shortest(str,...strN) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first shortest element of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $strchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strchr(abca,a)&#039;&#039; → 1&lt;br /&gt;
&lt;br /&gt;
=== $strrchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns positions of last occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strrchr(abca,a)&#039;&#039; → 4&lt;br /&gt;
&lt;br /&gt;
=== $strstr(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of string &#039;&#039;str2&#039;&#039; in string &#039;&#039;str1&#039;&#039;. Function is case-sensitive.&lt;br /&gt;
&lt;br /&gt;
=== $strcmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-sensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stricmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-insensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Removes the specified prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $substr(str,from,to) ===&lt;br /&gt;
&lt;br /&gt;
Returns substring of string &#039;&#039;str&#039;&#039;, starting from &#039;&#039;FROM&#039;&#039;-th character and ending at &#039;&#039;TO&#039;&#039;-th character.&lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Moves &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Moves the specified prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $trim(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes leading and trailing spaces from string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $tab() ===&lt;br /&gt;
&lt;br /&gt;
Inserts one tabulator character.&lt;br /&gt;
&lt;br /&gt;
=== $tab(count) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;count&#039;&#039; tabulator characters.&lt;br /&gt;
&lt;br /&gt;
=== $upper(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to uppercase.&lt;br /&gt;
&lt;br /&gt;
== Track info fields and functions ==&lt;br /&gt;
&lt;br /&gt;
The functions and fields in this section can be used to access information about tracks.&lt;br /&gt;
&lt;br /&gt;
=== Metadata fields and functions ===&lt;br /&gt;
&lt;br /&gt;
Generally, metadata from the files (whether in tags or a cue sheet) is mapped directly to a field which can be referenced case-insensitively. For example, the first tag named &#039;&#039;URL&#039;&#039; can be referenced as &#039;&#039;%url%&#039;&#039;, and the first standard comment tag can be referenced as &#039;&#039;%comment%&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following functions are also available for accessing metadata:&lt;br /&gt;
&lt;br /&gt;
==== $meta(name) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &amp;quot;, &amp;quot; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist)&#039;&#039; → &amp;quot;He, She, They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta(name,n) ====&lt;br /&gt;
Returns value of &#039;&#039;n&#039;&#039;-th (0,1,2 and so on) tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist,1)&#039;&#039; → &amp;quot;She&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039; + &#039;)&#039;&#039; → &amp;quot;He + She + They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep,lastsep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator between all but the last two values which are concatenated with &#039;&#039;lastsep&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039;, &#039;,&#039;, and &#039;)&#039;&#039; → &amp;quot;He, She, and They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_test(...) ====&lt;br /&gt;
Returns &#039;&#039;1&#039;&#039;, if all given tags exist, &#039;&#039;undefined&#039;&#039; otherwise.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_test(artist,title)&#039;&#039; → true&lt;br /&gt;
&lt;br /&gt;
==== $meta_num(name) ====&lt;br /&gt;
Returns the number of values for the tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_num(artist)&#039;&#039; → 3&lt;br /&gt;
&lt;br /&gt;
=== Remapped metadata fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields have special remapped values to make writing title format scripts more convenient:&lt;br /&gt;
&lt;br /&gt;
==== %album artist% ====&lt;br /&gt;
Name of the artist of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album artist&amp;quot;, &amp;quot;artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. The difference between this and &#039;&#039;%artist%&#039;&#039; is that &#039;&#039;%album artist%&#039;&#039; is intended for use where consistent value across entire album is needed even when per-track artists values vary.&lt;br /&gt;
&lt;br /&gt;
==== %album% ====&lt;br /&gt;
Name of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album&amp;quot;, &amp;quot;venue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %artist% ====&lt;br /&gt;
Name of the artist of the track. Checks following metadata fields, in this order: &amp;quot;artist&amp;quot;, &amp;quot;album artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. For a SHOUTcast stream which contains metadata, it is the StreamTitle up to the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %discnumber% ====&lt;br /&gt;
Index of disc specified track belongs to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %totaldiscs% ====&lt;br /&gt;
Index of total discs specified tracks belong to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %track artist% ====&lt;br /&gt;
Name of the artist of the track; present only if &#039;&#039;%album artist%&#039;&#039; is different than &#039;&#039;%artist%&#039;&#039; for specific track. Intended for use together with &#039;&#039;%album artist%&#039;&#039;, to indicate track-specific artist info, e.g. &amp;quot;%album artist% - %title%[ &#039;//&#039; %track artist%]&amp;quot;. In this case, the last part will be displayed only when track-specific artist info is present.&lt;br /&gt;
&lt;br /&gt;
==== %title% ====&lt;br /&gt;
Title of the track. If &amp;quot;title&amp;quot; metadata field is missing, file name is used instead. For a SHOUTcast stream which contains metadata, it is the StreamTitle after the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %tracknumber% ====&lt;br /&gt;
Two-digit index of specified track within the album. Available only when &amp;quot;tracknumber&amp;quot; field is present in track’s metadata. An extra &#039;0&#039; is placed in front of single digit track numbers (5 becomes 05) &amp;amp;ndash; otherwise the tracknumber field is returned unchanged (e.g. the following values remain as they are: 006, 05, 104, A3, two, -1, -).&lt;br /&gt;
&lt;br /&gt;
==== %track number% ====&lt;br /&gt;
Similar to %tracknumber%, however single digit track numbers are not reformatted to have an extra 0.&lt;br /&gt;
&lt;br /&gt;
==== %totaltracks% ====&lt;br /&gt;
Index of total tracks specified tracks belong to, within the album. Available only when &amp;quot;totaltracks&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
=== Technical information fields ===&lt;br /&gt;
&lt;br /&gt;
==== %bitrate% ====&lt;br /&gt;
Bitrate of the track in kilobits per second. VBR files will show a dynamic display for currently played track (outside of the playlist).&lt;br /&gt;
&lt;br /&gt;
==== %channels% ====&lt;br /&gt;
Number of channels in the track, as text; either &amp;quot;mono&amp;quot;, &amp;quot;stereo&amp;quot; for 1 or 2 channels, respectively, otherwise a number followed by &amp;quot;ch&amp;quot;, e.g. &amp;quot;6ch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %channel_mask% ====&lt;br /&gt;
Description of the used audio channels in the track, e.g. &amp;quot;FL FR FC LFE SL SR&amp;quot;. Introduced in foobar2000 preview 2024-06-30.&lt;br /&gt;
&lt;br /&gt;
==== %codec% ====&lt;br /&gt;
Name of codec used to encode the track, e.g. &amp;quot;PCM&amp;quot;, &amp;quot;FLAC&amp;quot;, &amp;quot;MP3&amp;quot;, or &amp;quot;AAC&amp;quot;. If exact codec name is not available, file extension is used.&lt;br /&gt;
&lt;br /&gt;
==== %codec_profile% ====&lt;br /&gt;
Additional information about encoding settings used, e.g. &amp;quot;CBR&amp;quot;. Not always available.&lt;br /&gt;
&lt;br /&gt;
==== %codec_long% ====&lt;br /&gt;
Long name of the codec, including profile, e.g. &amp;quot;HE-AACv2&amp;quot;. Some codecs, such as HE-AAC, supply this. If long name isn&#039;t supplied by the codec, %codec_long% falls back to %codec% / %codec_profile%. The Default UI&#039;s standard Codec column displays the same info.&lt;br /&gt;
&lt;br /&gt;
==== %filesize% ====&lt;br /&gt;
The exact file size in bytes.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_filesize%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %filesize_natural% ====&lt;br /&gt;
The approximate file size, automatically formatted in appropriate units such as megabytes or kilobytes, e.g. &amp;quot;8.49 MB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %length% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_ex% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, seconds, and milliseconds, rounded to the nearest millisecond.&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds% ====&lt;br /&gt;
The length of the track in seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds_fp% ====&lt;br /&gt;
The length of the track in seconds as a floating point number.&lt;br /&gt;
&lt;br /&gt;
==== %length_samples% ====&lt;br /&gt;
The length of the track in samples.&lt;br /&gt;
&lt;br /&gt;
==== %samplerate% ====&lt;br /&gt;
Sample rate of the track, in Hz.&lt;br /&gt;
&lt;br /&gt;
=== Technical information functions ===&lt;br /&gt;
&lt;br /&gt;
==== $info(name) ====&lt;br /&gt;
Returns value of technical information field called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For convenience, the &#039;&#039;&#039;%__name%&#039;&#039;&#039; alias is also available.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$info(channels)&#039;&#039; → 2&lt;br /&gt;
&lt;br /&gt;
Here is an &#039;&#039;&#039;informative&#039;&#039;&#039; list of recognized fields. Some of these depend on the media file type being queried.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! field name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;General&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|codec&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; MP3)&lt;br /&gt;
|-&lt;br /&gt;
|codec_profile&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec Profile&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; CBR)&lt;br /&gt;
|-&lt;br /&gt;
|samplerate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Sample Rate&#039;&#039;&#039;, in hertz (&#039;&#039;e.g.&#039;&#039; 44100)&lt;br /&gt;
|-&lt;br /&gt;
|bitrate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bitrate&#039;&#039;&#039;, in kilobits per second (&#039;&#039;e.g.&#039;&#039; 320)&lt;br /&gt;
|-&lt;br /&gt;
|tool&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tool&#039;&#039;&#039; used to produce the file, possibly guessed (&#039;&#039;e.g.&#039;&#039; LAME3.97)&lt;br /&gt;
|-&lt;br /&gt;
|encoding&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Encoding&#039;&#039;&#039; lossiness (&#039;&#039;e.g.&#039;&#039; lossy)&lt;br /&gt;
|-&lt;br /&gt;
|channels&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channels&#039;&#039;&#039; count (&#039;&#039;e.g.&#039;&#039; 2 &amp;lt;nowiki&amp;gt;[for stereo]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 16)&lt;br /&gt;
|-&lt;br /&gt;
|tagtype&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tag Type&#039;&#039;&#039;, comma-separated list of tag formats (&#039;&#039;e.g.&#039;&#039; id3v2|apev2)&lt;br /&gt;
|-&lt;br /&gt;
|cue_embedded&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Embedded Cuesheet&#039;&#039;&#039; presence (&#039;&#039;e.g.&#039;&#039; no &amp;lt;nowiki&amp;gt;[may be empty!]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|md5&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Audio MD5&#039;&#039;&#039; hash, if container defines it (&#039;&#039;e.g.&#039;&#039; 1E24A910D91EF09A8CF403C9B6963961)&lt;br /&gt;
|-&lt;br /&gt;
|WAVEFORMATEXTENSIBLE_CHANNEL_MASK&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel mask&#039;&#039;&#039;, channel layout of the track coded as hex (&#039;&#039;e.g.&#039;&#039; 0x0003 for regular stereo)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ENC_DELAY&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_delay&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 576)&lt;br /&gt;
|-&lt;br /&gt;
|ENC_PADDING&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_padding&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 1536)&lt;br /&gt;
|-&lt;br /&gt;
|MP3_ACCURATE_LENGTH&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|MP3 duration (%length% etc.) takes into account LAME or iTunes gapless playback info (&#039;&#039;e.g.&#039;&#039; yes)*&lt;br /&gt;
|-&lt;br /&gt;
|MP3_STEREO_MODE&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|Stereo mode used in MP3 file (&#039;&#039;e.g.&#039;&#039; mono, stereo, joint stereo, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|VERSION&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Version&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 3.99)&lt;br /&gt;
|-&lt;br /&gt;
|FLAGS&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Flags&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 22)&lt;br /&gt;
|-&lt;br /&gt;
|channel_mode&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel Mode&#039;&#039;&#039;, description of channels (note: this field was only used by obsolete foo_ac3. &#039;&#039;e.g.&#039;&#039; 3 front, 2 rear surround channels + LFE)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 90%&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; &#039;&#039;MP3_ACCURATE_LENGTH won&#039;t exist if gapless playback info isn&#039;t present or the file is not an MP3. The info can be in a LAME tag in the VBR header, or in an iTunSMPB ID3v2 comment tag. Gapless playback info is taken into account in .m4a files, but there&#039;s no special field to say so.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== $channels() ====&lt;br /&gt;
The number of channels in text format.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$channels()&#039;&#039; → &amp;quot;stereo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_gain% ====&lt;br /&gt;
The ReplayGain album gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak% ====&lt;br /&gt;
The ReplayGain album peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak_db% ====&lt;br /&gt;
The ReplayGain album peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_gain% ====&lt;br /&gt;
The ReplayGain track gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak% ====&lt;br /&gt;
The ReplayGain track peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak_db% ====&lt;br /&gt;
The ReplayGain track peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
=== Special fields ===&lt;br /&gt;
&lt;br /&gt;
==== %filename% ====&lt;br /&gt;
The filename without directory and extension.&lt;br /&gt;
&lt;br /&gt;
==== %filename_ext% ====&lt;br /&gt;
The filename with extension, but without the directory.&lt;br /&gt;
&lt;br /&gt;
==== %directoryname% ====&lt;br /&gt;
The name of the parent directory only, not the complete path.&lt;br /&gt;
&lt;br /&gt;
==== %last_modified% ====&lt;br /&gt;
The date and time the file was last modified. Eg: &#039;&#039;2005-12-22 00:04:10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== %path% ====&lt;br /&gt;
The complete path, including the filename and extension.&lt;br /&gt;
&lt;br /&gt;
==== %_path_raw% ====&lt;br /&gt;
The path as URL including the protocol scheme.&lt;br /&gt;
&lt;br /&gt;
==== %subsong% ====&lt;br /&gt;
The subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.&lt;br /&gt;
&lt;br /&gt;
==== %_foobar2000_version% ====&lt;br /&gt;
A string representing the version of foobar2000.&lt;br /&gt;
&lt;br /&gt;
== Time and date functions ==&lt;br /&gt;
&lt;br /&gt;
These functions are used to manipulate time/date strings, notably (but not limited to), [[Foobar2000:Titleformat_Playback_Statistics|those gathered]] by the [[Foobar2000:Components/Playback Statistics v3.x (foo playcount)|Playback Statistics component]].&lt;br /&gt;
&lt;br /&gt;
=== $year(time) ===&lt;br /&gt;
Retrieves the year part (formatted as four digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $month(time) ===&lt;br /&gt;
Retrieves the month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $day_of_month(time) ===&lt;br /&gt;
Retrieves the day of month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $date(time) ===&lt;br /&gt;
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $time(time) ===&lt;br /&gt;
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string.&lt;br /&gt;
&lt;br /&gt;
== Variable operations ==&lt;br /&gt;
&lt;br /&gt;
Variables can be used to store strings and numbers. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! code&lt;br /&gt;
! output&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre&amp;gt;$put(foo,bar)$char(10)&lt;br /&gt;
$get(foo)$char(10)&lt;br /&gt;
$get(Foo)$char(10)&lt;br /&gt;
$puts(foo,2000)$char(10)&lt;br /&gt;
$get(foo)$char(10)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot; |&amp;lt;pre&amp;gt;bar&lt;br /&gt;
bar&lt;br /&gt;
bar&lt;br /&gt;
&lt;br /&gt;
2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== $get(name) ===&lt;br /&gt;
Returns the value that was last stored in the variable &#039;&#039;name&#039;&#039;, if the variable was not defined (yet), it returns nothing. The truth value returned by &#039;&#039;$get&#039;&#039; indicates if the variable &#039;&#039;name&#039;&#039; was defined and is a non-empty string.&lt;br /&gt;
&lt;br /&gt;
=== $put(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns &#039;&#039;value&#039;&#039; unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $puts(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns nothing.&lt;br /&gt;
&lt;br /&gt;
== Component-specific fields and functions ==&lt;br /&gt;
&lt;br /&gt;
This section lists fields and functions which are specific to certain components. Unless otherwise stated, the fields and functions are only usable in the context of those components.&lt;br /&gt;
&lt;br /&gt;
=== Now playing info ===&lt;br /&gt;
&lt;br /&gt;
The following fields related to the currently playing item are only usable in certain locations outside of the playlist, e.g. in the status bar, the main window title and the copy command script.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time% ====&lt;br /&gt;
The elapsed time formatted as [HH:]MM:SS.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_seconds% ====&lt;br /&gt;
The elapsed time in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_elapsed%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining% ====&lt;br /&gt;
The time remaining until the track ends, formatted as [HH:]MM:SS.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining_seconds% ====&lt;br /&gt;
The time remaining until the track ends, in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Playlist-only fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields are only usable in playlist display formatting (i.e., the column title formatting patterns).&lt;br /&gt;
&lt;br /&gt;
==== %isplaying% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if file is currently playing, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %ispaused% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if playback is paused, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %list_index% ====&lt;br /&gt;
A zero-padded playlist index of specified item. The first item is at index 1.&lt;br /&gt;
&lt;br /&gt;
==== %list_total% ====&lt;br /&gt;
The number of items in the playlist.&lt;br /&gt;
&lt;br /&gt;
==== %queue_index% ====&lt;br /&gt;
Index of the specified item in the playback queue. If the item has been queued multiple times, %queue_index% evaluates to the first index.&lt;br /&gt;
&lt;br /&gt;
==== %queue_indexes% ====&lt;br /&gt;
List of indexes of the specified item in the playback queue. Same as %queue_index% unless the item has been queued more than once.&lt;br /&gt;
&lt;br /&gt;
==== %queue_total% ====&lt;br /&gt;
Total amount of tracks in playback queue. Available only for queued tracks, for technical reasons. &lt;br /&gt;
&lt;br /&gt;
=== Playlist text color ===&lt;br /&gt;
&lt;br /&gt;
==== Dimmed and highlighted text ====&lt;br /&gt;
&lt;br /&gt;
In the Default UI playlist, text color can be adjusted by enclosing it in angle-brackets. The only options are to make the text dimmer (mixing the default color with the background color) or brighter (mixing the default color with the highlight color):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;text&amp;gt;&#039;&#039; – dim &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&#039;&#039; – dimmer &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&amp;gt;&#039;&#039; – dimmest &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;text&amp;amp;lt;&#039;&#039; – bright &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brighter &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brightest &#039;&#039;text&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Historical and Columns UI color functions ====&lt;br /&gt;
&lt;br /&gt;
Prior to version 1.0, the default UI playlist supported the following color functions, which are still available in the Columns UI playlist:&lt;br /&gt;
&lt;br /&gt;
===== $blend(color1,color2,part,total) =====&lt;br /&gt;
Returns a color that is a blend between &#039;&#039;color1&#039;&#039; and &#039;&#039;color2&#039;&#039;. If &#039;&#039;part&#039;&#039; is smaller than or equal to zero, &#039;&#039;color1&#039;&#039; is returned. If &#039;&#039;part&#039;&#039; is greater than or equal to &#039;&#039;total&#039;&#039;, &#039;&#039;color2&#039;&#039; is returned. Otherwise a blended color is returned that is &#039;&#039;part&#039;&#039; parts &#039;&#039;color1&#039;&#039; and &#039;&#039;total&#039;&#039;-&#039;&#039;part&#039;&#039; parts &#039;&#039;color2&#039;&#039;. The blending is performed in the RGB color space.&lt;br /&gt;
&lt;br /&gt;
===== $hsl() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h,s,l) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039; and &#039;&#039;l&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
The ranges of &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039;, and &#039;&#039;l&#039;&#039; are from 0 to 240; the function is designed to interpret those values in the same way as the standard Windows color dialog.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h1,s1,l1,h2,s2,l2) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h1&#039;&#039;, &#039;&#039;s1&#039;&#039; and &#039;&#039;l1&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. &#039;&#039;h2&#039;&#039;, &#039;&#039;s2&#039;&#039; and &#039;&#039;l2&#039;&#039; are the hue, saturation, and lightness of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $rgb() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r,g,b) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r&#039;&#039;, &#039;&#039;g&#039;&#039; and &#039;&#039;b&#039;&#039; are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r1,g1,b1,r2,g2,b2) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r1&#039;&#039;, &#039;&#039;g1&#039;&#039; and &#039;&#039;b1&#039;&#039; are the red, green and blue component of the color for unselected text. &#039;&#039;r2&#039;&#039;, &#039;&#039;g2&#039;&#039; and &#039;&#039;b2&#039;&#039; are the red, green and blue component of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $transition(string,color1,color2) =====&lt;br /&gt;
Inserts color codes into &#039;&#039;string&#039;&#039;, so that the first character has &#039;&#039;color1&#039;&#039;, the last character has &#039;&#039;color2&#039;&#039;, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying &#039;&#039;$transition&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Album List ===&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Titleformat_Album_List|Album List Title Formatting]]&lt;br /&gt;
* [[Foobar2000:Preferences:Album List|Preferences: Album List]]&lt;br /&gt;
&lt;br /&gt;
=== Playback Statistics ===&lt;br /&gt;
&lt;br /&gt;
The foo_playcount component adds a number of fields for playback statistics and ratings. The fields can be used anywhere track info can be displayed. See the documentation for details:&lt;br /&gt;
* [http://www.foobar2000.org/components/view/foo_playcount Playback statistics homepage]&lt;br /&gt;
* [[Foobar2000:Titleformat Playback Statistics|Playback statistics titleformat reference]]&lt;br /&gt;
&lt;br /&gt;
=== Playlist Organizer ===&lt;br /&gt;
&lt;br /&gt;
This component adds a number of fields to control the display of a list of playlists. See the documentation for details:&lt;br /&gt;
* [[Foobar2000:Components/Playlist Organizer (foo_plorg)#Nodes|Playlist Organizer: Nodes Title Formatting]]&lt;br /&gt;
&lt;br /&gt;
=== Columns UI ===&lt;br /&gt;
&lt;br /&gt;
This component replaces the Default UI framework, including the playlist. See the documentation for details:&lt;br /&gt;
* [http://yuo.be/columns.php Columns UI homepage]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:global_variables Global variables reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:colour_string Playlist colors reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:playlist_switcher_titleformatting Playlist switcher reference]&lt;br /&gt;
&lt;br /&gt;
== Additional Reading ==&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Title Formatting Introduction|Introduction to titleformat scripts]]&lt;br /&gt;
* The file &#039;&#039;&#039;titleformat_help.html&#039;&#039;&#039; in your Foobar2000 directory, e.g. file:///C:/Program%20Files%20(x86)/foobar2000/titleformat_help.html&lt;br /&gt;
&lt;br /&gt;
[[Category:foobar2000 Guides|Titleformat Reference]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38282</id>
		<title>Foobar2000:Title Formatting Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38282"/>
		<updated>2024-10-27T07:37:09Z</updated>

		<summary type="html">&lt;p&gt;Case: /* Technical information fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{sidebar foobar2000 title formatting}}&lt;br /&gt;
This article contains information about built-in title formatting functions and field references, plus additional documentation about fields and functions which can only be used in specific components or which are provided by specific components.&lt;br /&gt;
&lt;br /&gt;
Please see [[Foobar2000:Title Formatting Introduction|Title Formatting Introduction]] for a general overview of title format syntax and its basic rules. The article [[foobar2000:Titleformat Examples|Titleformat Examples]] offers user-submitted examples of code for specific purposes; feel free to add your own if you think it can be of use to others.&lt;br /&gt;
&lt;br /&gt;
For details of the query syntax, which uses some of these fields to find files for playlists, etc., see the [[Foobar2000:Query_syntax|Query Syntax]] article.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
A title formatting script consists of any combination of literal text, field references, function calls, comments, and line break characters. The script always outputs a text string (which can be empty).&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;comment&#039;&#039;&#039; is a line starting with two slashes, e.g. {{code|// this is a comment}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;field reference&#039;&#039;&#039; is a field name enclosed in percent signs, for example {{code|%artist%}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;function call&#039;&#039;&#039; starts with a dollar sign, followed by the function name and the parameter list. A parameter list can either be empty – denoted as {{code|()}} – or contain one or more parameters separated by commas, for example {{code|$abbr(%artist%)}}. A parameter can be literal text, a field reference, or another function call. Note that there must be no whitespace between the dollar sign and the function name, or the function name and the opening parenthesis of the parameter list.&lt;br /&gt;
&lt;br /&gt;
Any other text is &#039;&#039;&#039;literal text&#039;&#039;&#039;. In literal text, the character {{code|%}}, {{code|$}}, {{code|[}}, {{code|]}}, or {{code|&#039;}} (apostrophe/single quote) must be escaped by enclosing it in {{code|&#039;}} (apostrophe/single quote) characters. For example, {{code|&#039;[&#039;}} (a left bracket in single quotes) results in a literal {{code|[}} (left bracket). As a special case, {{code|&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;}} (two single quotes in a row) results in one single quote. In the playlist, {{code|&amp;amp;lt;}} and {{code|&amp;amp;gt;}} are also special; see [[#Dimmed and highlighted text|Dimmed and highlighted text]].&lt;br /&gt;
&lt;br /&gt;
When the script is evaluated, the output string is assembled by evaluating the function parameters, function calls, and field references. Comments and line break characters (CR and LF/newline) are ignored; to output a line break, use {{code|$crlf()}}. Each field reference becomes the field&#039;s value, as a string. Each function becomes a string or number, and/or a truth value (not output) which can be used by another function.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The interface for entering custom columns and grouping schemes for the Default UI playlist does not support line breaks; scripts must be written all on one line, without comments.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Arithmetic functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string that can be interpreted as number. Leading whitespace is ignored. Decimal points are not supported. Examples:&lt;br /&gt;
* &#039;&#039;c3po&#039;&#039; → 0&lt;br /&gt;
* &#039;&#039;4.8&#039;&#039; → 4&lt;br /&gt;
* &#039;&#039;-12&#039;&#039; → -12&lt;br /&gt;
* &#039;&#039;- 12&#039;&#039; → 0&lt;br /&gt;
&lt;br /&gt;
=== $add(a,b, ...) ===&lt;br /&gt;
&lt;br /&gt;
Adds &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$add(a,b,...)&#039;&#039; is the same as &#039;&#039;$add($add(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $div(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Divides &#039;&#039;a&#039;&#039; by &#039;&#039;b&#039;&#039; and rounds down to an integer. If &#039;&#039;b&#039;&#039; evaluates to zero, it returns &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$div(a,b,...)&#039;&#039; is the same as &#039;&#039;$div($div(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $greater(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns true, if &#039;&#039;a&#039;&#039; is greater than &#039;&#039;b&#039;&#039;, otherwise false.&lt;br /&gt;
&lt;br /&gt;
=== $max(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the maximum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$max(a,b,...)&#039;&#039; is the same as &#039;&#039;$max($max(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $min(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the minimum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$min(a,b,...)&#039;&#039; is the same as &#039;&#039;$min($min(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mod(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Computes the remainder of dividing &#039;&#039;a&#039;&#039; through &#039;&#039;b&#039;&#039;. The result has the same sign as &#039;&#039;a&#039;&#039;. If &#039;&#039;b&#039;&#039; evaluates to zero, the result is &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mod(a,b,...)&#039;&#039; is the same as &#039;&#039;$mod($mod(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mul(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mul(a,b,...)&#039;&#039; is the same as &#039;&#039;$mul($mul(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $muldiv(a,b,c) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;, then divides by &#039;&#039;c&#039;&#039;. The result is rounded to the nearest integer.&lt;br /&gt;
&lt;br /&gt;
=== $rand() ===&lt;br /&gt;
&lt;br /&gt;
Generates a random number in the range from 0 to 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1. Available only in sort-related contexts, such as the &#039;&#039;Edit → Sort → Sort by ...&#039;&#039; menu command.&lt;br /&gt;
&lt;br /&gt;
=== $sub(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Subtracts &#039;&#039;b&#039;&#039; from &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$sub(a,b,...)&#039;&#039; is the same as &#039;&#039;$sub($sub(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Boolean functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to work with truth values (&#039;&#039;true&#039;&#039; and &#039;&#039;false&#039;&#039;), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with &#039;&#039;$if&#039;&#039; and related functions.&lt;br /&gt;
&lt;br /&gt;
Foobar does not have a concept of TRUE and FALSE in a programming language sense where 0 or empty string are considered FALSE and other values TRUE. Therefore there is no difference between numeric 0 and string representation &#039;0&#039; which both are considered as values, and being attached a boolean value FALSE. Apostrophes are only required to escape certain syntax characters. Values are treated as numbers during arithmetic operations like&#039;&#039; $add()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $and(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical And of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if and only if all &#039;&#039;expr&#039;&#039; arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $or(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if at least one expression evaluates to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $not(expr) ===&lt;br /&gt;
&lt;br /&gt;
Logical Not. Returns the logical opposite of EXPR: &#039;&#039;false&#039;&#039;, if &#039;&#039;expr&#039;&#039; is &#039;&#039;true&#039;&#039; and &#039;&#039;true&#039;&#039; if &#039;&#039;expr&#039;&#039; is false.&lt;br /&gt;
&lt;br /&gt;
=== $xor(expr,...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Exclusive-or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if an odd number of arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Special case: &#039;&#039;$xor(expr1,expr2)&#039;&#039; returns &#039;&#039;true&#039;&#039;, if EXPR1 or EXPR2 is &#039;&#039;true&#039;&#039;. If both expressions are true, returns &#039;&#039;false&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Control flow functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to conditionally execute statements.&lt;br /&gt;
&lt;br /&gt;
=== [...] (conditional section) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates the expression between &#039;&#039;[&#039;&#039; and &#039;&#039;]&#039;&#039;. If it has the truth value &#039;&#039;true&#039;&#039;, its string value and the truth value &#039;&#039;true&#039;&#039; are returned. Otherwise an empty string and &#039;&#039;false&#039;&#039; are returned.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;[%artist%]&#039;&#039; returns the value of the artist tag, if it exists. Otherwise it returns nothing, when &#039;&#039;artist&#039;&#039; would return &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
Plain strings are FALSE. Field lookups and functions can introduce a boolean value of TRUE. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Examples&amp;lt;/u&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;1&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #False: &lt;br /&gt;
 $if(0,True,False)&lt;br /&gt;
 # False: &lt;br /&gt;
 $if(&#039;0&#039;,True,False)&lt;br /&gt;
 # True or False: &lt;br /&gt;
 [$add(%rating%,1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The last one would display the value of %rating% plus one, if and only if %rating% is set for the track.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;2&amp;lt;/u&amp;gt;&lt;br /&gt;
Ignore inserting the %album artist%, if it contains the word &amp;quot;various&amp;quot;. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # Wrong: &lt;br /&gt;
 $if([%album artist%=Various],,%artist%-)&lt;br /&gt;
 # Good approach:&lt;br /&gt;
 $if($stricmp(%album artist%,Various),,%artist%-) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then,else) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $if2(expr,else) ===&lt;br /&gt;
&lt;br /&gt;
Like &#039;&#039;$if(expr,expr,else)&#039;&#039; except that &#039;&#039;expr&#039;&#039; is only evaluated once. In other words, if expression &#039;&#039;expr&#039;&#039; is true, &#039;&#039;expr&#039;&#039; is returned, otherwise the &#039;&#039;else&#039;&#039; part is evaluated and &#039;&#039;expr&#039;&#039; is returned as true.&lt;br /&gt;
&lt;br /&gt;
=== $if3(a1,a2,...,aN,else) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates arguments &#039;&#039;a1&#039;&#039; ... &#039;&#039;aN&#039;&#039;, until one is found that evaluates to &#039;&#039;true&#039;&#039;. If that happens, its value is returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifequal(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is equal to &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifgreater(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is greater than &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $iflonger(str,n,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the length of the string &#039;&#039;str&#039;&#039; to the number &#039;&#039;n&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;n&#039;&#039; characters, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $select(n,a1,...,aN) ===&lt;br /&gt;
&lt;br /&gt;
If the value of &#039;&#039;n&#039;&#039; is between 1 and N, &#039;&#039;an&#039;&#039; is evaluated and its value returned. Otherwise &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
== String functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to manipulate character strings.&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of string &#039;&#039;str&#039;&#039;. Words which begin with an alphanumeric character are shortened to the first character. Spaces and parentheses are stripped. Example:&lt;br /&gt;
* $abbr(&#039;This is a Long Title (12-inch version) [needs tags]&#039;) → TiaLT1v[needst&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters, otherwise returns &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $ansi(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.&lt;br /&gt;
&lt;br /&gt;
=== $ascii(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to ASCII. Any characters that are not present in ASCII will be removed / replaced.&lt;br /&gt;
&lt;br /&gt;
=== $caps(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and all other letters to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $caps2(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and leaves all other letters as they are.&lt;br /&gt;
&lt;br /&gt;
=== $char(nbr) ===&lt;br /&gt;
&lt;br /&gt;
Returns Unicode character of &#039;&#039;nbr&#039;&#039;. You can search for characters and find the matching decimal number on this [http://www.fileformat.info/info/unicode/char/search.htm site].&lt;br /&gt;
&lt;br /&gt;
=== $crc32(str) ===&lt;br /&gt;
&lt;br /&gt;
Computes the CRC32 of the string &#039;&#039;str&#039;&#039; as a number. Intended for use in coloring scripts.&lt;br /&gt;
&lt;br /&gt;
Example: $rgb($mod($crc32(%album%),256),128,128)&lt;br /&gt;
&lt;br /&gt;
=== $crlf() ===&lt;br /&gt;
&lt;br /&gt;
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system  notification area (&amp;quot;systray&amp;quot;) icon.&lt;br /&gt;
&lt;br /&gt;
=== $cut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $left(a,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $directory(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts only the directory name (not full path, ie given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;jazz&#039;) from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $directory(path,n) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory name from the file &#039;&#039;path&#039;&#039;; goes up by &#039;&#039;n&#039;&#039; levels.&lt;br /&gt;
&lt;br /&gt;
=== $directory_path(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory path from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
ie. given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;D:\music\jazz&#039;&lt;br /&gt;
&lt;br /&gt;
=== $ext(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file extension from string &#039;&#039;path&#039;&#039;; a file name or full path.&lt;br /&gt;
&lt;br /&gt;
=== $filename(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file name from full &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &amp;quot; (...)&amp;quot;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str,indicator) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &#039;&#039;indicator&#039;&#039;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $hex(int,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in hexadecimal notation with &#039;&#039;len&#039;&#039; digits. Pads with zeros from the left if necessary.&lt;br /&gt;
&lt;br /&gt;
=== $insert(str,insert,n) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;insert&#039;&#039; into &#039;&#039;str&#039;&#039; after &#039;&#039;n&#039;&#039; characters.&lt;br /&gt;
&lt;br /&gt;
=== $left(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $cut(str,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $len(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters.&lt;br /&gt;
&lt;br /&gt;
=== $len2(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters, respecting double-width character rules (double-width characters will be counted as two).&lt;br /&gt;
&lt;br /&gt;
=== $longer(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;true&#039;&#039;, if string &#039;&#039;str1&#039;&#039; is longer than string &#039;&#039;str2&#039;&#039;, false otherwise.&lt;br /&gt;
&lt;br /&gt;
=== $lower(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $longest(arg,...) ===&lt;br /&gt;
&lt;br /&gt;
Returns the longest of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $num(nbr,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;nbr&#039;&#039; in decimal notation with &#039;&#039;len&#039;&#039; characters. Pads with zeros from the left if necessary. &#039;&#039;len&#039;&#039; includes the dash when the number is negative. If &#039;&#039;nbr&#039;&#039; is not numeric, it is treated as zero. Examples:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;$num(123,5)&#039;&#039; → 00123&lt;br /&gt;
* &#039;&#039;$num(-123,5)&#039;&#039; → -0123&lt;br /&gt;
* &#039;&#039;$num(4.8,5)&#039;&#039; → 00004&lt;br /&gt;
* &#039;&#039;$num(A1,5)&#039;&#039; → 00000&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $progress(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with.&lt;br /&gt;
&lt;br /&gt;
Example:&#039;&#039;$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,&#039;#&#039;,&#039;=&#039;)&#039;&#039; produces &amp;quot;====#===============&amp;quot;, the # character is moving with playback position.&lt;br /&gt;
&lt;br /&gt;
=== $progress2(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with. Produces different appearance than &#039;&#039;$progress&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $repeat(expr,count) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;count&#039;&#039; copies of &#039;&#039;expr&#039;&#039;. Note that &#039;&#039;expr&#039;&#039; is evaluated once before its value is used, so &#039;&#039;$repeat&#039;&#039; cannot be used for loops.&lt;br /&gt;
&lt;br /&gt;
=== $replace(str,search,replace) ===&lt;br /&gt;
&lt;br /&gt;
Replaces all occurrences of string &#039;&#039;search&#039;&#039; in string &#039;&#039;str&#039;&#039; with string &#039;&#039;replace&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can also be used with an arbitrary number of arguments. Note that &#039;&#039;$replace(str,search1,replace1,search2,replace2)&#039;&#039; is generally not the same as &#039;&#039;$replace($replace(str,search1,replace1),search2,replace2)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$replace(ab,a,b,b,c)&#039;&#039; → &amp;quot;bc&amp;quot;, &#039;&#039;$replace($replace(ab,a,b),b,c)&#039;&#039; → &amp;quot;cc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== $right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first &#039;&#039;len&#039;&#039; characters from the right of string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $roman(int) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in roman notation.&lt;br /&gt;
&lt;br /&gt;
=== $rot13(str) ===&lt;br /&gt;
&lt;br /&gt;
Performs [http://en.wikipedia.org/wiki/ROT13 ROT13] transformation to given string.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$rot13(&#039;foobar2000&#039;)&#039;&#039; → &amp;quot;sbbone2000&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $shortest(str,...strN) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first shortest element of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $strchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strchr(abca,a)&#039;&#039; → 1&lt;br /&gt;
&lt;br /&gt;
=== $strrchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns positions of last occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strrchr(abca,a)&#039;&#039; → 4&lt;br /&gt;
&lt;br /&gt;
=== $strstr(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of string &#039;&#039;str2&#039;&#039; in string &#039;&#039;str1&#039;&#039;. Function is case-sensitive.&lt;br /&gt;
&lt;br /&gt;
=== $strcmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-sensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stricmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-insensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Removes the specified prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $substr(str,from,to) ===&lt;br /&gt;
&lt;br /&gt;
Returns substring of string &#039;&#039;str&#039;&#039;, starting from &#039;&#039;FROM&#039;&#039;-th character and ending at &#039;&#039;TO&#039;&#039;-th character.&lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Moves &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Moves the specified prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $trim(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes leading and trailing spaces from string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $tab() ===&lt;br /&gt;
&lt;br /&gt;
Inserts one tabulator character.&lt;br /&gt;
&lt;br /&gt;
=== $tab(count) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;count&#039;&#039; tabulator characters.&lt;br /&gt;
&lt;br /&gt;
=== $upper(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to uppercase.&lt;br /&gt;
&lt;br /&gt;
== Track info fields and functions ==&lt;br /&gt;
&lt;br /&gt;
The functions and fields in this section can be used to access information about tracks.&lt;br /&gt;
&lt;br /&gt;
=== Metadata fields and functions ===&lt;br /&gt;
&lt;br /&gt;
Generally, metadata from the files (whether in tags or a cue sheet) is mapped directly to a field which can be referenced case-insensitively. For example, the first tag named &#039;&#039;URL&#039;&#039; can be referenced as &#039;&#039;%url%&#039;&#039;, and the first standard comment tag can be referenced as &#039;&#039;%comment%&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following functions are also available for accessing metadata:&lt;br /&gt;
&lt;br /&gt;
==== $meta(name) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &amp;quot;, &amp;quot; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist)&#039;&#039; → &amp;quot;He, She, They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta(name,n) ====&lt;br /&gt;
Returns value of &#039;&#039;n&#039;&#039;-th (0,1,2 and so on) tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist,1)&#039;&#039; → &amp;quot;She&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039; + &#039;)&#039;&#039; → &amp;quot;He + She + They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep,lastsep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator between all but the last two values which are concatenated with &#039;&#039;lastsep&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039;, &#039;,&#039;, and &#039;)&#039;&#039; → &amp;quot;He, She, and They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_test(...) ====&lt;br /&gt;
Returns &#039;&#039;1&#039;&#039;, if all given tags exist, &#039;&#039;undefined&#039;&#039; otherwise.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_test(artist,title)&#039;&#039; → true&lt;br /&gt;
&lt;br /&gt;
==== $meta_num(name) ====&lt;br /&gt;
Returns the number of values for the tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_num(artist)&#039;&#039; → 3&lt;br /&gt;
&lt;br /&gt;
=== Remapped metadata fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields have special remapped values to make writing title format scripts more convenient:&lt;br /&gt;
&lt;br /&gt;
==== %album artist% ====&lt;br /&gt;
Name of the artist of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album artist&amp;quot;, &amp;quot;artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. The difference between this and &#039;&#039;%artist%&#039;&#039; is that &#039;&#039;%album artist%&#039;&#039; is intended for use where consistent value across entire album is needed even when per-track artists values vary.&lt;br /&gt;
&lt;br /&gt;
==== %album% ====&lt;br /&gt;
Name of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album&amp;quot;, &amp;quot;venue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %artist% ====&lt;br /&gt;
Name of the artist of the track. Checks following metadata fields, in this order: &amp;quot;artist&amp;quot;, &amp;quot;album artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. For a SHOUTcast stream which contains metadata, it is the StreamTitle up to the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %discnumber% ====&lt;br /&gt;
Index of disc specified track belongs to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %totaldiscs% ====&lt;br /&gt;
Index of total discs specified tracks belong to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %track artist% ====&lt;br /&gt;
Name of the artist of the track; present only if &#039;&#039;%album artist%&#039;&#039; is different than &#039;&#039;%artist%&#039;&#039; for specific track. Intended for use together with &#039;&#039;%album artist%&#039;&#039;, to indicate track-specific artist info, e.g. &amp;quot;%album artist% - %title%[ &#039;//&#039; %track artist%]&amp;quot;. In this case, the last part will be displayed only when track-specific artist info is present.&lt;br /&gt;
&lt;br /&gt;
==== %title% ====&lt;br /&gt;
Title of the track. If &amp;quot;title&amp;quot; metadata field is missing, file name is used instead. For a SHOUTcast stream which contains metadata, it is the StreamTitle after the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %tracknumber% ====&lt;br /&gt;
Two-digit index of specified track within the album. Available only when &amp;quot;tracknumber&amp;quot; field is present in track’s metadata. An extra &#039;0&#039; is placed in front of single digit track numbers (5 becomes 05) &amp;amp;ndash; otherwise the tracknumber field is returned unchanged (e.g. the following values remain as they are: 006, 05, 104, A3, two, -1, -).&lt;br /&gt;
&lt;br /&gt;
==== %track number% ====&lt;br /&gt;
Similar to %tracknumber%, however single digit track numbers are not reformatted to have an extra 0.&lt;br /&gt;
&lt;br /&gt;
==== %totaltracks% ====&lt;br /&gt;
Index of total tracks specified tracks belong to, within the album. Available only when &amp;quot;totaltracks&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
=== Technical information fields ===&lt;br /&gt;
&lt;br /&gt;
==== %bitrate% ====&lt;br /&gt;
Bitrate of the track in kilobits per second. VBR files will show a dynamic display for currently played track (outside of the playlist).&lt;br /&gt;
&lt;br /&gt;
==== %channels% ====&lt;br /&gt;
Number of channels in the track, as text; either &amp;quot;mono&amp;quot;, &amp;quot;stereo&amp;quot; for 1 or 2 channels, respectively, otherwise a number followed by &amp;quot;ch&amp;quot;, e.g. &amp;quot;6ch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %channel_mask% ====&lt;br /&gt;
Description of the used audio channels in the track, e.g. &amp;quot;FL FR FC LFE SL SR&amp;quot;. Introduced in foobar2000 preview 2024-06-30.&lt;br /&gt;
&lt;br /&gt;
==== %codec% ====&lt;br /&gt;
Name of codec used to encode the track, e.g. &amp;quot;PCM&amp;quot;, &amp;quot;FLAC&amp;quot;, &amp;quot;MP3&amp;quot;, or &amp;quot;AAC&amp;quot;. If exact codec name is not available, file extension is used.&lt;br /&gt;
&lt;br /&gt;
==== %codec_profile% ====&lt;br /&gt;
Additional information about encoding settings used, e.g. &amp;quot;CBR&amp;quot;. Not always available.&lt;br /&gt;
&lt;br /&gt;
==== %codec_long% ====&lt;br /&gt;
Long name of the codec, including profile, e.g. HE-AACv2. Some codecs, such as HE-AAC, supply this. If long name isn&#039;t supplied by the codec, %codec_long% falls back to %codec% / %codec_profile%. The Default UI&#039;s standard Codec column displays the same info.&lt;br /&gt;
&lt;br /&gt;
==== %filesize% ====&lt;br /&gt;
The exact file size in bytes.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_filesize%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %filesize_natural% ====&lt;br /&gt;
The approximate file size, automatically formatted in appropriate units such as megabytes or kilobytes, e.g. &amp;quot;8.49 MB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %length% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_ex% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, seconds, and milliseconds, rounded to the nearest millisecond.&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds% ====&lt;br /&gt;
The length of the track in seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds_fp% ====&lt;br /&gt;
The length of the track in seconds as a floating point number.&lt;br /&gt;
&lt;br /&gt;
==== %length_samples% ====&lt;br /&gt;
The length of the track in samples.&lt;br /&gt;
&lt;br /&gt;
==== %samplerate% ====&lt;br /&gt;
Sample rate of the track, in Hz.&lt;br /&gt;
&lt;br /&gt;
=== Technical information functions ===&lt;br /&gt;
&lt;br /&gt;
==== $info(name) ====&lt;br /&gt;
Returns value of technical information field called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For convenience, the &#039;&#039;&#039;%__name%&#039;&#039;&#039; alias is also available.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$info(channels)&#039;&#039; → 2&lt;br /&gt;
&lt;br /&gt;
Here is an &#039;&#039;&#039;informative&#039;&#039;&#039; list of recognized fields. Some of these depend on the media file type being queried.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! field name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;General&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|codec&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; MP3)&lt;br /&gt;
|-&lt;br /&gt;
|codec_profile&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec Profile&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; CBR)&lt;br /&gt;
|-&lt;br /&gt;
|samplerate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Sample Rate&#039;&#039;&#039;, in hertz (&#039;&#039;e.g.&#039;&#039; 44100)&lt;br /&gt;
|-&lt;br /&gt;
|bitrate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bitrate&#039;&#039;&#039;, in kilobits per second (&#039;&#039;e.g.&#039;&#039; 320)&lt;br /&gt;
|-&lt;br /&gt;
|tool&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tool&#039;&#039;&#039; used to produce the file, possibly guessed (&#039;&#039;e.g.&#039;&#039; LAME3.97)&lt;br /&gt;
|-&lt;br /&gt;
|encoding&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Encoding&#039;&#039;&#039; lossiness (&#039;&#039;e.g.&#039;&#039; lossy)&lt;br /&gt;
|-&lt;br /&gt;
|channels&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channels&#039;&#039;&#039; count (&#039;&#039;e.g.&#039;&#039; 2 &amp;lt;nowiki&amp;gt;[for stereo]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 16)&lt;br /&gt;
|-&lt;br /&gt;
|tagtype&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tag Type&#039;&#039;&#039;, comma-separated list of tag formats (&#039;&#039;e.g.&#039;&#039; id3v2|apev2)&lt;br /&gt;
|-&lt;br /&gt;
|cue_embedded&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Embedded Cuesheet&#039;&#039;&#039; presence (&#039;&#039;e.g.&#039;&#039; no &amp;lt;nowiki&amp;gt;[may be empty!]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|md5&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Audio MD5&#039;&#039;&#039; hash, if container defines it (&#039;&#039;e.g.&#039;&#039; 1E24A910D91EF09A8CF403C9B6963961)&lt;br /&gt;
|-&lt;br /&gt;
|WAVEFORMATEXTENSIBLE_CHANNEL_MASK&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel mask&#039;&#039;&#039;, channel layout of the track coded as hex (&#039;&#039;e.g.&#039;&#039; 0x0003 for regular stereo)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ENC_DELAY&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_delay&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 576)&lt;br /&gt;
|-&lt;br /&gt;
|ENC_PADDING&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_padding&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 1536)&lt;br /&gt;
|-&lt;br /&gt;
|MP3_ACCURATE_LENGTH&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|MP3 duration (%length% etc.) takes into account LAME or iTunes gapless playback info (&#039;&#039;e.g.&#039;&#039; yes)*&lt;br /&gt;
|-&lt;br /&gt;
|MP3_STEREO_MODE&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|Stereo mode used in MP3 file (&#039;&#039;e.g.&#039;&#039; mono, stereo, joint stereo, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|VERSION&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Version&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 3.99)&lt;br /&gt;
|-&lt;br /&gt;
|FLAGS&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Flags&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 22)&lt;br /&gt;
|-&lt;br /&gt;
|channel_mode&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel Mode&#039;&#039;&#039;, description of channels (note: this field was only used by obsolete foo_ac3. &#039;&#039;e.g.&#039;&#039; 3 front, 2 rear surround channels + LFE)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 90%&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; &#039;&#039;MP3_ACCURATE_LENGTH won&#039;t exist if gapless playback info isn&#039;t present or the file is not an MP3. The info can be in a LAME tag in the VBR header, or in an iTunSMPB ID3v2 comment tag. Gapless playback info is taken into account in .m4a files, but there&#039;s no special field to say so.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== $channels() ====&lt;br /&gt;
The number of channels in text format.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$channels()&#039;&#039; → &amp;quot;stereo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_gain% ====&lt;br /&gt;
The ReplayGain album gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak% ====&lt;br /&gt;
The ReplayGain album peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak_db% ====&lt;br /&gt;
The ReplayGain album peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_gain% ====&lt;br /&gt;
The ReplayGain track gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak% ====&lt;br /&gt;
The ReplayGain track peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak_db% ====&lt;br /&gt;
The ReplayGain track peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
=== Special fields ===&lt;br /&gt;
&lt;br /&gt;
==== %filename% ====&lt;br /&gt;
The filename without directory and extension.&lt;br /&gt;
&lt;br /&gt;
==== %filename_ext% ====&lt;br /&gt;
The filename with extension, but without the directory.&lt;br /&gt;
&lt;br /&gt;
==== %directoryname% ====&lt;br /&gt;
The name of the parent directory only, not the complete path.&lt;br /&gt;
&lt;br /&gt;
==== %last_modified% ====&lt;br /&gt;
The date and time the file was last modified. Eg: &#039;&#039;2005-12-22 00:04:10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== %path% ====&lt;br /&gt;
The complete path, including the filename and extension.&lt;br /&gt;
&lt;br /&gt;
==== %_path_raw% ====&lt;br /&gt;
The path as URL including the protocol scheme.&lt;br /&gt;
&lt;br /&gt;
==== %subsong% ====&lt;br /&gt;
The subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.&lt;br /&gt;
&lt;br /&gt;
==== %_foobar2000_version% ====&lt;br /&gt;
A string representing the version of foobar2000.&lt;br /&gt;
&lt;br /&gt;
== Time and date functions ==&lt;br /&gt;
&lt;br /&gt;
These functions are used to manipulate time/date strings, notably (but not limited to), [[Foobar2000:Titleformat_Playback_Statistics|those gathered]] by the [[Foobar2000:Components/Playback Statistics v3.x (foo playcount)|Playback Statistics component]].&lt;br /&gt;
&lt;br /&gt;
=== $year(time) ===&lt;br /&gt;
Retrieves the year part (formatted as four digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $month(time) ===&lt;br /&gt;
Retrieves the month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $day_of_month(time) ===&lt;br /&gt;
Retrieves the day of month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $date(time) ===&lt;br /&gt;
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $time(time) ===&lt;br /&gt;
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string.&lt;br /&gt;
&lt;br /&gt;
== Variable operations ==&lt;br /&gt;
&lt;br /&gt;
Variables can be used to store strings and numbers. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! code&lt;br /&gt;
! output&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre&amp;gt;$put(foo,bar)$char(10)&lt;br /&gt;
$get(foo)$char(10)&lt;br /&gt;
$get(Foo)$char(10)&lt;br /&gt;
$puts(foo,2000)$char(10)&lt;br /&gt;
$get(foo)$char(10)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot; |&amp;lt;pre&amp;gt;bar&lt;br /&gt;
bar&lt;br /&gt;
bar&lt;br /&gt;
&lt;br /&gt;
2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== $get(name) ===&lt;br /&gt;
Returns the value that was last stored in the variable &#039;&#039;name&#039;&#039;, if the variable was not defined (yet), it returns nothing. The truth value returned by &#039;&#039;$get&#039;&#039; indicates if the variable &#039;&#039;name&#039;&#039; was defined and is a non-empty string.&lt;br /&gt;
&lt;br /&gt;
=== $put(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns &#039;&#039;value&#039;&#039; unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $puts(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns nothing.&lt;br /&gt;
&lt;br /&gt;
== Component-specific fields and functions ==&lt;br /&gt;
&lt;br /&gt;
This section lists fields and functions which are specific to certain components. Unless otherwise stated, the fields and functions are only usable in the context of those components.&lt;br /&gt;
&lt;br /&gt;
=== Now playing info ===&lt;br /&gt;
&lt;br /&gt;
The following fields related to the currently playing item are only usable in certain locations outside of the playlist, e.g. in the status bar, the main window title and the copy command script.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time% ====&lt;br /&gt;
The elapsed time formatted as [HH:]MM:SS.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_seconds% ====&lt;br /&gt;
The elapsed time in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_elapsed%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining% ====&lt;br /&gt;
The time remaining until the track ends, formatted as [HH:]MM:SS.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining_seconds% ====&lt;br /&gt;
The time remaining until the track ends, in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Playlist-only fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields are only usable in playlist display formatting (i.e., the column title formatting patterns).&lt;br /&gt;
&lt;br /&gt;
==== %isplaying% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if file is currently playing, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %ispaused% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if playback is paused, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %list_index% ====&lt;br /&gt;
A zero-padded playlist index of specified item. The first item is at index 1.&lt;br /&gt;
&lt;br /&gt;
==== %list_total% ====&lt;br /&gt;
The number of items in the playlist.&lt;br /&gt;
&lt;br /&gt;
==== %queue_index% ====&lt;br /&gt;
Index of the specified item in the playback queue. If the item has been queued multiple times, %queue_index% evaluates to the first index.&lt;br /&gt;
&lt;br /&gt;
==== %queue_indexes% ====&lt;br /&gt;
List of indexes of the specified item in the playback queue. Same as %queue_index% unless the item has been queued more than once.&lt;br /&gt;
&lt;br /&gt;
==== %queue_total% ====&lt;br /&gt;
Total amount of tracks in playback queue. Available only for queued tracks, for technical reasons. &lt;br /&gt;
&lt;br /&gt;
=== Playlist text color ===&lt;br /&gt;
&lt;br /&gt;
==== Dimmed and highlighted text ====&lt;br /&gt;
&lt;br /&gt;
In the Default UI playlist, text color can be adjusted by enclosing it in angle-brackets. The only options are to make the text dimmer (mixing the default color with the background color) or brighter (mixing the default color with the highlight color):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;text&amp;gt;&#039;&#039; – dim &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&#039;&#039; – dimmer &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&amp;gt;&#039;&#039; – dimmest &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;text&amp;amp;lt;&#039;&#039; – bright &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brighter &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brightest &#039;&#039;text&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Historical and Columns UI color functions ====&lt;br /&gt;
&lt;br /&gt;
Prior to version 1.0, the default UI playlist supported the following color functions, which are still available in the Columns UI playlist:&lt;br /&gt;
&lt;br /&gt;
===== $blend(color1,color2,part,total) =====&lt;br /&gt;
Returns a color that is a blend between &#039;&#039;color1&#039;&#039; and &#039;&#039;color2&#039;&#039;. If &#039;&#039;part&#039;&#039; is smaller than or equal to zero, &#039;&#039;color1&#039;&#039; is returned. If &#039;&#039;part&#039;&#039; is greater than or equal to &#039;&#039;total&#039;&#039;, &#039;&#039;color2&#039;&#039; is returned. Otherwise a blended color is returned that is &#039;&#039;part&#039;&#039; parts &#039;&#039;color1&#039;&#039; and &#039;&#039;total&#039;&#039;-&#039;&#039;part&#039;&#039; parts &#039;&#039;color2&#039;&#039;. The blending is performed in the RGB color space.&lt;br /&gt;
&lt;br /&gt;
===== $hsl() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h,s,l) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039; and &#039;&#039;l&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
The ranges of &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039;, and &#039;&#039;l&#039;&#039; are from 0 to 240; the function is designed to interpret those values in the same way as the standard Windows color dialog.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h1,s1,l1,h2,s2,l2) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h1&#039;&#039;, &#039;&#039;s1&#039;&#039; and &#039;&#039;l1&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. &#039;&#039;h2&#039;&#039;, &#039;&#039;s2&#039;&#039; and &#039;&#039;l2&#039;&#039; are the hue, saturation, and lightness of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $rgb() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r,g,b) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r&#039;&#039;, &#039;&#039;g&#039;&#039; and &#039;&#039;b&#039;&#039; are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r1,g1,b1,r2,g2,b2) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r1&#039;&#039;, &#039;&#039;g1&#039;&#039; and &#039;&#039;b1&#039;&#039; are the red, green and blue component of the color for unselected text. &#039;&#039;r2&#039;&#039;, &#039;&#039;g2&#039;&#039; and &#039;&#039;b2&#039;&#039; are the red, green and blue component of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $transition(string,color1,color2) =====&lt;br /&gt;
Inserts color codes into &#039;&#039;string&#039;&#039;, so that the first character has &#039;&#039;color1&#039;&#039;, the last character has &#039;&#039;color2&#039;&#039;, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying &#039;&#039;$transition&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Album List ===&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Titleformat_Album_List|Album List Title Formatting]]&lt;br /&gt;
* [[Foobar2000:Preferences:Album List|Preferences: Album List]]&lt;br /&gt;
&lt;br /&gt;
=== Playback Statistics ===&lt;br /&gt;
&lt;br /&gt;
The foo_playcount component adds a number of fields for playback statistics and ratings. The fields can be used anywhere track info can be displayed. See the documentation for details:&lt;br /&gt;
* [http://www.foobar2000.org/components/view/foo_playcount Playback statistics homepage]&lt;br /&gt;
* [[Foobar2000:Titleformat Playback Statistics|Playback statistics titleformat reference]]&lt;br /&gt;
&lt;br /&gt;
=== Playlist Organizer ===&lt;br /&gt;
&lt;br /&gt;
This component adds a number of fields to control the display of a list of playlists. See the documentation for details:&lt;br /&gt;
* [[Foobar2000:Components/Playlist Organizer (foo_plorg)#Nodes|Playlist Organizer: Nodes Title Formatting]]&lt;br /&gt;
&lt;br /&gt;
=== Columns UI ===&lt;br /&gt;
&lt;br /&gt;
This component replaces the Default UI framework, including the playlist. See the documentation for details:&lt;br /&gt;
* [http://yuo.be/columns.php Columns UI homepage]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:global_variables Global variables reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:colour_string Playlist colors reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:playlist_switcher_titleformatting Playlist switcher reference]&lt;br /&gt;
&lt;br /&gt;
== Additional Reading ==&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Title Formatting Introduction|Introduction to titleformat scripts]]&lt;br /&gt;
* The file &#039;&#039;&#039;titleformat_help.html&#039;&#039;&#039; in your Foobar2000 directory, e.g. file:///C:/Program%20Files%20(x86)/foobar2000/titleformat_help.html&lt;br /&gt;
&lt;br /&gt;
[[Category:foobar2000 Guides|Titleformat Reference]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38281</id>
		<title>Foobar2000:Title Formatting Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38281"/>
		<updated>2024-10-27T07:24:27Z</updated>

		<summary type="html">&lt;p&gt;Case: /* Technical information fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{sidebar foobar2000 title formatting}}&lt;br /&gt;
This article contains information about built-in title formatting functions and field references, plus additional documentation about fields and functions which can only be used in specific components or which are provided by specific components.&lt;br /&gt;
&lt;br /&gt;
Please see [[Foobar2000:Title Formatting Introduction|Title Formatting Introduction]] for a general overview of title format syntax and its basic rules. The article [[foobar2000:Titleformat Examples|Titleformat Examples]] offers user-submitted examples of code for specific purposes; feel free to add your own if you think it can be of use to others.&lt;br /&gt;
&lt;br /&gt;
For details of the query syntax, which uses some of these fields to find files for playlists, etc., see the [[Foobar2000:Query_syntax|Query Syntax]] article.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
A title formatting script consists of any combination of literal text, field references, function calls, comments, and line break characters. The script always outputs a text string (which can be empty).&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;comment&#039;&#039;&#039; is a line starting with two slashes, e.g. {{code|// this is a comment}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;field reference&#039;&#039;&#039; is a field name enclosed in percent signs, for example {{code|%artist%}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;function call&#039;&#039;&#039; starts with a dollar sign, followed by the function name and the parameter list. A parameter list can either be empty – denoted as {{code|()}} – or contain one or more parameters separated by commas, for example {{code|$abbr(%artist%)}}. A parameter can be literal text, a field reference, or another function call. Note that there must be no whitespace between the dollar sign and the function name, or the function name and the opening parenthesis of the parameter list.&lt;br /&gt;
&lt;br /&gt;
Any other text is &#039;&#039;&#039;literal text&#039;&#039;&#039;. In literal text, the character {{code|%}}, {{code|$}}, {{code|[}}, {{code|]}}, or {{code|&#039;}} (apostrophe/single quote) must be escaped by enclosing it in {{code|&#039;}} (apostrophe/single quote) characters. For example, {{code|&#039;[&#039;}} (a left bracket in single quotes) results in a literal {{code|[}} (left bracket). As a special case, {{code|&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;}} (two single quotes in a row) results in one single quote. In the playlist, {{code|&amp;amp;lt;}} and {{code|&amp;amp;gt;}} are also special; see [[#Dimmed and highlighted text|Dimmed and highlighted text]].&lt;br /&gt;
&lt;br /&gt;
When the script is evaluated, the output string is assembled by evaluating the function parameters, function calls, and field references. Comments and line break characters (CR and LF/newline) are ignored; to output a line break, use {{code|$crlf()}}. Each field reference becomes the field&#039;s value, as a string. Each function becomes a string or number, and/or a truth value (not output) which can be used by another function.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The interface for entering custom columns and grouping schemes for the Default UI playlist does not support line breaks; scripts must be written all on one line, without comments.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Arithmetic functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string that can be interpreted as number. Leading whitespace is ignored. Decimal points are not supported. Examples:&lt;br /&gt;
* &#039;&#039;c3po&#039;&#039; → 0&lt;br /&gt;
* &#039;&#039;4.8&#039;&#039; → 4&lt;br /&gt;
* &#039;&#039;-12&#039;&#039; → -12&lt;br /&gt;
* &#039;&#039;- 12&#039;&#039; → 0&lt;br /&gt;
&lt;br /&gt;
=== $add(a,b, ...) ===&lt;br /&gt;
&lt;br /&gt;
Adds &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$add(a,b,...)&#039;&#039; is the same as &#039;&#039;$add($add(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $div(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Divides &#039;&#039;a&#039;&#039; by &#039;&#039;b&#039;&#039; and rounds down to an integer. If &#039;&#039;b&#039;&#039; evaluates to zero, it returns &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$div(a,b,...)&#039;&#039; is the same as &#039;&#039;$div($div(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $greater(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns true, if &#039;&#039;a&#039;&#039; is greater than &#039;&#039;b&#039;&#039;, otherwise false.&lt;br /&gt;
&lt;br /&gt;
=== $max(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the maximum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$max(a,b,...)&#039;&#039; is the same as &#039;&#039;$max($max(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $min(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the minimum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$min(a,b,...)&#039;&#039; is the same as &#039;&#039;$min($min(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mod(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Computes the remainder of dividing &#039;&#039;a&#039;&#039; through &#039;&#039;b&#039;&#039;. The result has the same sign as &#039;&#039;a&#039;&#039;. If &#039;&#039;b&#039;&#039; evaluates to zero, the result is &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mod(a,b,...)&#039;&#039; is the same as &#039;&#039;$mod($mod(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mul(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mul(a,b,...)&#039;&#039; is the same as &#039;&#039;$mul($mul(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $muldiv(a,b,c) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;, then divides by &#039;&#039;c&#039;&#039;. The result is rounded to the nearest integer.&lt;br /&gt;
&lt;br /&gt;
=== $rand() ===&lt;br /&gt;
&lt;br /&gt;
Generates a random number in the range from 0 to 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1. Available only in sort-related contexts, such as the &#039;&#039;Edit → Sort → Sort by ...&#039;&#039; menu command.&lt;br /&gt;
&lt;br /&gt;
=== $sub(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Subtracts &#039;&#039;b&#039;&#039; from &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$sub(a,b,...)&#039;&#039; is the same as &#039;&#039;$sub($sub(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Boolean functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to work with truth values (&#039;&#039;true&#039;&#039; and &#039;&#039;false&#039;&#039;), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with &#039;&#039;$if&#039;&#039; and related functions.&lt;br /&gt;
&lt;br /&gt;
Foobar does not have a concept of TRUE and FALSE in a programming language sense where 0 or empty string are considered FALSE and other values TRUE. Therefore there is no difference between numeric 0 and string representation &#039;0&#039; which both are considered as values, and being attached a boolean value FALSE. Apostrophes are only required to escape certain syntax characters. Values are treated as numbers during arithmetic operations like&#039;&#039; $add()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $and(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical And of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if and only if all &#039;&#039;expr&#039;&#039; arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $or(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if at least one expression evaluates to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $not(expr) ===&lt;br /&gt;
&lt;br /&gt;
Logical Not. Returns the logical opposite of EXPR: &#039;&#039;false&#039;&#039;, if &#039;&#039;expr&#039;&#039; is &#039;&#039;true&#039;&#039; and &#039;&#039;true&#039;&#039; if &#039;&#039;expr&#039;&#039; is false.&lt;br /&gt;
&lt;br /&gt;
=== $xor(expr,...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Exclusive-or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if an odd number of arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Special case: &#039;&#039;$xor(expr1,expr2)&#039;&#039; returns &#039;&#039;true&#039;&#039;, if EXPR1 or EXPR2 is &#039;&#039;true&#039;&#039;. If both expressions are true, returns &#039;&#039;false&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Control flow functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to conditionally execute statements.&lt;br /&gt;
&lt;br /&gt;
=== [...] (conditional section) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates the expression between &#039;&#039;[&#039;&#039; and &#039;&#039;]&#039;&#039;. If it has the truth value &#039;&#039;true&#039;&#039;, its string value and the truth value &#039;&#039;true&#039;&#039; are returned. Otherwise an empty string and &#039;&#039;false&#039;&#039; are returned.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;[%artist%]&#039;&#039; returns the value of the artist tag, if it exists. Otherwise it returns nothing, when &#039;&#039;artist&#039;&#039; would return &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
Plain strings are FALSE. Field lookups and functions can introduce a boolean value of TRUE. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Examples&amp;lt;/u&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;1&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #False: &lt;br /&gt;
 $if(0,True,False)&lt;br /&gt;
 # False: &lt;br /&gt;
 $if(&#039;0&#039;,True,False)&lt;br /&gt;
 # True or False: &lt;br /&gt;
 [$add(%rating%,1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The last one would display the value of %rating% plus one, if and only if %rating% is set for the track.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;2&amp;lt;/u&amp;gt;&lt;br /&gt;
Ignore inserting the %album artist%, if it contains the word &amp;quot;various&amp;quot;. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # Wrong: &lt;br /&gt;
 $if([%album artist%=Various],,%artist%-)&lt;br /&gt;
 # Good approach:&lt;br /&gt;
 $if($stricmp(%album artist%,Various),,%artist%-) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then,else) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $if2(expr,else) ===&lt;br /&gt;
&lt;br /&gt;
Like &#039;&#039;$if(expr,expr,else)&#039;&#039; except that &#039;&#039;expr&#039;&#039; is only evaluated once. In other words, if expression &#039;&#039;expr&#039;&#039; is true, &#039;&#039;expr&#039;&#039; is returned, otherwise the &#039;&#039;else&#039;&#039; part is evaluated and &#039;&#039;expr&#039;&#039; is returned as true.&lt;br /&gt;
&lt;br /&gt;
=== $if3(a1,a2,...,aN,else) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates arguments &#039;&#039;a1&#039;&#039; ... &#039;&#039;aN&#039;&#039;, until one is found that evaluates to &#039;&#039;true&#039;&#039;. If that happens, its value is returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifequal(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is equal to &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifgreater(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is greater than &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $iflonger(str,n,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the length of the string &#039;&#039;str&#039;&#039; to the number &#039;&#039;n&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;n&#039;&#039; characters, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $select(n,a1,...,aN) ===&lt;br /&gt;
&lt;br /&gt;
If the value of &#039;&#039;n&#039;&#039; is between 1 and N, &#039;&#039;an&#039;&#039; is evaluated and its value returned. Otherwise &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
== String functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to manipulate character strings.&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of string &#039;&#039;str&#039;&#039;. Words which begin with an alphanumeric character are shortened to the first character. Spaces and parentheses are stripped. Example:&lt;br /&gt;
* $abbr(&#039;This is a Long Title (12-inch version) [needs tags]&#039;) → TiaLT1v[needst&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters, otherwise returns &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $ansi(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.&lt;br /&gt;
&lt;br /&gt;
=== $ascii(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to ASCII. Any characters that are not present in ASCII will be removed / replaced.&lt;br /&gt;
&lt;br /&gt;
=== $caps(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and all other letters to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $caps2(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and leaves all other letters as they are.&lt;br /&gt;
&lt;br /&gt;
=== $char(nbr) ===&lt;br /&gt;
&lt;br /&gt;
Returns Unicode character of &#039;&#039;nbr&#039;&#039;. You can search for characters and find the matching decimal number on this [http://www.fileformat.info/info/unicode/char/search.htm site].&lt;br /&gt;
&lt;br /&gt;
=== $crc32(str) ===&lt;br /&gt;
&lt;br /&gt;
Computes the CRC32 of the string &#039;&#039;str&#039;&#039; as a number. Intended for use in coloring scripts.&lt;br /&gt;
&lt;br /&gt;
Example: $rgb($mod($crc32(%album%),256),128,128)&lt;br /&gt;
&lt;br /&gt;
=== $crlf() ===&lt;br /&gt;
&lt;br /&gt;
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system  notification area (&amp;quot;systray&amp;quot;) icon.&lt;br /&gt;
&lt;br /&gt;
=== $cut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $left(a,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $directory(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts only the directory name (not full path, ie given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;jazz&#039;) from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $directory(path,n) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory name from the file &#039;&#039;path&#039;&#039;; goes up by &#039;&#039;n&#039;&#039; levels.&lt;br /&gt;
&lt;br /&gt;
=== $directory_path(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory path from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
ie. given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;D:\music\jazz&#039;&lt;br /&gt;
&lt;br /&gt;
=== $ext(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file extension from string &#039;&#039;path&#039;&#039;; a file name or full path.&lt;br /&gt;
&lt;br /&gt;
=== $filename(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file name from full &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &amp;quot; (...)&amp;quot;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str,indicator) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &#039;&#039;indicator&#039;&#039;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $hex(int,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in hexadecimal notation with &#039;&#039;len&#039;&#039; digits. Pads with zeros from the left if necessary.&lt;br /&gt;
&lt;br /&gt;
=== $insert(str,insert,n) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;insert&#039;&#039; into &#039;&#039;str&#039;&#039; after &#039;&#039;n&#039;&#039; characters.&lt;br /&gt;
&lt;br /&gt;
=== $left(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $cut(str,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $len(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters.&lt;br /&gt;
&lt;br /&gt;
=== $len2(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters, respecting double-width character rules (double-width characters will be counted as two).&lt;br /&gt;
&lt;br /&gt;
=== $longer(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;true&#039;&#039;, if string &#039;&#039;str1&#039;&#039; is longer than string &#039;&#039;str2&#039;&#039;, false otherwise.&lt;br /&gt;
&lt;br /&gt;
=== $lower(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $longest(arg,...) ===&lt;br /&gt;
&lt;br /&gt;
Returns the longest of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $num(nbr,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;nbr&#039;&#039; in decimal notation with &#039;&#039;len&#039;&#039; characters. Pads with zeros from the left if necessary. &#039;&#039;len&#039;&#039; includes the dash when the number is negative. If &#039;&#039;nbr&#039;&#039; is not numeric, it is treated as zero. Examples:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;$num(123,5)&#039;&#039; → 00123&lt;br /&gt;
* &#039;&#039;$num(-123,5)&#039;&#039; → -0123&lt;br /&gt;
* &#039;&#039;$num(4.8,5)&#039;&#039; → 00004&lt;br /&gt;
* &#039;&#039;$num(A1,5)&#039;&#039; → 00000&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $progress(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with.&lt;br /&gt;
&lt;br /&gt;
Example:&#039;&#039;$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,&#039;#&#039;,&#039;=&#039;)&#039;&#039; produces &amp;quot;====#===============&amp;quot;, the # character is moving with playback position.&lt;br /&gt;
&lt;br /&gt;
=== $progress2(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with. Produces different appearance than &#039;&#039;$progress&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $repeat(expr,count) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;count&#039;&#039; copies of &#039;&#039;expr&#039;&#039;. Note that &#039;&#039;expr&#039;&#039; is evaluated once before its value is used, so &#039;&#039;$repeat&#039;&#039; cannot be used for loops.&lt;br /&gt;
&lt;br /&gt;
=== $replace(str,search,replace) ===&lt;br /&gt;
&lt;br /&gt;
Replaces all occurrences of string &#039;&#039;search&#039;&#039; in string &#039;&#039;str&#039;&#039; with string &#039;&#039;replace&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can also be used with an arbitrary number of arguments. Note that &#039;&#039;$replace(str,search1,replace1,search2,replace2)&#039;&#039; is generally not the same as &#039;&#039;$replace($replace(str,search1,replace1),search2,replace2)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$replace(ab,a,b,b,c)&#039;&#039; → &amp;quot;bc&amp;quot;, &#039;&#039;$replace($replace(ab,a,b),b,c)&#039;&#039; → &amp;quot;cc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== $right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first &#039;&#039;len&#039;&#039; characters from the right of string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $roman(int) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in roman notation.&lt;br /&gt;
&lt;br /&gt;
=== $rot13(str) ===&lt;br /&gt;
&lt;br /&gt;
Performs [http://en.wikipedia.org/wiki/ROT13 ROT13] transformation to given string.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$rot13(&#039;foobar2000&#039;)&#039;&#039; → &amp;quot;sbbone2000&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $shortest(str,...strN) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first shortest element of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $strchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strchr(abca,a)&#039;&#039; → 1&lt;br /&gt;
&lt;br /&gt;
=== $strrchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns positions of last occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strrchr(abca,a)&#039;&#039; → 4&lt;br /&gt;
&lt;br /&gt;
=== $strstr(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of string &#039;&#039;str2&#039;&#039; in string &#039;&#039;str1&#039;&#039;. Function is case-sensitive.&lt;br /&gt;
&lt;br /&gt;
=== $strcmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-sensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stricmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-insensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Removes the specified prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $substr(str,from,to) ===&lt;br /&gt;
&lt;br /&gt;
Returns substring of string &#039;&#039;str&#039;&#039;, starting from &#039;&#039;FROM&#039;&#039;-th character and ending at &#039;&#039;TO&#039;&#039;-th character.&lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Moves &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Moves the specified prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $trim(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes leading and trailing spaces from string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $tab() ===&lt;br /&gt;
&lt;br /&gt;
Inserts one tabulator character.&lt;br /&gt;
&lt;br /&gt;
=== $tab(count) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;count&#039;&#039; tabulator characters.&lt;br /&gt;
&lt;br /&gt;
=== $upper(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to uppercase.&lt;br /&gt;
&lt;br /&gt;
== Track info fields and functions ==&lt;br /&gt;
&lt;br /&gt;
The functions and fields in this section can be used to access information about tracks.&lt;br /&gt;
&lt;br /&gt;
=== Metadata fields and functions ===&lt;br /&gt;
&lt;br /&gt;
Generally, metadata from the files (whether in tags or a cue sheet) is mapped directly to a field which can be referenced case-insensitively. For example, the first tag named &#039;&#039;URL&#039;&#039; can be referenced as &#039;&#039;%url%&#039;&#039;, and the first standard comment tag can be referenced as &#039;&#039;%comment%&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following functions are also available for accessing metadata:&lt;br /&gt;
&lt;br /&gt;
==== $meta(name) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &amp;quot;, &amp;quot; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist)&#039;&#039; → &amp;quot;He, She, They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta(name,n) ====&lt;br /&gt;
Returns value of &#039;&#039;n&#039;&#039;-th (0,1,2 and so on) tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist,1)&#039;&#039; → &amp;quot;She&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039; + &#039;)&#039;&#039; → &amp;quot;He + She + They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep,lastsep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator between all but the last two values which are concatenated with &#039;&#039;lastsep&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039;, &#039;,&#039;, and &#039;)&#039;&#039; → &amp;quot;He, She, and They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_test(...) ====&lt;br /&gt;
Returns &#039;&#039;1&#039;&#039;, if all given tags exist, &#039;&#039;undefined&#039;&#039; otherwise.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_test(artist,title)&#039;&#039; → true&lt;br /&gt;
&lt;br /&gt;
==== $meta_num(name) ====&lt;br /&gt;
Returns the number of values for the tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_num(artist)&#039;&#039; → 3&lt;br /&gt;
&lt;br /&gt;
=== Remapped metadata fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields have special remapped values to make writing title format scripts more convenient:&lt;br /&gt;
&lt;br /&gt;
==== %album artist% ====&lt;br /&gt;
Name of the artist of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album artist&amp;quot;, &amp;quot;artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. The difference between this and &#039;&#039;%artist%&#039;&#039; is that &#039;&#039;%album artist%&#039;&#039; is intended for use where consistent value across entire album is needed even when per-track artists values vary.&lt;br /&gt;
&lt;br /&gt;
==== %album% ====&lt;br /&gt;
Name of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album&amp;quot;, &amp;quot;venue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %artist% ====&lt;br /&gt;
Name of the artist of the track. Checks following metadata fields, in this order: &amp;quot;artist&amp;quot;, &amp;quot;album artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. For a SHOUTcast stream which contains metadata, it is the StreamTitle up to the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %discnumber% ====&lt;br /&gt;
Index of disc specified track belongs to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %totaldiscs% ====&lt;br /&gt;
Index of total discs specified tracks belong to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %track artist% ====&lt;br /&gt;
Name of the artist of the track; present only if &#039;&#039;%album artist%&#039;&#039; is different than &#039;&#039;%artist%&#039;&#039; for specific track. Intended for use together with &#039;&#039;%album artist%&#039;&#039;, to indicate track-specific artist info, e.g. &amp;quot;%album artist% - %title%[ &#039;//&#039; %track artist%]&amp;quot;. In this case, the last part will be displayed only when track-specific artist info is present.&lt;br /&gt;
&lt;br /&gt;
==== %title% ====&lt;br /&gt;
Title of the track. If &amp;quot;title&amp;quot; metadata field is missing, file name is used instead. For a SHOUTcast stream which contains metadata, it is the StreamTitle after the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %tracknumber% ====&lt;br /&gt;
Two-digit index of specified track within the album. Available only when &amp;quot;tracknumber&amp;quot; field is present in track’s metadata. An extra &#039;0&#039; is placed in front of single digit track numbers (5 becomes 05) &amp;amp;ndash; otherwise the tracknumber field is returned unchanged (e.g. the following values remain as they are: 006, 05, 104, A3, two, -1, -).&lt;br /&gt;
&lt;br /&gt;
==== %track number% ====&lt;br /&gt;
Similar to %tracknumber%, however single digit track numbers are not reformatted to have an extra 0.&lt;br /&gt;
&lt;br /&gt;
==== %totaltracks% ====&lt;br /&gt;
Index of total tracks specified tracks belong to, within the album. Available only when &amp;quot;totaltracks&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
=== Technical information fields ===&lt;br /&gt;
&lt;br /&gt;
==== %bitrate% ====&lt;br /&gt;
Bitrate of the track in kilobits per second. VBR files will show a dynamic display for currently played track (outside of the playlist).&lt;br /&gt;
&lt;br /&gt;
==== %channels% ====&lt;br /&gt;
Number of channels in the track, as text; either &amp;quot;mono&amp;quot;, &amp;quot;stereo&amp;quot; for 1 or 2 channels, respectively, otherwise a number followed by &amp;quot;ch&amp;quot;, e.g. &amp;quot;6ch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %channel_mask% ====&lt;br /&gt;
Description of the used audio channels in the track, e.g. &amp;quot;FL FR FC LFE SL SR&amp;quot;. Introduced in foobar2000 preview 2024-06-30.&lt;br /&gt;
&lt;br /&gt;
==== %codec% ====&lt;br /&gt;
Name of codec used to encode the track, e.g. PCM, FLAC, MP3, or AAC. If exact codec name is not available, file extension is used. The Default UI&#039;s standard Codec column displays the same info, but sometimes adds details, e.g. &amp;quot;MP3 / VBR V2&amp;quot; or &amp;quot;AAC / LC&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %filesize% ====&lt;br /&gt;
The exact file size in bytes.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_filesize%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %filesize_natural% ====&lt;br /&gt;
The approximate file size, automatically formatted in appropriate units such as megabytes or kilobytes, e.g. &amp;quot;8.49 MB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %length% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_ex% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, seconds, and milliseconds, rounded to the nearest millisecond.&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds% ====&lt;br /&gt;
The length of the track in seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds_fp% ====&lt;br /&gt;
The length of the track in seconds as a floating point number.&lt;br /&gt;
&lt;br /&gt;
==== %length_samples% ====&lt;br /&gt;
The length of the track in samples.&lt;br /&gt;
&lt;br /&gt;
==== %samplerate% ====&lt;br /&gt;
Sample rate of the track, in Hz.&lt;br /&gt;
&lt;br /&gt;
=== Technical information functions ===&lt;br /&gt;
&lt;br /&gt;
==== $info(name) ====&lt;br /&gt;
Returns value of technical information field called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For convenience, the &#039;&#039;&#039;%__name%&#039;&#039;&#039; alias is also available.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$info(channels)&#039;&#039; → 2&lt;br /&gt;
&lt;br /&gt;
Here is an &#039;&#039;&#039;informative&#039;&#039;&#039; list of recognized fields. Some of these depend on the media file type being queried.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! field name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;General&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|codec&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; MP3)&lt;br /&gt;
|-&lt;br /&gt;
|codec_profile&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec Profile&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; CBR)&lt;br /&gt;
|-&lt;br /&gt;
|samplerate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Sample Rate&#039;&#039;&#039;, in hertz (&#039;&#039;e.g.&#039;&#039; 44100)&lt;br /&gt;
|-&lt;br /&gt;
|bitrate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bitrate&#039;&#039;&#039;, in kilobits per second (&#039;&#039;e.g.&#039;&#039; 320)&lt;br /&gt;
|-&lt;br /&gt;
|tool&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tool&#039;&#039;&#039; used to produce the file, possibly guessed (&#039;&#039;e.g.&#039;&#039; LAME3.97)&lt;br /&gt;
|-&lt;br /&gt;
|encoding&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Encoding&#039;&#039;&#039; lossiness (&#039;&#039;e.g.&#039;&#039; lossy)&lt;br /&gt;
|-&lt;br /&gt;
|channels&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channels&#039;&#039;&#039; count (&#039;&#039;e.g.&#039;&#039; 2 &amp;lt;nowiki&amp;gt;[for stereo]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 16)&lt;br /&gt;
|-&lt;br /&gt;
|tagtype&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tag Type&#039;&#039;&#039;, comma-separated list of tag formats (&#039;&#039;e.g.&#039;&#039; id3v2|apev2)&lt;br /&gt;
|-&lt;br /&gt;
|cue_embedded&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Embedded Cuesheet&#039;&#039;&#039; presence (&#039;&#039;e.g.&#039;&#039; no &amp;lt;nowiki&amp;gt;[may be empty!]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|md5&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Audio MD5&#039;&#039;&#039; hash, if container defines it (&#039;&#039;e.g.&#039;&#039; 1E24A910D91EF09A8CF403C9B6963961)&lt;br /&gt;
|-&lt;br /&gt;
|WAVEFORMATEXTENSIBLE_CHANNEL_MASK&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel mask&#039;&#039;&#039;, channel layout of the track coded as hex (&#039;&#039;e.g.&#039;&#039; 0x0003 for regular stereo)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ENC_DELAY&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_delay&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 576)&lt;br /&gt;
|-&lt;br /&gt;
|ENC_PADDING&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_padding&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 1536)&lt;br /&gt;
|-&lt;br /&gt;
|MP3_ACCURATE_LENGTH&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|MP3 duration (%length% etc.) takes into account LAME or iTunes gapless playback info (&#039;&#039;e.g.&#039;&#039; yes)*&lt;br /&gt;
|-&lt;br /&gt;
|MP3_STEREO_MODE&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|Stereo mode used in MP3 file (&#039;&#039;e.g.&#039;&#039; mono, stereo, joint stereo, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|VERSION&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Version&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 3.99)&lt;br /&gt;
|-&lt;br /&gt;
|FLAGS&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Flags&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 22)&lt;br /&gt;
|-&lt;br /&gt;
|channel_mode&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel Mode&#039;&#039;&#039;, description of channels (note: this field was only used by obsolete foo_ac3. &#039;&#039;e.g.&#039;&#039; 3 front, 2 rear surround channels + LFE)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 90%&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; &#039;&#039;MP3_ACCURATE_LENGTH won&#039;t exist if gapless playback info isn&#039;t present or the file is not an MP3. The info can be in a LAME tag in the VBR header, or in an iTunSMPB ID3v2 comment tag. Gapless playback info is taken into account in .m4a files, but there&#039;s no special field to say so.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== $channels() ====&lt;br /&gt;
The number of channels in text format.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$channels()&#039;&#039; → &amp;quot;stereo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_gain% ====&lt;br /&gt;
The ReplayGain album gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak% ====&lt;br /&gt;
The ReplayGain album peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak_db% ====&lt;br /&gt;
The ReplayGain album peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_gain% ====&lt;br /&gt;
The ReplayGain track gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak% ====&lt;br /&gt;
The ReplayGain track peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak_db% ====&lt;br /&gt;
The ReplayGain track peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
=== Special fields ===&lt;br /&gt;
&lt;br /&gt;
==== %filename% ====&lt;br /&gt;
The filename without directory and extension.&lt;br /&gt;
&lt;br /&gt;
==== %filename_ext% ====&lt;br /&gt;
The filename with extension, but without the directory.&lt;br /&gt;
&lt;br /&gt;
==== %directoryname% ====&lt;br /&gt;
The name of the parent directory only, not the complete path.&lt;br /&gt;
&lt;br /&gt;
==== %last_modified% ====&lt;br /&gt;
The date and time the file was last modified. Eg: &#039;&#039;2005-12-22 00:04:10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== %path% ====&lt;br /&gt;
The complete path, including the filename and extension.&lt;br /&gt;
&lt;br /&gt;
==== %_path_raw% ====&lt;br /&gt;
The path as URL including the protocol scheme.&lt;br /&gt;
&lt;br /&gt;
==== %subsong% ====&lt;br /&gt;
The subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.&lt;br /&gt;
&lt;br /&gt;
==== %_foobar2000_version% ====&lt;br /&gt;
A string representing the version of foobar2000.&lt;br /&gt;
&lt;br /&gt;
== Time and date functions ==&lt;br /&gt;
&lt;br /&gt;
These functions are used to manipulate time/date strings, notably (but not limited to), [[Foobar2000:Titleformat_Playback_Statistics|those gathered]] by the [[Foobar2000:Components/Playback Statistics v3.x (foo playcount)|Playback Statistics component]].&lt;br /&gt;
&lt;br /&gt;
=== $year(time) ===&lt;br /&gt;
Retrieves the year part (formatted as four digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $month(time) ===&lt;br /&gt;
Retrieves the month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $day_of_month(time) ===&lt;br /&gt;
Retrieves the day of month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $date(time) ===&lt;br /&gt;
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $time(time) ===&lt;br /&gt;
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string.&lt;br /&gt;
&lt;br /&gt;
== Variable operations ==&lt;br /&gt;
&lt;br /&gt;
Variables can be used to store strings and numbers. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! code&lt;br /&gt;
! output&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre&amp;gt;$put(foo,bar)$char(10)&lt;br /&gt;
$get(foo)$char(10)&lt;br /&gt;
$get(Foo)$char(10)&lt;br /&gt;
$puts(foo,2000)$char(10)&lt;br /&gt;
$get(foo)$char(10)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot; |&amp;lt;pre&amp;gt;bar&lt;br /&gt;
bar&lt;br /&gt;
bar&lt;br /&gt;
&lt;br /&gt;
2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== $get(name) ===&lt;br /&gt;
Returns the value that was last stored in the variable &#039;&#039;name&#039;&#039;, if the variable was not defined (yet), it returns nothing. The truth value returned by &#039;&#039;$get&#039;&#039; indicates if the variable &#039;&#039;name&#039;&#039; was defined and is a non-empty string.&lt;br /&gt;
&lt;br /&gt;
=== $put(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns &#039;&#039;value&#039;&#039; unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $puts(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns nothing.&lt;br /&gt;
&lt;br /&gt;
== Component-specific fields and functions ==&lt;br /&gt;
&lt;br /&gt;
This section lists fields and functions which are specific to certain components. Unless otherwise stated, the fields and functions are only usable in the context of those components.&lt;br /&gt;
&lt;br /&gt;
=== Now playing info ===&lt;br /&gt;
&lt;br /&gt;
The following fields related to the currently playing item are only usable in certain locations outside of the playlist, e.g. in the status bar, the main window title and the copy command script.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time% ====&lt;br /&gt;
The elapsed time formatted as [HH:]MM:SS.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_seconds% ====&lt;br /&gt;
The elapsed time in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_elapsed%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining% ====&lt;br /&gt;
The time remaining until the track ends, formatted as [HH:]MM:SS.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining_seconds% ====&lt;br /&gt;
The time remaining until the track ends, in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Playlist-only fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields are only usable in playlist display formatting (i.e., the column title formatting patterns).&lt;br /&gt;
&lt;br /&gt;
==== %isplaying% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if file is currently playing, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %ispaused% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if playback is paused, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %list_index% ====&lt;br /&gt;
A zero-padded playlist index of specified item. The first item is at index 1.&lt;br /&gt;
&lt;br /&gt;
==== %list_total% ====&lt;br /&gt;
The number of items in the playlist.&lt;br /&gt;
&lt;br /&gt;
==== %queue_index% ====&lt;br /&gt;
Index of the specified item in the playback queue. If the item has been queued multiple times, %queue_index% evaluates to the first index.&lt;br /&gt;
&lt;br /&gt;
==== %queue_indexes% ====&lt;br /&gt;
List of indexes of the specified item in the playback queue. Same as %queue_index% unless the item has been queued more than once.&lt;br /&gt;
&lt;br /&gt;
==== %queue_total% ====&lt;br /&gt;
Total amount of tracks in playback queue. Available only for queued tracks, for technical reasons. &lt;br /&gt;
&lt;br /&gt;
=== Playlist text color ===&lt;br /&gt;
&lt;br /&gt;
==== Dimmed and highlighted text ====&lt;br /&gt;
&lt;br /&gt;
In the Default UI playlist, text color can be adjusted by enclosing it in angle-brackets. The only options are to make the text dimmer (mixing the default color with the background color) or brighter (mixing the default color with the highlight color):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;text&amp;gt;&#039;&#039; – dim &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&#039;&#039; – dimmer &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&amp;gt;&#039;&#039; – dimmest &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;text&amp;amp;lt;&#039;&#039; – bright &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brighter &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brightest &#039;&#039;text&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Historical and Columns UI color functions ====&lt;br /&gt;
&lt;br /&gt;
Prior to version 1.0, the default UI playlist supported the following color functions, which are still available in the Columns UI playlist:&lt;br /&gt;
&lt;br /&gt;
===== $blend(color1,color2,part,total) =====&lt;br /&gt;
Returns a color that is a blend between &#039;&#039;color1&#039;&#039; and &#039;&#039;color2&#039;&#039;. If &#039;&#039;part&#039;&#039; is smaller than or equal to zero, &#039;&#039;color1&#039;&#039; is returned. If &#039;&#039;part&#039;&#039; is greater than or equal to &#039;&#039;total&#039;&#039;, &#039;&#039;color2&#039;&#039; is returned. Otherwise a blended color is returned that is &#039;&#039;part&#039;&#039; parts &#039;&#039;color1&#039;&#039; and &#039;&#039;total&#039;&#039;-&#039;&#039;part&#039;&#039; parts &#039;&#039;color2&#039;&#039;. The blending is performed in the RGB color space.&lt;br /&gt;
&lt;br /&gt;
===== $hsl() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h,s,l) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039; and &#039;&#039;l&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
The ranges of &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039;, and &#039;&#039;l&#039;&#039; are from 0 to 240; the function is designed to interpret those values in the same way as the standard Windows color dialog.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h1,s1,l1,h2,s2,l2) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h1&#039;&#039;, &#039;&#039;s1&#039;&#039; and &#039;&#039;l1&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. &#039;&#039;h2&#039;&#039;, &#039;&#039;s2&#039;&#039; and &#039;&#039;l2&#039;&#039; are the hue, saturation, and lightness of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $rgb() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r,g,b) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r&#039;&#039;, &#039;&#039;g&#039;&#039; and &#039;&#039;b&#039;&#039; are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r1,g1,b1,r2,g2,b2) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r1&#039;&#039;, &#039;&#039;g1&#039;&#039; and &#039;&#039;b1&#039;&#039; are the red, green and blue component of the color for unselected text. &#039;&#039;r2&#039;&#039;, &#039;&#039;g2&#039;&#039; and &#039;&#039;b2&#039;&#039; are the red, green and blue component of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $transition(string,color1,color2) =====&lt;br /&gt;
Inserts color codes into &#039;&#039;string&#039;&#039;, so that the first character has &#039;&#039;color1&#039;&#039;, the last character has &#039;&#039;color2&#039;&#039;, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying &#039;&#039;$transition&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Album List ===&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Titleformat_Album_List|Album List Title Formatting]]&lt;br /&gt;
* [[Foobar2000:Preferences:Album List|Preferences: Album List]]&lt;br /&gt;
&lt;br /&gt;
=== Playback Statistics ===&lt;br /&gt;
&lt;br /&gt;
The foo_playcount component adds a number of fields for playback statistics and ratings. The fields can be used anywhere track info can be displayed. See the documentation for details:&lt;br /&gt;
* [http://www.foobar2000.org/components/view/foo_playcount Playback statistics homepage]&lt;br /&gt;
* [[Foobar2000:Titleformat Playback Statistics|Playback statistics titleformat reference]]&lt;br /&gt;
&lt;br /&gt;
=== Playlist Organizer ===&lt;br /&gt;
&lt;br /&gt;
This component adds a number of fields to control the display of a list of playlists. See the documentation for details:&lt;br /&gt;
* [[Foobar2000:Components/Playlist Organizer (foo_plorg)#Nodes|Playlist Organizer: Nodes Title Formatting]]&lt;br /&gt;
&lt;br /&gt;
=== Columns UI ===&lt;br /&gt;
&lt;br /&gt;
This component replaces the Default UI framework, including the playlist. See the documentation for details:&lt;br /&gt;
* [http://yuo.be/columns.php Columns UI homepage]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:global_variables Global variables reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:colour_string Playlist colors reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:playlist_switcher_titleformatting Playlist switcher reference]&lt;br /&gt;
&lt;br /&gt;
== Additional Reading ==&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Title Formatting Introduction|Introduction to titleformat scripts]]&lt;br /&gt;
* The file &#039;&#039;&#039;titleformat_help.html&#039;&#039;&#039; in your Foobar2000 directory, e.g. file:///C:/Program%20Files%20(x86)/foobar2000/titleformat_help.html&lt;br /&gt;
&lt;br /&gt;
[[Category:foobar2000 Guides|Titleformat Reference]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38280</id>
		<title>Foobar2000:Title Formatting Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38280"/>
		<updated>2024-10-27T07:23:13Z</updated>

		<summary type="html">&lt;p&gt;Case: /* Technical information fields */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{sidebar foobar2000 title formatting}}&lt;br /&gt;
This article contains information about built-in title formatting functions and field references, plus additional documentation about fields and functions which can only be used in specific components or which are provided by specific components.&lt;br /&gt;
&lt;br /&gt;
Please see [[Foobar2000:Title Formatting Introduction|Title Formatting Introduction]] for a general overview of title format syntax and its basic rules. The article [[foobar2000:Titleformat Examples|Titleformat Examples]] offers user-submitted examples of code for specific purposes; feel free to add your own if you think it can be of use to others.&lt;br /&gt;
&lt;br /&gt;
For details of the query syntax, which uses some of these fields to find files for playlists, etc., see the [[Foobar2000:Query_syntax|Query Syntax]] article.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
A title formatting script consists of any combination of literal text, field references, function calls, comments, and line break characters. The script always outputs a text string (which can be empty).&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;comment&#039;&#039;&#039; is a line starting with two slashes, e.g. {{code|// this is a comment}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;field reference&#039;&#039;&#039; is a field name enclosed in percent signs, for example {{code|%artist%}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;function call&#039;&#039;&#039; starts with a dollar sign, followed by the function name and the parameter list. A parameter list can either be empty – denoted as {{code|()}} – or contain one or more parameters separated by commas, for example {{code|$abbr(%artist%)}}. A parameter can be literal text, a field reference, or another function call. Note that there must be no whitespace between the dollar sign and the function name, or the function name and the opening parenthesis of the parameter list.&lt;br /&gt;
&lt;br /&gt;
Any other text is &#039;&#039;&#039;literal text&#039;&#039;&#039;. In literal text, the character {{code|%}}, {{code|$}}, {{code|[}}, {{code|]}}, or {{code|&#039;}} (apostrophe/single quote) must be escaped by enclosing it in {{code|&#039;}} (apostrophe/single quote) characters. For example, {{code|&#039;[&#039;}} (a left bracket in single quotes) results in a literal {{code|[}} (left bracket). As a special case, {{code|&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;}} (two single quotes in a row) results in one single quote. In the playlist, {{code|&amp;amp;lt;}} and {{code|&amp;amp;gt;}} are also special; see [[#Dimmed and highlighted text|Dimmed and highlighted text]].&lt;br /&gt;
&lt;br /&gt;
When the script is evaluated, the output string is assembled by evaluating the function parameters, function calls, and field references. Comments and line break characters (CR and LF/newline) are ignored; to output a line break, use {{code|$crlf()}}. Each field reference becomes the field&#039;s value, as a string. Each function becomes a string or number, and/or a truth value (not output) which can be used by another function.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The interface for entering custom columns and grouping schemes for the Default UI playlist does not support line breaks; scripts must be written all on one line, without comments.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Arithmetic functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string that can be interpreted as number. Leading whitespace is ignored. Decimal points are not supported. Examples:&lt;br /&gt;
* &#039;&#039;c3po&#039;&#039; → 0&lt;br /&gt;
* &#039;&#039;4.8&#039;&#039; → 4&lt;br /&gt;
* &#039;&#039;-12&#039;&#039; → -12&lt;br /&gt;
* &#039;&#039;- 12&#039;&#039; → 0&lt;br /&gt;
&lt;br /&gt;
=== $add(a,b, ...) ===&lt;br /&gt;
&lt;br /&gt;
Adds &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$add(a,b,...)&#039;&#039; is the same as &#039;&#039;$add($add(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $div(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Divides &#039;&#039;a&#039;&#039; by &#039;&#039;b&#039;&#039; and rounds down to an integer. If &#039;&#039;b&#039;&#039; evaluates to zero, it returns &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$div(a,b,...)&#039;&#039; is the same as &#039;&#039;$div($div(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $greater(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns true, if &#039;&#039;a&#039;&#039; is greater than &#039;&#039;b&#039;&#039;, otherwise false.&lt;br /&gt;
&lt;br /&gt;
=== $max(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the maximum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$max(a,b,...)&#039;&#039; is the same as &#039;&#039;$max($max(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $min(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the minimum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$min(a,b,...)&#039;&#039; is the same as &#039;&#039;$min($min(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mod(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Computes the remainder of dividing &#039;&#039;a&#039;&#039; through &#039;&#039;b&#039;&#039;. The result has the same sign as &#039;&#039;a&#039;&#039;. If &#039;&#039;b&#039;&#039; evaluates to zero, the result is &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mod(a,b,...)&#039;&#039; is the same as &#039;&#039;$mod($mod(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mul(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mul(a,b,...)&#039;&#039; is the same as &#039;&#039;$mul($mul(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $muldiv(a,b,c) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;, then divides by &#039;&#039;c&#039;&#039;. The result is rounded to the nearest integer.&lt;br /&gt;
&lt;br /&gt;
=== $rand() ===&lt;br /&gt;
&lt;br /&gt;
Generates a random number in the range from 0 to 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1. Available only in sort-related contexts, such as the &#039;&#039;Edit → Sort → Sort by ...&#039;&#039; menu command.&lt;br /&gt;
&lt;br /&gt;
=== $sub(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Subtracts &#039;&#039;b&#039;&#039; from &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$sub(a,b,...)&#039;&#039; is the same as &#039;&#039;$sub($sub(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Boolean functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to work with truth values (&#039;&#039;true&#039;&#039; and &#039;&#039;false&#039;&#039;), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with &#039;&#039;$if&#039;&#039; and related functions.&lt;br /&gt;
&lt;br /&gt;
Foobar does not have a concept of TRUE and FALSE in a programming language sense where 0 or empty string are considered FALSE and other values TRUE. Therefore there is no difference between numeric 0 and string representation &#039;0&#039; which both are considered as values, and being attached a boolean value FALSE. Apostrophes are only required to escape certain syntax characters. Values are treated as numbers during arithmetic operations like&#039;&#039; $add()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $and(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical And of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if and only if all &#039;&#039;expr&#039;&#039; arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $or(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if at least one expression evaluates to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $not(expr) ===&lt;br /&gt;
&lt;br /&gt;
Logical Not. Returns the logical opposite of EXPR: &#039;&#039;false&#039;&#039;, if &#039;&#039;expr&#039;&#039; is &#039;&#039;true&#039;&#039; and &#039;&#039;true&#039;&#039; if &#039;&#039;expr&#039;&#039; is false.&lt;br /&gt;
&lt;br /&gt;
=== $xor(expr,...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Exclusive-or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if an odd number of arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Special case: &#039;&#039;$xor(expr1,expr2)&#039;&#039; returns &#039;&#039;true&#039;&#039;, if EXPR1 or EXPR2 is &#039;&#039;true&#039;&#039;. If both expressions are true, returns &#039;&#039;false&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Control flow functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to conditionally execute statements.&lt;br /&gt;
&lt;br /&gt;
=== [...] (conditional section) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates the expression between &#039;&#039;[&#039;&#039; and &#039;&#039;]&#039;&#039;. If it has the truth value &#039;&#039;true&#039;&#039;, its string value and the truth value &#039;&#039;true&#039;&#039; are returned. Otherwise an empty string and &#039;&#039;false&#039;&#039; are returned.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;[%artist%]&#039;&#039; returns the value of the artist tag, if it exists. Otherwise it returns nothing, when &#039;&#039;artist&#039;&#039; would return &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
Plain strings are FALSE. Field lookups and functions can introduce a boolean value of TRUE. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Examples&amp;lt;/u&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;1&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #False: &lt;br /&gt;
 $if(0,True,False)&lt;br /&gt;
 # False: &lt;br /&gt;
 $if(&#039;0&#039;,True,False)&lt;br /&gt;
 # True or False: &lt;br /&gt;
 [$add(%rating%,1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The last one would display the value of %rating% plus one, if and only if %rating% is set for the track.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;2&amp;lt;/u&amp;gt;&lt;br /&gt;
Ignore inserting the %album artist%, if it contains the word &amp;quot;various&amp;quot;. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # Wrong: &lt;br /&gt;
 $if([%album artist%=Various],,%artist%-)&lt;br /&gt;
 # Good approach:&lt;br /&gt;
 $if($stricmp(%album artist%,Various),,%artist%-) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then,else) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $if2(expr,else) ===&lt;br /&gt;
&lt;br /&gt;
Like &#039;&#039;$if(expr,expr,else)&#039;&#039; except that &#039;&#039;expr&#039;&#039; is only evaluated once. In other words, if expression &#039;&#039;expr&#039;&#039; is true, &#039;&#039;expr&#039;&#039; is returned, otherwise the &#039;&#039;else&#039;&#039; part is evaluated and &#039;&#039;expr&#039;&#039; is returned as true.&lt;br /&gt;
&lt;br /&gt;
=== $if3(a1,a2,...,aN,else) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates arguments &#039;&#039;a1&#039;&#039; ... &#039;&#039;aN&#039;&#039;, until one is found that evaluates to &#039;&#039;true&#039;&#039;. If that happens, its value is returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifequal(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is equal to &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifgreater(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is greater than &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $iflonger(str,n,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the length of the string &#039;&#039;str&#039;&#039; to the number &#039;&#039;n&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;n&#039;&#039; characters, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $select(n,a1,...,aN) ===&lt;br /&gt;
&lt;br /&gt;
If the value of &#039;&#039;n&#039;&#039; is between 1 and N, &#039;&#039;an&#039;&#039; is evaluated and its value returned. Otherwise &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
== String functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to manipulate character strings.&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of string &#039;&#039;str&#039;&#039;. Words which begin with an alphanumeric character are shortened to the first character. Spaces and parentheses are stripped. Example:&lt;br /&gt;
* $abbr(&#039;This is a Long Title (12-inch version) [needs tags]&#039;) → TiaLT1v[needst&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters, otherwise returns &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $ansi(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.&lt;br /&gt;
&lt;br /&gt;
=== $ascii(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to ASCII. Any characters that are not present in ASCII will be removed / replaced.&lt;br /&gt;
&lt;br /&gt;
=== $caps(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and all other letters to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $caps2(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and leaves all other letters as they are.&lt;br /&gt;
&lt;br /&gt;
=== $char(nbr) ===&lt;br /&gt;
&lt;br /&gt;
Returns Unicode character of &#039;&#039;nbr&#039;&#039;. You can search for characters and find the matching decimal number on this [http://www.fileformat.info/info/unicode/char/search.htm site].&lt;br /&gt;
&lt;br /&gt;
=== $crc32(str) ===&lt;br /&gt;
&lt;br /&gt;
Computes the CRC32 of the string &#039;&#039;str&#039;&#039; as a number. Intended for use in coloring scripts.&lt;br /&gt;
&lt;br /&gt;
Example: $rgb($mod($crc32(%album%),256),128,128)&lt;br /&gt;
&lt;br /&gt;
=== $crlf() ===&lt;br /&gt;
&lt;br /&gt;
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system  notification area (&amp;quot;systray&amp;quot;) icon.&lt;br /&gt;
&lt;br /&gt;
=== $cut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $left(a,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $directory(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts only the directory name (not full path, ie given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;jazz&#039;) from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $directory(path,n) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory name from the file &#039;&#039;path&#039;&#039;; goes up by &#039;&#039;n&#039;&#039; levels.&lt;br /&gt;
&lt;br /&gt;
=== $directory_path(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory path from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
ie. given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;D:\music\jazz&#039;&lt;br /&gt;
&lt;br /&gt;
=== $ext(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file extension from string &#039;&#039;path&#039;&#039;; a file name or full path.&lt;br /&gt;
&lt;br /&gt;
=== $filename(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file name from full &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &amp;quot; (...)&amp;quot;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str,indicator) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &#039;&#039;indicator&#039;&#039;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $hex(int,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in hexadecimal notation with &#039;&#039;len&#039;&#039; digits. Pads with zeros from the left if necessary.&lt;br /&gt;
&lt;br /&gt;
=== $insert(str,insert,n) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;insert&#039;&#039; into &#039;&#039;str&#039;&#039; after &#039;&#039;n&#039;&#039; characters.&lt;br /&gt;
&lt;br /&gt;
=== $left(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $cut(str,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $len(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters.&lt;br /&gt;
&lt;br /&gt;
=== $len2(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters, respecting double-width character rules (double-width characters will be counted as two).&lt;br /&gt;
&lt;br /&gt;
=== $longer(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;true&#039;&#039;, if string &#039;&#039;str1&#039;&#039; is longer than string &#039;&#039;str2&#039;&#039;, false otherwise.&lt;br /&gt;
&lt;br /&gt;
=== $lower(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $longest(arg,...) ===&lt;br /&gt;
&lt;br /&gt;
Returns the longest of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $num(nbr,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;nbr&#039;&#039; in decimal notation with &#039;&#039;len&#039;&#039; characters. Pads with zeros from the left if necessary. &#039;&#039;len&#039;&#039; includes the dash when the number is negative. If &#039;&#039;nbr&#039;&#039; is not numeric, it is treated as zero. Examples:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;$num(123,5)&#039;&#039; → 00123&lt;br /&gt;
* &#039;&#039;$num(-123,5)&#039;&#039; → -0123&lt;br /&gt;
* &#039;&#039;$num(4.8,5)&#039;&#039; → 00004&lt;br /&gt;
* &#039;&#039;$num(A1,5)&#039;&#039; → 00000&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $progress(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with.&lt;br /&gt;
&lt;br /&gt;
Example:&#039;&#039;$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,&#039;#&#039;,&#039;=&#039;)&#039;&#039; produces &amp;quot;====#===============&amp;quot;, the # character is moving with playback position.&lt;br /&gt;
&lt;br /&gt;
=== $progress2(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with. Produces different appearance than &#039;&#039;$progress&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $repeat(expr,count) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;count&#039;&#039; copies of &#039;&#039;expr&#039;&#039;. Note that &#039;&#039;expr&#039;&#039; is evaluated once before its value is used, so &#039;&#039;$repeat&#039;&#039; cannot be used for loops.&lt;br /&gt;
&lt;br /&gt;
=== $replace(str,search,replace) ===&lt;br /&gt;
&lt;br /&gt;
Replaces all occurrences of string &#039;&#039;search&#039;&#039; in string &#039;&#039;str&#039;&#039; with string &#039;&#039;replace&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can also be used with an arbitrary number of arguments. Note that &#039;&#039;$replace(str,search1,replace1,search2,replace2)&#039;&#039; is generally not the same as &#039;&#039;$replace($replace(str,search1,replace1),search2,replace2)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$replace(ab,a,b,b,c)&#039;&#039; → &amp;quot;bc&amp;quot;, &#039;&#039;$replace($replace(ab,a,b),b,c)&#039;&#039; → &amp;quot;cc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== $right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first &#039;&#039;len&#039;&#039; characters from the right of string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $roman(int) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in roman notation.&lt;br /&gt;
&lt;br /&gt;
=== $rot13(str) ===&lt;br /&gt;
&lt;br /&gt;
Performs [http://en.wikipedia.org/wiki/ROT13 ROT13] transformation to given string.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$rot13(&#039;foobar2000&#039;)&#039;&#039; → &amp;quot;sbbone2000&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $shortest(str,...strN) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first shortest element of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $strchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strchr(abca,a)&#039;&#039; → 1&lt;br /&gt;
&lt;br /&gt;
=== $strrchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns positions of last occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strrchr(abca,a)&#039;&#039; → 4&lt;br /&gt;
&lt;br /&gt;
=== $strstr(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of string &#039;&#039;str2&#039;&#039; in string &#039;&#039;str1&#039;&#039;. Function is case-sensitive.&lt;br /&gt;
&lt;br /&gt;
=== $strcmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-sensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stricmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-insensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Removes the specified prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $substr(str,from,to) ===&lt;br /&gt;
&lt;br /&gt;
Returns substring of string &#039;&#039;str&#039;&#039;, starting from &#039;&#039;FROM&#039;&#039;-th character and ending at &#039;&#039;TO&#039;&#039;-th character.&lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Moves &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Moves the specified prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $trim(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes leading and trailing spaces from string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $tab() ===&lt;br /&gt;
&lt;br /&gt;
Inserts one tabulator character.&lt;br /&gt;
&lt;br /&gt;
=== $tab(count) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;count&#039;&#039; tabulator characters.&lt;br /&gt;
&lt;br /&gt;
=== $upper(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to uppercase.&lt;br /&gt;
&lt;br /&gt;
== Track info fields and functions ==&lt;br /&gt;
&lt;br /&gt;
The functions and fields in this section can be used to access information about tracks.&lt;br /&gt;
&lt;br /&gt;
=== Metadata fields and functions ===&lt;br /&gt;
&lt;br /&gt;
Generally, metadata from the files (whether in tags or a cue sheet) is mapped directly to a field which can be referenced case-insensitively. For example, the first tag named &#039;&#039;URL&#039;&#039; can be referenced as &#039;&#039;%url%&#039;&#039;, and the first standard comment tag can be referenced as &#039;&#039;%comment%&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following functions are also available for accessing metadata:&lt;br /&gt;
&lt;br /&gt;
==== $meta(name) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &amp;quot;, &amp;quot; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist)&#039;&#039; → &amp;quot;He, She, They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta(name,n) ====&lt;br /&gt;
Returns value of &#039;&#039;n&#039;&#039;-th (0,1,2 and so on) tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist,1)&#039;&#039; → &amp;quot;She&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039; + &#039;)&#039;&#039; → &amp;quot;He + She + They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep,lastsep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator between all but the last two values which are concatenated with &#039;&#039;lastsep&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039;, &#039;,&#039;, and &#039;)&#039;&#039; → &amp;quot;He, She, and They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_test(...) ====&lt;br /&gt;
Returns &#039;&#039;1&#039;&#039;, if all given tags exist, &#039;&#039;undefined&#039;&#039; otherwise.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_test(artist,title)&#039;&#039; → true&lt;br /&gt;
&lt;br /&gt;
==== $meta_num(name) ====&lt;br /&gt;
Returns the number of values for the tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_num(artist)&#039;&#039; → 3&lt;br /&gt;
&lt;br /&gt;
=== Remapped metadata fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields have special remapped values to make writing title format scripts more convenient:&lt;br /&gt;
&lt;br /&gt;
==== %album artist% ====&lt;br /&gt;
Name of the artist of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album artist&amp;quot;, &amp;quot;artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. The difference between this and &#039;&#039;%artist%&#039;&#039; is that &#039;&#039;%album artist%&#039;&#039; is intended for use where consistent value across entire album is needed even when per-track artists values vary.&lt;br /&gt;
&lt;br /&gt;
==== %album% ====&lt;br /&gt;
Name of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album&amp;quot;, &amp;quot;venue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %artist% ====&lt;br /&gt;
Name of the artist of the track. Checks following metadata fields, in this order: &amp;quot;artist&amp;quot;, &amp;quot;album artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. For a SHOUTcast stream which contains metadata, it is the StreamTitle up to the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %discnumber% ====&lt;br /&gt;
Index of disc specified track belongs to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %totaldiscs% ====&lt;br /&gt;
Index of total discs specified tracks belong to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %track artist% ====&lt;br /&gt;
Name of the artist of the track; present only if &#039;&#039;%album artist%&#039;&#039; is different than &#039;&#039;%artist%&#039;&#039; for specific track. Intended for use together with &#039;&#039;%album artist%&#039;&#039;, to indicate track-specific artist info, e.g. &amp;quot;%album artist% - %title%[ &#039;//&#039; %track artist%]&amp;quot;. In this case, the last part will be displayed only when track-specific artist info is present.&lt;br /&gt;
&lt;br /&gt;
==== %title% ====&lt;br /&gt;
Title of the track. If &amp;quot;title&amp;quot; metadata field is missing, file name is used instead. For a SHOUTcast stream which contains metadata, it is the StreamTitle after the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %tracknumber% ====&lt;br /&gt;
Two-digit index of specified track within the album. Available only when &amp;quot;tracknumber&amp;quot; field is present in track’s metadata. An extra &#039;0&#039; is placed in front of single digit track numbers (5 becomes 05) &amp;amp;ndash; otherwise the tracknumber field is returned unchanged (e.g. the following values remain as they are: 006, 05, 104, A3, two, -1, -).&lt;br /&gt;
&lt;br /&gt;
==== %track number% ====&lt;br /&gt;
Similar to %tracknumber%, however single digit track numbers are not reformatted to have an extra 0.&lt;br /&gt;
&lt;br /&gt;
==== %totaltracks% ====&lt;br /&gt;
Index of total tracks specified tracks belong to, within the album. Available only when &amp;quot;totaltracks&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
=== Technical information fields ===&lt;br /&gt;
&lt;br /&gt;
==== %bitrate% ====&lt;br /&gt;
Bitrate of the track in kilobits per second. VBR files will show a dynamic display for currently played track (outside of the playlist).&lt;br /&gt;
&lt;br /&gt;
==== %channels% ====&lt;br /&gt;
Number of channels in the track, as text; either &amp;quot;mono&amp;quot;, &amp;quot;stereo&amp;quot; for 1 or 2 channels, respectively, otherwise a number followed by &amp;quot;ch&amp;quot;, e.g. &amp;quot;6ch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %channel_mask% ====&lt;br /&gt;
Description of the used audio channels in the track, e.g. &amp;quot;FL FR FC LFE SL SR&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %codec% ====&lt;br /&gt;
Name of codec used to encode the track, e.g. PCM, FLAC, MP3, or AAC. If exact codec name is not available, file extension is used. The Default UI&#039;s standard Codec column displays the same info, but sometimes adds details, e.g. &amp;quot;MP3 / VBR V2&amp;quot; or &amp;quot;AAC / LC&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %filesize% ====&lt;br /&gt;
The exact file size in bytes.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_filesize%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %filesize_natural% ====&lt;br /&gt;
The approximate file size, automatically formatted in appropriate units such as megabytes or kilobytes, e.g. &amp;quot;8.49 MB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %length% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_ex% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, seconds, and milliseconds, rounded to the nearest millisecond.&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds% ====&lt;br /&gt;
The length of the track in seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds_fp% ====&lt;br /&gt;
The length of the track in seconds as a floating point number.&lt;br /&gt;
&lt;br /&gt;
==== %length_samples% ====&lt;br /&gt;
The length of the track in samples.&lt;br /&gt;
&lt;br /&gt;
==== %samplerate% ====&lt;br /&gt;
Sample rate of the track, in Hz.&lt;br /&gt;
&lt;br /&gt;
=== Technical information functions ===&lt;br /&gt;
&lt;br /&gt;
==== $info(name) ====&lt;br /&gt;
Returns value of technical information field called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For convenience, the &#039;&#039;&#039;%__name%&#039;&#039;&#039; alias is also available.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$info(channels)&#039;&#039; → 2&lt;br /&gt;
&lt;br /&gt;
Here is an &#039;&#039;&#039;informative&#039;&#039;&#039; list of recognized fields. Some of these depend on the media file type being queried.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! field name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;General&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|codec&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; MP3)&lt;br /&gt;
|-&lt;br /&gt;
|codec_profile&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec Profile&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; CBR)&lt;br /&gt;
|-&lt;br /&gt;
|samplerate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Sample Rate&#039;&#039;&#039;, in hertz (&#039;&#039;e.g.&#039;&#039; 44100)&lt;br /&gt;
|-&lt;br /&gt;
|bitrate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bitrate&#039;&#039;&#039;, in kilobits per second (&#039;&#039;e.g.&#039;&#039; 320)&lt;br /&gt;
|-&lt;br /&gt;
|tool&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tool&#039;&#039;&#039; used to produce the file, possibly guessed (&#039;&#039;e.g.&#039;&#039; LAME3.97)&lt;br /&gt;
|-&lt;br /&gt;
|encoding&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Encoding&#039;&#039;&#039; lossiness (&#039;&#039;e.g.&#039;&#039; lossy)&lt;br /&gt;
|-&lt;br /&gt;
|channels&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channels&#039;&#039;&#039; count (&#039;&#039;e.g.&#039;&#039; 2 &amp;lt;nowiki&amp;gt;[for stereo]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 16)&lt;br /&gt;
|-&lt;br /&gt;
|tagtype&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tag Type&#039;&#039;&#039;, comma-separated list of tag formats (&#039;&#039;e.g.&#039;&#039; id3v2|apev2)&lt;br /&gt;
|-&lt;br /&gt;
|cue_embedded&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Embedded Cuesheet&#039;&#039;&#039; presence (&#039;&#039;e.g.&#039;&#039; no &amp;lt;nowiki&amp;gt;[may be empty!]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|md5&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Audio MD5&#039;&#039;&#039; hash, if container defines it (&#039;&#039;e.g.&#039;&#039; 1E24A910D91EF09A8CF403C9B6963961)&lt;br /&gt;
|-&lt;br /&gt;
|WAVEFORMATEXTENSIBLE_CHANNEL_MASK&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel mask&#039;&#039;&#039;, channel layout of the track coded as hex (&#039;&#039;e.g.&#039;&#039; 0x0003 for regular stereo)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ENC_DELAY&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_delay&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 576)&lt;br /&gt;
|-&lt;br /&gt;
|ENC_PADDING&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_padding&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 1536)&lt;br /&gt;
|-&lt;br /&gt;
|MP3_ACCURATE_LENGTH&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|MP3 duration (%length% etc.) takes into account LAME or iTunes gapless playback info (&#039;&#039;e.g.&#039;&#039; yes)*&lt;br /&gt;
|-&lt;br /&gt;
|MP3_STEREO_MODE&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|Stereo mode used in MP3 file (&#039;&#039;e.g.&#039;&#039; mono, stereo, joint stereo, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|VERSION&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Version&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 3.99)&lt;br /&gt;
|-&lt;br /&gt;
|FLAGS&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Flags&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 22)&lt;br /&gt;
|-&lt;br /&gt;
|channel_mode&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel Mode&#039;&#039;&#039;, description of channels (note: this field was only used by obsolete foo_ac3. &#039;&#039;e.g.&#039;&#039; 3 front, 2 rear surround channels + LFE)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 90%&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; &#039;&#039;MP3_ACCURATE_LENGTH won&#039;t exist if gapless playback info isn&#039;t present or the file is not an MP3. The info can be in a LAME tag in the VBR header, or in an iTunSMPB ID3v2 comment tag. Gapless playback info is taken into account in .m4a files, but there&#039;s no special field to say so.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== $channels() ====&lt;br /&gt;
The number of channels in text format.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$channels()&#039;&#039; → &amp;quot;stereo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_gain% ====&lt;br /&gt;
The ReplayGain album gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak% ====&lt;br /&gt;
The ReplayGain album peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak_db% ====&lt;br /&gt;
The ReplayGain album peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_gain% ====&lt;br /&gt;
The ReplayGain track gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak% ====&lt;br /&gt;
The ReplayGain track peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak_db% ====&lt;br /&gt;
The ReplayGain track peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
=== Special fields ===&lt;br /&gt;
&lt;br /&gt;
==== %filename% ====&lt;br /&gt;
The filename without directory and extension.&lt;br /&gt;
&lt;br /&gt;
==== %filename_ext% ====&lt;br /&gt;
The filename with extension, but without the directory.&lt;br /&gt;
&lt;br /&gt;
==== %directoryname% ====&lt;br /&gt;
The name of the parent directory only, not the complete path.&lt;br /&gt;
&lt;br /&gt;
==== %last_modified% ====&lt;br /&gt;
The date and time the file was last modified. Eg: &#039;&#039;2005-12-22 00:04:10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== %path% ====&lt;br /&gt;
The complete path, including the filename and extension.&lt;br /&gt;
&lt;br /&gt;
==== %_path_raw% ====&lt;br /&gt;
The path as URL including the protocol scheme.&lt;br /&gt;
&lt;br /&gt;
==== %subsong% ====&lt;br /&gt;
The subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.&lt;br /&gt;
&lt;br /&gt;
==== %_foobar2000_version% ====&lt;br /&gt;
A string representing the version of foobar2000.&lt;br /&gt;
&lt;br /&gt;
== Time and date functions ==&lt;br /&gt;
&lt;br /&gt;
These functions are used to manipulate time/date strings, notably (but not limited to), [[Foobar2000:Titleformat_Playback_Statistics|those gathered]] by the [[Foobar2000:Components/Playback Statistics v3.x (foo playcount)|Playback Statistics component]].&lt;br /&gt;
&lt;br /&gt;
=== $year(time) ===&lt;br /&gt;
Retrieves the year part (formatted as four digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $month(time) ===&lt;br /&gt;
Retrieves the month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $day_of_month(time) ===&lt;br /&gt;
Retrieves the day of month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $date(time) ===&lt;br /&gt;
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $time(time) ===&lt;br /&gt;
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string.&lt;br /&gt;
&lt;br /&gt;
== Variable operations ==&lt;br /&gt;
&lt;br /&gt;
Variables can be used to store strings and numbers. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! code&lt;br /&gt;
! output&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre&amp;gt;$put(foo,bar)$char(10)&lt;br /&gt;
$get(foo)$char(10)&lt;br /&gt;
$get(Foo)$char(10)&lt;br /&gt;
$puts(foo,2000)$char(10)&lt;br /&gt;
$get(foo)$char(10)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot; |&amp;lt;pre&amp;gt;bar&lt;br /&gt;
bar&lt;br /&gt;
bar&lt;br /&gt;
&lt;br /&gt;
2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== $get(name) ===&lt;br /&gt;
Returns the value that was last stored in the variable &#039;&#039;name&#039;&#039;, if the variable was not defined (yet), it returns nothing. The truth value returned by &#039;&#039;$get&#039;&#039; indicates if the variable &#039;&#039;name&#039;&#039; was defined and is a non-empty string.&lt;br /&gt;
&lt;br /&gt;
=== $put(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns &#039;&#039;value&#039;&#039; unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $puts(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns nothing.&lt;br /&gt;
&lt;br /&gt;
== Component-specific fields and functions ==&lt;br /&gt;
&lt;br /&gt;
This section lists fields and functions which are specific to certain components. Unless otherwise stated, the fields and functions are only usable in the context of those components.&lt;br /&gt;
&lt;br /&gt;
=== Now playing info ===&lt;br /&gt;
&lt;br /&gt;
The following fields related to the currently playing item are only usable in certain locations outside of the playlist, e.g. in the status bar, the main window title and the copy command script.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time% ====&lt;br /&gt;
The elapsed time formatted as [HH:]MM:SS.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_seconds% ====&lt;br /&gt;
The elapsed time in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_elapsed%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining% ====&lt;br /&gt;
The time remaining until the track ends, formatted as [HH:]MM:SS.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining_seconds% ====&lt;br /&gt;
The time remaining until the track ends, in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Playlist-only fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields are only usable in playlist display formatting (i.e., the column title formatting patterns).&lt;br /&gt;
&lt;br /&gt;
==== %isplaying% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if file is currently playing, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %ispaused% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if playback is paused, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %list_index% ====&lt;br /&gt;
A zero-padded playlist index of specified item. The first item is at index 1.&lt;br /&gt;
&lt;br /&gt;
==== %list_total% ====&lt;br /&gt;
The number of items in the playlist.&lt;br /&gt;
&lt;br /&gt;
==== %queue_index% ====&lt;br /&gt;
Index of the specified item in the playback queue. If the item has been queued multiple times, %queue_index% evaluates to the first index.&lt;br /&gt;
&lt;br /&gt;
==== %queue_indexes% ====&lt;br /&gt;
List of indexes of the specified item in the playback queue. Same as %queue_index% unless the item has been queued more than once.&lt;br /&gt;
&lt;br /&gt;
==== %queue_total% ====&lt;br /&gt;
Total amount of tracks in playback queue. Available only for queued tracks, for technical reasons. &lt;br /&gt;
&lt;br /&gt;
=== Playlist text color ===&lt;br /&gt;
&lt;br /&gt;
==== Dimmed and highlighted text ====&lt;br /&gt;
&lt;br /&gt;
In the Default UI playlist, text color can be adjusted by enclosing it in angle-brackets. The only options are to make the text dimmer (mixing the default color with the background color) or brighter (mixing the default color with the highlight color):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;text&amp;gt;&#039;&#039; – dim &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&#039;&#039; – dimmer &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&amp;gt;&#039;&#039; – dimmest &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;text&amp;amp;lt;&#039;&#039; – bright &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brighter &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brightest &#039;&#039;text&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Historical and Columns UI color functions ====&lt;br /&gt;
&lt;br /&gt;
Prior to version 1.0, the default UI playlist supported the following color functions, which are still available in the Columns UI playlist:&lt;br /&gt;
&lt;br /&gt;
===== $blend(color1,color2,part,total) =====&lt;br /&gt;
Returns a color that is a blend between &#039;&#039;color1&#039;&#039; and &#039;&#039;color2&#039;&#039;. If &#039;&#039;part&#039;&#039; is smaller than or equal to zero, &#039;&#039;color1&#039;&#039; is returned. If &#039;&#039;part&#039;&#039; is greater than or equal to &#039;&#039;total&#039;&#039;, &#039;&#039;color2&#039;&#039; is returned. Otherwise a blended color is returned that is &#039;&#039;part&#039;&#039; parts &#039;&#039;color1&#039;&#039; and &#039;&#039;total&#039;&#039;-&#039;&#039;part&#039;&#039; parts &#039;&#039;color2&#039;&#039;. The blending is performed in the RGB color space.&lt;br /&gt;
&lt;br /&gt;
===== $hsl() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h,s,l) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039; and &#039;&#039;l&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
The ranges of &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039;, and &#039;&#039;l&#039;&#039; are from 0 to 240; the function is designed to interpret those values in the same way as the standard Windows color dialog.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h1,s1,l1,h2,s2,l2) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h1&#039;&#039;, &#039;&#039;s1&#039;&#039; and &#039;&#039;l1&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. &#039;&#039;h2&#039;&#039;, &#039;&#039;s2&#039;&#039; and &#039;&#039;l2&#039;&#039; are the hue, saturation, and lightness of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $rgb() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r,g,b) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r&#039;&#039;, &#039;&#039;g&#039;&#039; and &#039;&#039;b&#039;&#039; are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r1,g1,b1,r2,g2,b2) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r1&#039;&#039;, &#039;&#039;g1&#039;&#039; and &#039;&#039;b1&#039;&#039; are the red, green and blue component of the color for unselected text. &#039;&#039;r2&#039;&#039;, &#039;&#039;g2&#039;&#039; and &#039;&#039;b2&#039;&#039; are the red, green and blue component of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $transition(string,color1,color2) =====&lt;br /&gt;
Inserts color codes into &#039;&#039;string&#039;&#039;, so that the first character has &#039;&#039;color1&#039;&#039;, the last character has &#039;&#039;color2&#039;&#039;, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying &#039;&#039;$transition&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Album List ===&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Titleformat_Album_List|Album List Title Formatting]]&lt;br /&gt;
* [[Foobar2000:Preferences:Album List|Preferences: Album List]]&lt;br /&gt;
&lt;br /&gt;
=== Playback Statistics ===&lt;br /&gt;
&lt;br /&gt;
The foo_playcount component adds a number of fields for playback statistics and ratings. The fields can be used anywhere track info can be displayed. See the documentation for details:&lt;br /&gt;
* [http://www.foobar2000.org/components/view/foo_playcount Playback statistics homepage]&lt;br /&gt;
* [[Foobar2000:Titleformat Playback Statistics|Playback statistics titleformat reference]]&lt;br /&gt;
&lt;br /&gt;
=== Playlist Organizer ===&lt;br /&gt;
&lt;br /&gt;
This component adds a number of fields to control the display of a list of playlists. See the documentation for details:&lt;br /&gt;
* [[Foobar2000:Components/Playlist Organizer (foo_plorg)#Nodes|Playlist Organizer: Nodes Title Formatting]]&lt;br /&gt;
&lt;br /&gt;
=== Columns UI ===&lt;br /&gt;
&lt;br /&gt;
This component replaces the Default UI framework, including the playlist. See the documentation for details:&lt;br /&gt;
* [http://yuo.be/columns.php Columns UI homepage]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:global_variables Global variables reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:colour_string Playlist colors reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:playlist_switcher_titleformatting Playlist switcher reference]&lt;br /&gt;
&lt;br /&gt;
== Additional Reading ==&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Title Formatting Introduction|Introduction to titleformat scripts]]&lt;br /&gt;
* The file &#039;&#039;&#039;titleformat_help.html&#039;&#039;&#039; in your Foobar2000 directory, e.g. file:///C:/Program%20Files%20(x86)/foobar2000/titleformat_help.html&lt;br /&gt;
&lt;br /&gt;
[[Category:foobar2000 Guides|Titleformat Reference]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38279</id>
		<title>Foobar2000:Title Formatting Reference</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Title_Formatting_Reference&amp;diff=38279"/>
		<updated>2024-10-27T07:18:21Z</updated>

		<summary type="html">&lt;p&gt;Case: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{sidebar foobar2000 title formatting}}&lt;br /&gt;
This article contains information about built-in title formatting functions and field references, plus additional documentation about fields and functions which can only be used in specific components or which are provided by specific components.&lt;br /&gt;
&lt;br /&gt;
Please see [[Foobar2000:Title Formatting Introduction|Title Formatting Introduction]] for a general overview of title format syntax and its basic rules. The article [[foobar2000:Titleformat Examples|Titleformat Examples]] offers user-submitted examples of code for specific purposes; feel free to add your own if you think it can be of use to others.&lt;br /&gt;
&lt;br /&gt;
For details of the query syntax, which uses some of these fields to find files for playlists, etc., see the [[Foobar2000:Query_syntax|Query Syntax]] article.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&lt;br /&gt;
A title formatting script consists of any combination of literal text, field references, function calls, comments, and line break characters. The script always outputs a text string (which can be empty).&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;comment&#039;&#039;&#039; is a line starting with two slashes, e.g. {{code|// this is a comment}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;field reference&#039;&#039;&#039; is a field name enclosed in percent signs, for example {{code|%artist%}}.&lt;br /&gt;
&lt;br /&gt;
A &#039;&#039;&#039;function call&#039;&#039;&#039; starts with a dollar sign, followed by the function name and the parameter list. A parameter list can either be empty – denoted as {{code|()}} – or contain one or more parameters separated by commas, for example {{code|$abbr(%artist%)}}. A parameter can be literal text, a field reference, or another function call. Note that there must be no whitespace between the dollar sign and the function name, or the function name and the opening parenthesis of the parameter list.&lt;br /&gt;
&lt;br /&gt;
Any other text is &#039;&#039;&#039;literal text&#039;&#039;&#039;. In literal text, the character {{code|%}}, {{code|$}}, {{code|[}}, {{code|]}}, or {{code|&#039;}} (apostrophe/single quote) must be escaped by enclosing it in {{code|&#039;}} (apostrophe/single quote) characters. For example, {{code|&#039;[&#039;}} (a left bracket in single quotes) results in a literal {{code|[}} (left bracket). As a special case, {{code|&amp;lt;nowiki&amp;gt;&#039;&#039;&amp;lt;/nowiki&amp;gt;}} (two single quotes in a row) results in one single quote. In the playlist, {{code|&amp;amp;lt;}} and {{code|&amp;amp;gt;}} are also special; see [[#Dimmed and highlighted text|Dimmed and highlighted text]].&lt;br /&gt;
&lt;br /&gt;
When the script is evaluated, the output string is assembled by evaluating the function parameters, function calls, and field references. Comments and line break characters (CR and LF/newline) are ignored; to output a line break, use {{code|$crlf()}}. Each field reference becomes the field&#039;s value, as a string. Each function becomes a string or number, and/or a truth value (not output) which can be used by another function.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: The interface for entering custom columns and grouping schemes for the Default UI playlist does not support line breaks; scripts must be written all on one line, without comments.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Arithmetic functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to perform arithmetic on integer numbers. A string will be automatically converted to a number and vice versa. The conversion to a number uses the longest prefix of the string that can be interpreted as number. Leading whitespace is ignored. Decimal points are not supported. Examples:&lt;br /&gt;
* &#039;&#039;c3po&#039;&#039; → 0&lt;br /&gt;
* &#039;&#039;4.8&#039;&#039; → 4&lt;br /&gt;
* &#039;&#039;-12&#039;&#039; → -12&lt;br /&gt;
* &#039;&#039;- 12&#039;&#039; → 0&lt;br /&gt;
&lt;br /&gt;
=== $add(a,b, ...) ===&lt;br /&gt;
&lt;br /&gt;
Adds &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$add(a,b,...)&#039;&#039; is the same as &#039;&#039;$add($add(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $div(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Divides &#039;&#039;a&#039;&#039; by &#039;&#039;b&#039;&#039; and rounds down to an integer. If &#039;&#039;b&#039;&#039; evaluates to zero, it returns &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$div(a,b,...)&#039;&#039; is the same as &#039;&#039;$div($div(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $greater(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns true, if &#039;&#039;a&#039;&#039; is greater than &#039;&#039;b&#039;&#039;, otherwise false.&lt;br /&gt;
&lt;br /&gt;
=== $max(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the maximum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$max(a,b,...)&#039;&#039; is the same as &#039;&#039;$max($max(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $min(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Returns the minimum of &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$min(a,b,...)&#039;&#039; is the same as &#039;&#039;$min($min(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mod(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Computes the remainder of dividing &#039;&#039;a&#039;&#039; through &#039;&#039;b&#039;&#039;. The result has the same sign as &#039;&#039;a&#039;&#039;. If &#039;&#039;b&#039;&#039; evaluates to zero, the result is &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mod(a,b,...)&#039;&#039; is the same as &#039;&#039;$mod($mod(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $mul(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$mul(a,b,...)&#039;&#039; is the same as &#039;&#039;$mul($mul(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $muldiv(a,b,c) ===&lt;br /&gt;
&lt;br /&gt;
Multiplies &#039;&#039;a&#039;&#039; and &#039;&#039;b&#039;&#039;, then divides by &#039;&#039;c&#039;&#039;. The result is rounded to the nearest integer.&lt;br /&gt;
&lt;br /&gt;
=== $rand() ===&lt;br /&gt;
&lt;br /&gt;
Generates a random number in the range from 0 to 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;-1. Available only in sort-related contexts, such as the &#039;&#039;Edit → Sort → Sort by ...&#039;&#039; menu command.&lt;br /&gt;
&lt;br /&gt;
=== $sub(a,b) ===&lt;br /&gt;
&lt;br /&gt;
Subtracts &#039;&#039;b&#039;&#039; from &#039;&#039;a&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can be used with an arbitrary number of arguments. &#039;&#039;$sub(a,b,...)&#039;&#039; is the same as &#039;&#039;$sub($sub(a,b),...)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Boolean functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to work with truth values (&#039;&#039;true&#039;&#039; and &#039;&#039;false&#039;&#039;), which have no explicit representation in titleformat scripts. They do not return a string or number value. You can use them for more complex conditions with &#039;&#039;$if&#039;&#039; and related functions.&lt;br /&gt;
&lt;br /&gt;
Foobar does not have a concept of TRUE and FALSE in a programming language sense where 0 or empty string are considered FALSE and other values TRUE. Therefore there is no difference between numeric 0 and string representation &#039;0&#039; which both are considered as values, and being attached a boolean value FALSE. Apostrophes are only required to escape certain syntax characters. Values are treated as numbers during arithmetic operations like&#039;&#039; $add()&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $and(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical And of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if and only if all &#039;&#039;expr&#039;&#039; arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $or(expr, ...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if at least one expression evaluates to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $not(expr) ===&lt;br /&gt;
&lt;br /&gt;
Logical Not. Returns the logical opposite of EXPR: &#039;&#039;false&#039;&#039;, if &#039;&#039;expr&#039;&#039; is &#039;&#039;true&#039;&#039; and &#039;&#039;true&#039;&#039; if &#039;&#039;expr&#039;&#039; is false.&lt;br /&gt;
&lt;br /&gt;
=== $xor(expr,...) ===&lt;br /&gt;
&lt;br /&gt;
Logical Exclusive-or of an arbitrary number of arguments. Returns &#039;&#039;true&#039;&#039;, if an odd number of arguments evaluate to &#039;&#039;true&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Special case: &#039;&#039;$xor(expr1,expr2)&#039;&#039; returns &#039;&#039;true&#039;&#039;, if EXPR1 or EXPR2 is &#039;&#039;true&#039;&#039;. If both expressions are true, returns &#039;&#039;false&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Control flow functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to conditionally execute statements.&lt;br /&gt;
&lt;br /&gt;
=== [...] (conditional section) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates the expression between &#039;&#039;[&#039;&#039; and &#039;&#039;]&#039;&#039;. If it has the truth value &#039;&#039;true&#039;&#039;, its string value and the truth value &#039;&#039;true&#039;&#039; are returned. Otherwise an empty string and &#039;&#039;false&#039;&#039; are returned.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;[%artist%]&#039;&#039; returns the value of the artist tag, if it exists. Otherwise it returns nothing, when &#039;&#039;artist&#039;&#039; would return &amp;quot;?&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
Plain strings are FALSE. Field lookups and functions can introduce a boolean value of TRUE. &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;Examples&amp;lt;/u&amp;gt;:&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;u&amp;gt;1&amp;lt;/u&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #False: &lt;br /&gt;
 $if(0,True,False)&lt;br /&gt;
 # False: &lt;br /&gt;
 $if(&#039;0&#039;,True,False)&lt;br /&gt;
 # True or False: &lt;br /&gt;
 [$add(%rating%,1)]&lt;br /&gt;
&amp;lt;/code&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
The last one would display the value of %rating% plus one, if and only if %rating% is set for the track.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt;2&amp;lt;/u&amp;gt;&lt;br /&gt;
Ignore inserting the %album artist%, if it contains the word &amp;quot;various&amp;quot;. &lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 # Wrong: &lt;br /&gt;
 $if([%album artist%=Various],,%artist%-)&lt;br /&gt;
 # Good approach:&lt;br /&gt;
 $if($stricmp(%album artist%,Various),,%artist%-) &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== $if(cond,then,else) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;cond&#039;&#039; evaluates to &#039;&#039;true&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise, the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $if2(expr,else) ===&lt;br /&gt;
&lt;br /&gt;
Like &#039;&#039;$if(expr,expr,else)&#039;&#039; except that &#039;&#039;expr&#039;&#039; is only evaluated once. In other words, if expression &#039;&#039;expr&#039;&#039; is true, &#039;&#039;expr&#039;&#039; is returned, otherwise the &#039;&#039;else&#039;&#039; part is evaluated and &#039;&#039;expr&#039;&#039; is returned as true.&lt;br /&gt;
&lt;br /&gt;
=== $if3(a1,a2,...,aN,else) ===&lt;br /&gt;
&lt;br /&gt;
Evaluates arguments &#039;&#039;a1&#039;&#039; ... &#039;&#039;aN&#039;&#039;, until one is found that evaluates to &#039;&#039;true&#039;&#039;. If that happens, its value is returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifequal(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is equal to &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $ifgreater(int1,int2,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the integer numbers &#039;&#039;int1&#039;&#039; and &#039;&#039;int2&#039;&#039;, if &#039;&#039;int1&#039;&#039; is greater than &#039;&#039;int2&#039;&#039;, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $iflonger(str,n,then,else) ===&lt;br /&gt;
&lt;br /&gt;
Compares the length of the string &#039;&#039;str&#039;&#039; to the number &#039;&#039;n&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;n&#039;&#039; characters, the &#039;&#039;then&#039;&#039; part is evaluated and its value returned. Otherwise the &#039;&#039;else&#039;&#039; part is evaluated and its value returned.&lt;br /&gt;
&lt;br /&gt;
=== $select(n,a1,...,aN) ===&lt;br /&gt;
&lt;br /&gt;
If the value of &#039;&#039;n&#039;&#039; is between 1 and N, &#039;&#039;an&#039;&#039; is evaluated and its value returned. Otherwise &#039;&#039;false&#039;&#039; is returned.&lt;br /&gt;
&lt;br /&gt;
== String functions ==&lt;br /&gt;
&lt;br /&gt;
The functions in this section can be used to manipulate character strings.&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of string &#039;&#039;str&#039;&#039;. Words which begin with an alphanumeric character are shortened to the first character. Spaces and parentheses are stripped. Example:&lt;br /&gt;
* $abbr(&#039;This is a Long Title (12-inch version) [needs tags]&#039;) → TiaLT1v[needst&lt;br /&gt;
&lt;br /&gt;
=== $abbr(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns abbreviation of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters, otherwise returns &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $ansi(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to system codepage and back. Any characters that are not present in the system codepage will be removed / replaced. Useful for mass-renaming files to ensure compatibility with non-unicode-capable software.&lt;br /&gt;
&lt;br /&gt;
=== $ascii(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to ASCII. Any characters that are not present in ASCII will be removed / replaced.&lt;br /&gt;
&lt;br /&gt;
=== $caps(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and all other letters to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $caps2(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts first letter in every word of string &#039;&#039;str&#039;&#039; to uppercase, and leaves all other letters as they are.&lt;br /&gt;
&lt;br /&gt;
=== $char(nbr) ===&lt;br /&gt;
&lt;br /&gt;
Returns Unicode character of &#039;&#039;nbr&#039;&#039;. You can search for characters and find the matching decimal number on this [http://www.fileformat.info/info/unicode/char/search.htm site].&lt;br /&gt;
&lt;br /&gt;
=== $crc32(str) ===&lt;br /&gt;
&lt;br /&gt;
Computes the CRC32 of the string &#039;&#039;str&#039;&#039; as a number. Intended for use in coloring scripts.&lt;br /&gt;
&lt;br /&gt;
Example: $rgb($mod($crc32(%album%),256),128,128)&lt;br /&gt;
&lt;br /&gt;
=== $crlf() ===&lt;br /&gt;
&lt;br /&gt;
Inserts end-of-line marker (carriage return, line feed). Can be used to generate multiple lines in the output, for example for the tooltip of the system  notification area (&amp;quot;systray&amp;quot;) icon.&lt;br /&gt;
&lt;br /&gt;
=== $cut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $left(a,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$cut(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $directory(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts only the directory name (not full path, ie given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;jazz&#039;) from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $directory(path,n) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory name from the file &#039;&#039;path&#039;&#039;; goes up by &#039;&#039;n&#039;&#039; levels.&lt;br /&gt;
&lt;br /&gt;
=== $directory_path(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts directory path from the file &#039;&#039;path&#039;&#039;.&lt;br /&gt;
ie. given path as &#039;D:\music\jazz\filename.mp3&#039;, this will output &#039;D:\music\jazz&#039;&lt;br /&gt;
&lt;br /&gt;
=== $ext(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file extension from string &#039;&#039;path&#039;&#039;; a file name or full path.&lt;br /&gt;
&lt;br /&gt;
=== $filename(path) ===&lt;br /&gt;
&lt;br /&gt;
Extracts file name from full &#039;&#039;path&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &amp;quot; (...)&amp;quot;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $fix_eol(str,indicator) ===&lt;br /&gt;
&lt;br /&gt;
If &#039;&#039;str&#039;&#039; contains an end-of-line marker (CR-LF), the end-of-line marker and all text to the right of it is replaced by &#039;&#039;indicator&#039;&#039;. Otherwise &#039;&#039;str&#039;&#039; is returned unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $hex(int,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in hexadecimal notation with &#039;&#039;len&#039;&#039; digits. Pads with zeros from the left if necessary.&lt;br /&gt;
&lt;br /&gt;
=== $insert(str,insert,n) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;insert&#039;&#039; into &#039;&#039;str&#039;&#039; after &#039;&#039;n&#039;&#039; characters.&lt;br /&gt;
&lt;br /&gt;
=== $left(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of the string &#039;&#039;str&#039;&#039;. This function is the same as $cut(str,len). Negative numbers produce the entire string. Examples:&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,3)&#039;&#039; → abc&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,0)&#039;&#039; → (nothing)&lt;br /&gt;
* &#039;&#039;$left(&#039;abc123&#039;,-1)&#039;&#039; → abc123&lt;br /&gt;
&lt;br /&gt;
=== $len(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters.&lt;br /&gt;
&lt;br /&gt;
=== $len2(str) ===&lt;br /&gt;
&lt;br /&gt;
Returns length of string &#039;&#039;str&#039;&#039; in characters, respecting double-width character rules (double-width characters will be counted as two).&lt;br /&gt;
&lt;br /&gt;
=== $longer(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;true&#039;&#039;, if string &#039;&#039;str1&#039;&#039; is longer than string &#039;&#039;str2&#039;&#039;, false otherwise.&lt;br /&gt;
&lt;br /&gt;
=== $lower(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to lowercase.&lt;br /&gt;
&lt;br /&gt;
=== $longest(arg,...) ===&lt;br /&gt;
&lt;br /&gt;
Returns the longest of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $num(nbr,len) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;nbr&#039;&#039; in decimal notation with &#039;&#039;len&#039;&#039; characters. Pads with zeros from the left if necessary. &#039;&#039;len&#039;&#039; includes the dash when the number is negative. If &#039;&#039;nbr&#039;&#039; is not numeric, it is treated as zero. Examples:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;$num(123,5)&#039;&#039; → 00123&lt;br /&gt;
* &#039;&#039;$num(-123,5)&#039;&#039; → -0123&lt;br /&gt;
* &#039;&#039;$num(4.8,5)&#039;&#039; → 00004&lt;br /&gt;
* &#039;&#039;$num(A1,5)&#039;&#039; → 00000&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a left-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $pad_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Creates a right-aligned version of the string &#039;&#039;str&#039;&#039;. If &#039;&#039;str&#039;&#039; is shorter than &#039;&#039;len&#039;&#039; characters, the function adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long. Otherwise the function returns &#039;&#039;str&#039;&#039; unchanged.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the right of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds spaces to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $padcut_right(str,len,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns first &#039;&#039;len&#039;&#039; characters from the left of &#039;&#039;str&#039;&#039;, if &#039;&#039;str&#039;&#039; is longer than &#039;&#039;len&#039;&#039; characters. Otherwise adds &#039;&#039;char&#039;&#039; to the left of &#039;&#039;str&#039;&#039; to make the result &#039;&#039;len&#039;&#039; characters long.&lt;br /&gt;
&lt;br /&gt;
=== $progress(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with.&lt;br /&gt;
&lt;br /&gt;
Example:&#039;&#039;$progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,&#039;#&#039;,&#039;=&#039;)&#039;&#039; produces &amp;quot;====#===============&amp;quot;, the # character is moving with playback position.&lt;br /&gt;
&lt;br /&gt;
=== $progress2(pos,range,len,char1,char2) ===&lt;br /&gt;
&lt;br /&gt;
Creates a progress bar: &#039;&#039;pos&#039;&#039; contains position, &#039;&#039;range&#039;&#039; contains range, &#039;&#039;len&#039;&#039; progress bar length in characters, &#039;&#039;char1&#039;&#039; and &#039;&#039;char2&#039;&#039; are characters to build progress bar with. Produces different appearance than &#039;&#039;$progress&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $repeat(expr,count) ===&lt;br /&gt;
&lt;br /&gt;
Returns &#039;&#039;count&#039;&#039; copies of &#039;&#039;expr&#039;&#039;. Note that &#039;&#039;expr&#039;&#039; is evaluated once before its value is used, so &#039;&#039;$repeat&#039;&#039; cannot be used for loops.&lt;br /&gt;
&lt;br /&gt;
=== $replace(str,search,replace) ===&lt;br /&gt;
&lt;br /&gt;
Replaces all occurrences of string &#039;&#039;search&#039;&#039; in string &#039;&#039;str&#039;&#039; with string &#039;&#039;replace&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Can also be used with an arbitrary number of arguments. Note that &#039;&#039;$replace(str,search1,replace1,search2,replace2)&#039;&#039; is generally not the same as &#039;&#039;$replace($replace(str,search1,replace1),search2,replace2)&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$replace(ab,a,b,b,c)&#039;&#039; → &amp;quot;bc&amp;quot;, &#039;&#039;$replace($replace(ab,a,b),b,c)&#039;&#039; → &amp;quot;cc&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== $right(str,len) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first &#039;&#039;len&#039;&#039; characters from the right of string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $roman(int) ===&lt;br /&gt;
&lt;br /&gt;
Formats the integer number &#039;&#039;int&#039;&#039; in roman notation.&lt;br /&gt;
&lt;br /&gt;
=== $rot13(str) ===&lt;br /&gt;
&lt;br /&gt;
Performs [http://en.wikipedia.org/wiki/ROT13 ROT13] transformation to given string.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$rot13(&#039;foobar2000&#039;)&#039;&#039; → &amp;quot;sbbone2000&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=== $shortest(str,...strN) ===&lt;br /&gt;
&lt;br /&gt;
Returns the first shortest element of its arguments. Can be used with an arbitrary number of strings.&lt;br /&gt;
&lt;br /&gt;
=== $strchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strchr(abca,a)&#039;&#039; → 1&lt;br /&gt;
&lt;br /&gt;
=== $strrchr(str,char) ===&lt;br /&gt;
&lt;br /&gt;
Returns positions of last occurrence of character &#039;&#039;char&#039;&#039; in string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$strrchr(abca,a)&#039;&#039; → 4&lt;br /&gt;
&lt;br /&gt;
=== $strstr(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Returns position of first occurrence of string &#039;&#039;str2&#039;&#039; in string &#039;&#039;str1&#039;&#039;. Function is case-sensitive.&lt;br /&gt;
&lt;br /&gt;
=== $strcmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-sensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stricmp(str1,str2) ===&lt;br /&gt;
&lt;br /&gt;
Performs a case-insensitive comparison of the strings &#039;&#039;str1&#039;&#039; and &#039;&#039;str2&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $stripprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Removes the specified prefixes from string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $substr(str,from,to) ===&lt;br /&gt;
&lt;br /&gt;
Returns substring of string &#039;&#039;str&#039;&#039;, starting from &#039;&#039;FROM&#039;&#039;-th character and ending at &#039;&#039;TO&#039;&#039;-th character.&lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str) ===&lt;br /&gt;
&lt;br /&gt;
Moves &#039;&#039;A&#039;&#039; and &#039;&#039;The&#039;&#039; prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $swapprefix(str,prefix1,prefix2,...) ===&lt;br /&gt;
&lt;br /&gt;
Moves the specified prefixes to the end of string &#039;&#039;str&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
=== $trim(str) ===&lt;br /&gt;
&lt;br /&gt;
Removes leading and trailing spaces from string &#039;&#039;str&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== $tab() ===&lt;br /&gt;
&lt;br /&gt;
Inserts one tabulator character.&lt;br /&gt;
&lt;br /&gt;
=== $tab(count) ===&lt;br /&gt;
&lt;br /&gt;
Inserts &#039;&#039;count&#039;&#039; tabulator characters.&lt;br /&gt;
&lt;br /&gt;
=== $upper(str) ===&lt;br /&gt;
&lt;br /&gt;
Converts string &#039;&#039;str&#039;&#039; to uppercase.&lt;br /&gt;
&lt;br /&gt;
== Track info fields and functions ==&lt;br /&gt;
&lt;br /&gt;
The functions and fields in this section can be used to access information about tracks.&lt;br /&gt;
&lt;br /&gt;
=== Metadata fields and functions ===&lt;br /&gt;
&lt;br /&gt;
Generally, metadata from the files (whether in tags or a cue sheet) is mapped directly to a field which can be referenced case-insensitively. For example, the first tag named &#039;&#039;URL&#039;&#039; can be referenced as &#039;&#039;%url%&#039;&#039;, and the first standard comment tag can be referenced as &#039;&#039;%comment%&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The following functions are also available for accessing metadata:&lt;br /&gt;
&lt;br /&gt;
==== $meta(name) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &amp;quot;, &amp;quot; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist)&#039;&#039; → &amp;quot;He, She, They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta(name,n) ====&lt;br /&gt;
Returns value of &#039;&#039;n&#039;&#039;-th (0,1,2 and so on) tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta(artist,1)&#039;&#039; → &amp;quot;She&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039; + &#039;)&#039;&#039; → &amp;quot;He + She + They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_sep(name,sep,lastsep) ====&lt;br /&gt;
Returns value of tag called &#039;&#039;name&#039;&#039;. If multiple values of that tag exist, they are concatenated with &#039;&#039;sep&#039;&#039; as separator between all but the last two values which are concatenated with &#039;&#039;lastsep&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_sep(artist,&#039;, &#039;,&#039;, and &#039;)&#039;&#039; → &amp;quot;He, She, and They&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== $meta_test(...) ====&lt;br /&gt;
Returns &#039;&#039;1&#039;&#039;, if all given tags exist, &#039;&#039;undefined&#039;&#039; otherwise.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_test(artist,title)&#039;&#039; → true&lt;br /&gt;
&lt;br /&gt;
==== $meta_num(name) ====&lt;br /&gt;
Returns the number of values for the tag called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$meta_num(artist)&#039;&#039; → 3&lt;br /&gt;
&lt;br /&gt;
=== Remapped metadata fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields have special remapped values to make writing title format scripts more convenient:&lt;br /&gt;
&lt;br /&gt;
==== %album artist% ====&lt;br /&gt;
Name of the artist of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album artist&amp;quot;, &amp;quot;artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. The difference between this and &#039;&#039;%artist%&#039;&#039; is that &#039;&#039;%album artist%&#039;&#039; is intended for use where consistent value across entire album is needed even when per-track artists values vary.&lt;br /&gt;
&lt;br /&gt;
==== %album% ====&lt;br /&gt;
Name of the album specified track belongs to. Checks following metadata fields, in this order: &amp;quot;album&amp;quot;, &amp;quot;venue&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %artist% ====&lt;br /&gt;
Name of the artist of the track. Checks following metadata fields, in this order: &amp;quot;artist&amp;quot;, &amp;quot;album artist&amp;quot;, &amp;quot;composer&amp;quot;, &amp;quot;performer&amp;quot;. For a SHOUTcast stream which contains metadata, it is the StreamTitle up to the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %discnumber% ====&lt;br /&gt;
Index of disc specified track belongs to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %totaldiscs% ====&lt;br /&gt;
Index of total discs specified tracks belong to, within the album. Available only when &amp;quot;discnumber&amp;quot;/&amp;quot;disc&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
==== %track artist% ====&lt;br /&gt;
Name of the artist of the track; present only if &#039;&#039;%album artist%&#039;&#039; is different than &#039;&#039;%artist%&#039;&#039; for specific track. Intended for use together with &#039;&#039;%album artist%&#039;&#039;, to indicate track-specific artist info, e.g. &amp;quot;%album artist% - %title%[ &#039;//&#039; %track artist%]&amp;quot;. In this case, the last part will be displayed only when track-specific artist info is present.&lt;br /&gt;
&lt;br /&gt;
==== %title% ====&lt;br /&gt;
Title of the track. If &amp;quot;title&amp;quot; metadata field is missing, file name is used instead. For a SHOUTcast stream which contains metadata, it is the StreamTitle after the first &amp;quot;-&amp;quot; character.&lt;br /&gt;
&lt;br /&gt;
==== %tracknumber% ====&lt;br /&gt;
Two-digit index of specified track within the album. Available only when &amp;quot;tracknumber&amp;quot; field is present in track’s metadata. An extra &#039;0&#039; is placed in front of single digit track numbers (5 becomes 05) &amp;amp;ndash; otherwise the tracknumber field is returned unchanged (e.g. the following values remain as they are: 006, 05, 104, A3, two, -1, -).&lt;br /&gt;
&lt;br /&gt;
==== %track number% ====&lt;br /&gt;
Similar to %tracknumber%, however single digit track numbers are not reformatted to have an extra 0.&lt;br /&gt;
&lt;br /&gt;
==== %totaltracks% ====&lt;br /&gt;
Index of total tracks specified tracks belong to, within the album. Available only when &amp;quot;totaltracks&amp;quot; field is present in track’s metadata.&lt;br /&gt;
&lt;br /&gt;
=== Technical information fields ===&lt;br /&gt;
&lt;br /&gt;
==== %bitrate% ====&lt;br /&gt;
Bitrate of the track in kilobits per second. VBR files will show a dynamic display for currently played track (outside of the playlist).&lt;br /&gt;
&lt;br /&gt;
==== %channels% ====&lt;br /&gt;
Number of channels in the track, as text; either &amp;quot;mono&amp;quot;, &amp;quot;stereo&amp;quot; for 1 or 2 channels, respectively, otherwise a number followed by &amp;quot;ch&amp;quot;, e.g. &amp;quot;6ch&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %codec% ====&lt;br /&gt;
Name of codec used to encode the track, e.g. PCM, FLAC, MP3, or AAC. If exact codec name is not available, file extension is used. The Default UI&#039;s standard Codec column displays the same info, but sometimes adds details, e.g. &amp;quot;MP3 / VBR V2&amp;quot; or &amp;quot;AAC / LC&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
==== %filesize% ====&lt;br /&gt;
The exact file size in bytes.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_filesize%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %filesize_natural% ====&lt;br /&gt;
The approximate file size, automatically formatted in appropriate units such as megabytes or kilobytes, e.g. &amp;quot;8.49 MB&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %length% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, and seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_ex% ====&lt;br /&gt;
The length of the track formatted as hours, minutes, seconds, and milliseconds, rounded to the nearest millisecond.&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds% ====&lt;br /&gt;
The length of the track in seconds, rounded to the nearest second.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_total_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %length_seconds_fp% ====&lt;br /&gt;
The length of the track in seconds as a floating point number.&lt;br /&gt;
&lt;br /&gt;
==== %length_samples% ====&lt;br /&gt;
The length of the track in samples.&lt;br /&gt;
&lt;br /&gt;
==== %samplerate% ====&lt;br /&gt;
Sample rate of the track, in Hz.&lt;br /&gt;
&lt;br /&gt;
=== Technical information functions ===&lt;br /&gt;
&lt;br /&gt;
==== $info(name) ====&lt;br /&gt;
Returns value of technical information field called &#039;&#039;name&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
For convenience, the &#039;&#039;&#039;%__name%&#039;&#039;&#039; alias is also available.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$info(channels)&#039;&#039; → 2&lt;br /&gt;
&lt;br /&gt;
Here is an &#039;&#039;&#039;informative&#039;&#039;&#039; list of recognized fields. Some of these depend on the media file type being queried.&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! field name&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;General&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|codec&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; MP3)&lt;br /&gt;
|-&lt;br /&gt;
|codec_profile&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Codec Profile&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; CBR)&lt;br /&gt;
|-&lt;br /&gt;
|samplerate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Sample Rate&#039;&#039;&#039;, in hertz (&#039;&#039;e.g.&#039;&#039; 44100)&lt;br /&gt;
|-&lt;br /&gt;
|bitrate&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bitrate&#039;&#039;&#039;, in kilobits per second (&#039;&#039;e.g.&#039;&#039; 320)&lt;br /&gt;
|-&lt;br /&gt;
|tool&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tool&#039;&#039;&#039; used to produce the file, possibly guessed (&#039;&#039;e.g.&#039;&#039; LAME3.97)&lt;br /&gt;
|-&lt;br /&gt;
|encoding&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Encoding&#039;&#039;&#039; lossiness (&#039;&#039;e.g.&#039;&#039; lossy)&lt;br /&gt;
|-&lt;br /&gt;
|channels&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channels&#039;&#039;&#039; count (&#039;&#039;e.g.&#039;&#039; 2 &amp;lt;nowiki&amp;gt;[for stereo]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|bitspersample&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Bits Per Sample&#039;&#039;&#039; (&#039;&#039;e.g.&#039;&#039; 16)&lt;br /&gt;
|-&lt;br /&gt;
|tagtype&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Tag Type&#039;&#039;&#039;, comma-separated list of tag formats (&#039;&#039;e.g.&#039;&#039; id3v2|apev2)&lt;br /&gt;
|-&lt;br /&gt;
|cue_embedded&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Embedded Cuesheet&#039;&#039;&#039; presence (&#039;&#039;e.g.&#039;&#039; no &amp;lt;nowiki&amp;gt;[may be empty!]&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
|-&lt;br /&gt;
|md5&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Audio MD5&#039;&#039;&#039; hash, if container defines it (&#039;&#039;e.g.&#039;&#039; 1E24A910D91EF09A8CF403C9B6963961)&lt;br /&gt;
|-&lt;br /&gt;
|WAVEFORMATEXTENSIBLE_CHANNEL_MASK&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel mask&#039;&#039;&#039;, channel layout of the track coded as hex (&#039;&#039;e.g.&#039;&#039; 0x0003 for regular stereo)&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background-color:#CCF&amp;quot;|&#039;&#039;&#039;Other&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|ENC_DELAY&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_delay&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 576)&lt;br /&gt;
|-&lt;br /&gt;
|ENC_PADDING&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|LAME proprietary MP3 &#039;&#039;&#039;enc_padding&#039;&#039;&#039; value for gapless playback (&#039;&#039;e.g.&#039;&#039; 1536)&lt;br /&gt;
|-&lt;br /&gt;
|MP3_ACCURATE_LENGTH&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|MP3 duration (%length% etc.) takes into account LAME or iTunes gapless playback info (&#039;&#039;e.g.&#039;&#039; yes)*&lt;br /&gt;
|-&lt;br /&gt;
|MP3_STEREO_MODE&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|Stereo mode used in MP3 file (&#039;&#039;e.g.&#039;&#039; mono, stereo, joint stereo, etc.)&lt;br /&gt;
|-&lt;br /&gt;
|VERSION&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Version&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 3.99)&lt;br /&gt;
|-&lt;br /&gt;
|FLAGS&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Flags&#039;&#039;&#039; of tool (&#039;&#039;e.g.&#039;&#039; 22)&lt;br /&gt;
|-&lt;br /&gt;
|channel_mode&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot;|&#039;&#039;&#039;Channel Mode&#039;&#039;&#039;, description of channels (note: this field was only used by obsolete foo_ac3. &#039;&#039;e.g.&#039;&#039; 3 front, 2 rear surround channels + LFE)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;font-size: 90%&amp;quot;&amp;gt;&amp;lt;nowiki&amp;gt;*&amp;lt;/nowiki&amp;gt; &#039;&#039;MP3_ACCURATE_LENGTH won&#039;t exist if gapless playback info isn&#039;t present or the file is not an MP3. The info can be in a LAME tag in the VBR header, or in an iTunSMPB ID3v2 comment tag. Gapless playback info is taken into account in .m4a files, but there&#039;s no special field to say so.&#039;&#039;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== $channels() ====&lt;br /&gt;
The number of channels in text format.&lt;br /&gt;
&lt;br /&gt;
Example: &#039;&#039;$channels()&#039;&#039; → &amp;quot;stereo&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_gain% ====&lt;br /&gt;
The ReplayGain album gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak% ====&lt;br /&gt;
The ReplayGain album peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_album_peak_db% ====&lt;br /&gt;
The ReplayGain album peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_gain% ====&lt;br /&gt;
The ReplayGain track gain value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak% ====&lt;br /&gt;
The ReplayGain track peak value.&lt;br /&gt;
&lt;br /&gt;
==== %replaygain_track_peak_db% ====&lt;br /&gt;
The ReplayGain track peak value in decibels.&lt;br /&gt;
&lt;br /&gt;
=== Special fields ===&lt;br /&gt;
&lt;br /&gt;
==== %filename% ====&lt;br /&gt;
The filename without directory and extension.&lt;br /&gt;
&lt;br /&gt;
==== %filename_ext% ====&lt;br /&gt;
The filename with extension, but without the directory.&lt;br /&gt;
&lt;br /&gt;
==== %directoryname% ====&lt;br /&gt;
The name of the parent directory only, not the complete path.&lt;br /&gt;
&lt;br /&gt;
==== %last_modified% ====&lt;br /&gt;
The date and time the file was last modified. Eg: &#039;&#039;2005-12-22 00:04:10&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== %path% ====&lt;br /&gt;
The complete path, including the filename and extension.&lt;br /&gt;
&lt;br /&gt;
==== %_path_raw% ====&lt;br /&gt;
The path as URL including the protocol scheme.&lt;br /&gt;
&lt;br /&gt;
==== %subsong% ====&lt;br /&gt;
The subsong index. The subsong index is used to distuingish multiple tracks in a single file, for example for cue sheets, tracker modules and various container formats.&lt;br /&gt;
&lt;br /&gt;
==== %_foobar2000_version% ====&lt;br /&gt;
A string representing the version of foobar2000.&lt;br /&gt;
&lt;br /&gt;
== Time and date functions ==&lt;br /&gt;
&lt;br /&gt;
These functions are used to manipulate time/date strings, notably (but not limited to), [[Foobar2000:Titleformat_Playback_Statistics|those gathered]] by the [[Foobar2000:Components/Playback Statistics v3.x (foo playcount)|Playback Statistics component]].&lt;br /&gt;
&lt;br /&gt;
=== $year(time) ===&lt;br /&gt;
Retrieves the year part (formatted as four digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $month(time) ===&lt;br /&gt;
Retrieves the month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $day_of_month(time) ===&lt;br /&gt;
Retrieves the day of month part (formatted as two digits) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $date(time) ===&lt;br /&gt;
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.&lt;br /&gt;
&lt;br /&gt;
=== $time(time) ===&lt;br /&gt;
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string.&lt;br /&gt;
&lt;br /&gt;
== Variable operations ==&lt;br /&gt;
&lt;br /&gt;
Variables can be used to store strings and numbers. They cannot store truth values. They are best used to store intermediate results that you need multiple times. Variable names are not case-sensitive.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
! code&lt;br /&gt;
! output&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;pre&amp;gt;$put(foo,bar)$char(10)&lt;br /&gt;
$get(foo)$char(10)&lt;br /&gt;
$get(Foo)$char(10)&lt;br /&gt;
$puts(foo,2000)$char(10)&lt;br /&gt;
$get(foo)$char(10)&amp;lt;/pre&amp;gt;&lt;br /&gt;
| style=&amp;quot;background-color:#EEF&amp;quot; |&amp;lt;pre&amp;gt;bar&lt;br /&gt;
bar&lt;br /&gt;
bar&lt;br /&gt;
&lt;br /&gt;
2000&amp;lt;/pre&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== $get(name) ===&lt;br /&gt;
Returns the value that was last stored in the variable &#039;&#039;name&#039;&#039;, if the variable was not defined (yet), it returns nothing. The truth value returned by &#039;&#039;$get&#039;&#039; indicates if the variable &#039;&#039;name&#039;&#039; was defined and is a non-empty string.&lt;br /&gt;
&lt;br /&gt;
=== $put(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns &#039;&#039;value&#039;&#039; unaltered.&lt;br /&gt;
&lt;br /&gt;
=== $puts(name,value) ===&lt;br /&gt;
Stores &#039;&#039;value&#039;&#039; in the variable &#039;&#039;name&#039;&#039; and returns nothing.&lt;br /&gt;
&lt;br /&gt;
== Component-specific fields and functions ==&lt;br /&gt;
&lt;br /&gt;
This section lists fields and functions which are specific to certain components. Unless otherwise stated, the fields and functions are only usable in the context of those components.&lt;br /&gt;
&lt;br /&gt;
=== Now playing info ===&lt;br /&gt;
&lt;br /&gt;
The following fields related to the currently playing item are only usable in certain locations outside of the playlist, e.g. in the status bar, the main window title and the copy command script.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time% ====&lt;br /&gt;
The elapsed time formatted as [HH:]MM:SS.&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_seconds% ====&lt;br /&gt;
The elapsed time in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_elapsed%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining% ====&lt;br /&gt;
The time remaining until the track ends, formatted as [HH:]MM:SS.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== %playback_time_remaining_seconds% ====&lt;br /&gt;
The time remaining until the track ends, in seconds.&lt;br /&gt;
Old version: &amp;lt;code&amp;gt;%_time_remaining_seconds%&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Playlist-only fields ===&lt;br /&gt;
&lt;br /&gt;
The following fields are only usable in playlist display formatting (i.e., the column title formatting patterns).&lt;br /&gt;
&lt;br /&gt;
==== %isplaying% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if file is currently playing, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %ispaused% ====&lt;br /&gt;
&amp;quot;1&amp;quot; if playback is paused, empty string otherwise.&lt;br /&gt;
&lt;br /&gt;
==== %list_index% ====&lt;br /&gt;
A zero-padded playlist index of specified item. The first item is at index 1.&lt;br /&gt;
&lt;br /&gt;
==== %list_total% ====&lt;br /&gt;
The number of items in the playlist.&lt;br /&gt;
&lt;br /&gt;
==== %queue_index% ====&lt;br /&gt;
Index of the specified item in the playback queue. If the item has been queued multiple times, %queue_index% evaluates to the first index.&lt;br /&gt;
&lt;br /&gt;
==== %queue_indexes% ====&lt;br /&gt;
List of indexes of the specified item in the playback queue. Same as %queue_index% unless the item has been queued more than once.&lt;br /&gt;
&lt;br /&gt;
==== %queue_total% ====&lt;br /&gt;
Total amount of tracks in playback queue. Available only for queued tracks, for technical reasons. &lt;br /&gt;
&lt;br /&gt;
=== Playlist text color ===&lt;br /&gt;
&lt;br /&gt;
==== Dimmed and highlighted text ====&lt;br /&gt;
&lt;br /&gt;
In the Default UI playlist, text color can be adjusted by enclosing it in angle-brackets. The only options are to make the text dimmer (mixing the default color with the background color) or brighter (mixing the default color with the highlight color):&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;text&amp;gt;&#039;&#039; – dim &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&#039;&#039; – dimmer &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;text&amp;gt;&amp;gt;&amp;gt;&#039;&#039; – dimmest &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;text&amp;amp;lt;&#039;&#039; – bright &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brighter &#039;&#039;text&#039;&#039;&lt;br /&gt;
* &#039;&#039;&amp;gt;&amp;gt;&amp;gt;text&amp;amp;lt;&amp;amp;lt;&amp;amp;lt;&#039;&#039; – brightest &#039;&#039;text&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Historical and Columns UI color functions ====&lt;br /&gt;
&lt;br /&gt;
Prior to version 1.0, the default UI playlist supported the following color functions, which are still available in the Columns UI playlist:&lt;br /&gt;
&lt;br /&gt;
===== $blend(color1,color2,part,total) =====&lt;br /&gt;
Returns a color that is a blend between &#039;&#039;color1&#039;&#039; and &#039;&#039;color2&#039;&#039;. If &#039;&#039;part&#039;&#039; is smaller than or equal to zero, &#039;&#039;color1&#039;&#039; is returned. If &#039;&#039;part&#039;&#039; is greater than or equal to &#039;&#039;total&#039;&#039;, &#039;&#039;color2&#039;&#039; is returned. Otherwise a blended color is returned that is &#039;&#039;part&#039;&#039; parts &#039;&#039;color1&#039;&#039; and &#039;&#039;total&#039;&#039;-&#039;&#039;part&#039;&#039; parts &#039;&#039;color2&#039;&#039;. The blending is performed in the RGB color space.&lt;br /&gt;
&lt;br /&gt;
===== $hsl() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h,s,l) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039; and &#039;&#039;l&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
The ranges of &#039;&#039;h&#039;&#039;, &#039;&#039;s&#039;&#039;, and &#039;&#039;l&#039;&#039; are from 0 to 240; the function is designed to interpret those values in the same way as the standard Windows color dialog.&lt;br /&gt;
&lt;br /&gt;
===== $hsl(h1,s1,l1,h2,s2,l2) =====&lt;br /&gt;
Sets the color for text in the HSL color space. &#039;&#039;h1&#039;&#039;, &#039;&#039;s1&#039;&#039; and &#039;&#039;l1&#039;&#039; are the hue, saturation, and lightness of the color for unselected text. &#039;&#039;h2&#039;&#039;, &#039;&#039;s2&#039;&#039; and &#039;&#039;l2&#039;&#039; are the hue, saturation, and lightness of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $rgb() =====&lt;br /&gt;
Resets the text color to the default color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r,g,b) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r&#039;&#039;, &#039;&#039;g&#039;&#039; and &#039;&#039;b&#039;&#039; are the red, green and blue component of the color for unselected text. The color for selected text is set to the inverse color.&lt;br /&gt;
&lt;br /&gt;
===== $rgb(r1,g1,b1,r2,g2,b2) =====&lt;br /&gt;
Sets the color for text. &#039;&#039;r1&#039;&#039;, &#039;&#039;g1&#039;&#039; and &#039;&#039;b1&#039;&#039; are the red, green and blue component of the color for unselected text. &#039;&#039;r2&#039;&#039;, &#039;&#039;g2&#039;&#039; and &#039;&#039;b2&#039;&#039; are the red, green and blue component of the color for selected text.&lt;br /&gt;
&lt;br /&gt;
===== $transition(string,color1,color2) =====&lt;br /&gt;
Inserts color codes into &#039;&#039;string&#039;&#039;, so that the first character has &#039;&#039;color1&#039;&#039;, the last character has &#039;&#039;color2&#039;&#039;, and intermediate characters have blended colors. The blending is performed in the RGB color space. Note that color codes are additional characters that will also be counted by string manipulation functions. For example, if you need to truncate a string, you should do this before applying &#039;&#039;$transition&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Album List ===&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Titleformat_Album_List|Album List Title Formatting]]&lt;br /&gt;
* [[Foobar2000:Preferences:Album List|Preferences: Album List]]&lt;br /&gt;
&lt;br /&gt;
=== Playback Statistics ===&lt;br /&gt;
&lt;br /&gt;
The foo_playcount component adds a number of fields for playback statistics and ratings. The fields can be used anywhere track info can be displayed. See the documentation for details:&lt;br /&gt;
* [http://www.foobar2000.org/components/view/foo_playcount Playback statistics homepage]&lt;br /&gt;
* [[Foobar2000:Titleformat Playback Statistics|Playback statistics titleformat reference]]&lt;br /&gt;
&lt;br /&gt;
=== Playlist Organizer ===&lt;br /&gt;
&lt;br /&gt;
This component adds a number of fields to control the display of a list of playlists. See the documentation for details:&lt;br /&gt;
* [[Foobar2000:Components/Playlist Organizer (foo_plorg)#Nodes|Playlist Organizer: Nodes Title Formatting]]&lt;br /&gt;
&lt;br /&gt;
=== Columns UI ===&lt;br /&gt;
&lt;br /&gt;
This component replaces the Default UI framework, including the playlist. See the documentation for details:&lt;br /&gt;
* [http://yuo.be/columns.php Columns UI homepage]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:global_variables Global variables reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:colour_string Playlist colors reference]&lt;br /&gt;
* [http://yuo.be/wiki/columns_ui:config:playlist_switcher_titleformatting Playlist switcher reference]&lt;br /&gt;
&lt;br /&gt;
== Additional Reading ==&lt;br /&gt;
&lt;br /&gt;
* [[Foobar2000:Title Formatting Introduction|Introduction to titleformat scripts]]&lt;br /&gt;
* The file &#039;&#039;&#039;titleformat_help.html&#039;&#039;&#039; in your Foobar2000 directory, e.g. file:///C:/Program%20Files%20(x86)/foobar2000/titleformat_help.html&lt;br /&gt;
&lt;br /&gt;
[[Category:foobar2000 Guides|Titleformat Reference]]&lt;/div&gt;</summary>
		<author><name>Case</name></author>
	</entry>
</feed>