<?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=37.188.71.160</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=37.188.71.160"/>
	<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=Special:Contributions/37.188.71.160"/>
	<updated>2026-04-29T02:32:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.hydrogenaudio.org/index.php?title=LAME_Y_switch&amp;diff=26568</id>
		<title>LAME Y switch</title>
		<link rel="alternate" type="text/html" href="https://wiki.hydrogenaudio.org/index.php?title=LAME_Y_switch&amp;diff=26568"/>
		<updated>2016-01-31T01:11:12Z</updated>

		<summary type="html">&lt;p&gt;37.188.71.160: /* The -Y switch and the sfb21 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes the function of &#039;&#039;&#039;the -Y switch&#039;&#039;&#039; in the [[LAME]] encoder commandline.&lt;br /&gt;
&lt;br /&gt;
==The short definition==&lt;br /&gt;
* The -Y switch tells [[LAME]] not to encode the highest frequencies &#039;&#039;&#039;accurately&#039;&#039;&#039;, &#039;&#039;&#039;if doing so&#039;&#039;&#039; causes disproportional increases in bitrate. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other ways to say it include:&lt;br /&gt;
* The -Y switch tells [[LAME]] to use a more &#039;&#039;&#039;coarse representation&#039;&#039;&#039; for the highest frequencies, in the parts where it would cause an over-encoding of all the other bands.&lt;br /&gt;
* The -Y switch tells [[LAME]] to &#039;&#039;&#039;not be so strict&#039;&#039;&#039; with the higher frequencies, &#039;&#039;&#039;if&#039;&#039;&#039; they are going to cause an increase of bitrate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; The -Y switch is not a lowpass filter.&lt;br /&gt;
: It allows high frequencies (&amp;gt;=16Khz) to exist, it just alters its accuracy. If their values are very small it can quantize them to zero (but probably the psychoacoustic analyzer will decide to simply remove them instead).&lt;br /&gt;
&lt;br /&gt;
==The technical definition==&lt;br /&gt;
&lt;br /&gt;
===How is audio stored in MP3===&lt;br /&gt;
* MP3 audio is stored in the frequency domain (values for frequencies) instead of the time domain (values for samples)&lt;br /&gt;
* Frequencies are analyzed and stored in groups, known as bands.&lt;br /&gt;
* Bands are quantized to make them compress better.&lt;br /&gt;
* &#039;&#039;Scale factor&#039;&#039; refers to how much quantization (loss of precision) is applied to each band, where higher quantization causes greater compression, and consequently less variation between the minimum and maximum values (resolution).&lt;br /&gt;
* Each band has its own scale factor, so that its quantization can be adjusted independently from the others.&lt;br /&gt;
*The exception is scalefactor band 21 (sfb21), which does not have a scale factor. This band stores frequencies of 16 kHz and above.&lt;br /&gt;
* Global gain is an extra quantizer that affects all bands simultaneously.&lt;br /&gt;
(See section notes about scalefactors and global gain)&lt;br /&gt;
&lt;br /&gt;
===What is the scalefactor band 21 (sfb21) defect===&lt;br /&gt;
* If the encoder determines that sfb21 needs more resolution, it has no way to decrease the scale factor of sfb21 alone, since there is no such scale factor.&lt;br /&gt;
* The only way to increase the resolution on sfb21 is therefore to reduce the global gain quantization, since global gain applies to all bands.&lt;br /&gt;
* Scale factors are stored as a relative value of global gain (just the difference is stored). Let&#039;s call this value the relative factor.&lt;br /&gt;
* To balance the reduction of global gain, the scale factor of the other bands should increase. Consequently, the relative factor decreases.&lt;br /&gt;
* The relative factor can be decreased until it reaches zero. At that point, any further reduction of global gain implies that the band will use more resolution than needed.&lt;br /&gt;
* The encoder is forced to increase the bitrate needed, not only because of the frequencies at or above 16Khz, but also because other bands below the sfb21 have excessive resolution.&lt;br /&gt;
&lt;br /&gt;
===The -Y switch and the sfb21 ===&lt;br /&gt;
[[LAME]] implements the -Y switch as a way to activate the alternate logic that CBR uses in respect to quantization noise in the sfb21 band.&lt;br /&gt;
* The encoder determines the desired quantization noise within the sfbs. The scale factors are choosen acording to these values.&lt;br /&gt;
* If -Y switch is not used (either implicitly or explicitly), sfb21 gets evaluated and the global gain is set accordingly.&lt;br /&gt;
* Adding -Y lets the encoder ignore whatever quantization noise will be in sfb21.&lt;br /&gt;
&lt;br /&gt;
The result is that all the 16 kHz and above frequencies still get encoded.&lt;br /&gt;
&lt;br /&gt;
The ones that would normally have needed higher resolution to satisfy the criteria of the psy-model don&#039;t receive that treatment, while ones that wouldn&#039;t need higher resolution are unaffected by the Y switch. &#039;&#039;&#039;The Y switch prevents global gain quantization from being decreased solely to accomodate the needs of sfb21&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
==The -Y switch and CBR/ABR ==&lt;br /&gt;
The -Y switch can only be activated in [[LAME#Technical information|VBR mode]]. By default, -V 3 to -V 9 use -Y. -V 0, -V 1, and -V 2 do not. Consequently, adding -Y is only useful for the highest three VBR settings.&lt;br /&gt;
&lt;br /&gt;
This is because in CBR and ABR modes, the encoder uses -Y implicitly. &lt;br /&gt;
Specifically, LAME targets a given bitrate, and adjusts the quantization steps until that target is reached.&lt;br /&gt;
&lt;br /&gt;
Since the sfb21 does not have quantization, its quantization noise is not evaluated.&lt;br /&gt;
&lt;br /&gt;
This is the same treatment as using -Y in VBR mode.&lt;br /&gt;
&lt;br /&gt;
==Motivation behind this article==&lt;br /&gt;
The article tries to clarify what the switch does and what it does not do. It is frequently misinterpreted, like [[Joint_stereo|joint stereo]], and mistaken for a filter.&lt;br /&gt;
&lt;br /&gt;
In explaining what it does, in easy terms and in technical terms, the reader should get a better understanding of the motivation behind and the usage of the switch.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[MP3|Description of the MPEG layer 3 format]]&lt;br /&gt;
* [http://www.hydrogenaudio.org/forums/index.php?showtopic=79841&amp;amp;st=0 Hydrogenaudio thread discussing this article]&lt;br /&gt;
&lt;br /&gt;
==Notes and references==&lt;br /&gt;
&lt;br /&gt;
For long blocks, the last scalefactor band is sfb21. For short blocks it is sfb12. The frequency at which it starts also depends on the sampling rate. The value of ~16Khz is for 44.1Khz material.&lt;br /&gt;
&lt;br /&gt;
Global gain and scale factors are not independent when stored to the file. The latter is expressed as a difference of the former. (relative factor)&lt;br /&gt;
&lt;br /&gt;
* The global gain is the global quantization step size, with a value range between 0 and 255.&lt;br /&gt;
* The relative factor per band is the amount to reduce the global quantization step size. The range of this value is dependant on the band.&lt;br /&gt;
Consequently, there are just a reduced amount of values to use and a change to global gain needs to be compensated by a change in the relative factor.&lt;br /&gt;
&lt;br /&gt;
This article has been brought up partially with comments fom Aleron Ives, robert and benski.&lt;br /&gt;
The definition of the sfb21 problem is reworded from the article at [http://www.mp3-tech.org/content/?Mp3%20Limitations Mp3 tech.org]&lt;/div&gt;</summary>
		<author><name>37.188.71.160</name></author>
	</entry>
</feed>