| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| 2 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta name="generator" content="PSPad editor, www.pspad.com" /> |
| 6 |
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> |
| 7 |
<link rel="stylesheet" type="text/css" href="styles/lame.css" /> |
| 8 |
<title>Introduction to encoding</title> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div id="menu"> |
| 12 |
<ul> |
| 13 |
<li><a href="index.html">Index page</a></li> |
| 14 |
<li><a href="about.html">About LAME</a></li> |
| 15 |
<li><a style="border: 0" href="introduction.html">Intro to encoding</a> |
| 16 |
<div id="submenu"> |
| 17 |
<ul> |
| 18 |
<li><a href="cbr.html">CBR </a></li> |
| 19 |
<li><a href="abr.html">ABR </a></li> |
| 20 |
<li><a href="vbr.html">VBR </a></li> |
| 21 |
<li><a style="border: 0" href="ms_stereo.html">M/S Stereo</a></li> |
| 22 |
</ul> |
| 23 |
</div> |
| 24 |
</li> |
| 25 |
<li><a href="usage.html">Usage of LAME</a></li> |
| 26 |
<li><a href="history.html">Version history</a></li> |
| 27 |
<li><a href="contributors.html">Coders of LAME</a></li> |
| 28 |
<li><a href="contact.html">Contact LAME</a></li> |
| 29 |
<li><a style="border: 0" href="links.html">LAME links</a></li> |
| 30 |
</ul> |
| 31 |
</div> |
| 32 |
<div id="container"> |
| 33 |
<div id="content"> |
| 34 |
|
| 35 |
<div align="center"> |
| 36 |
<img src="images/logo.gif" width="358" height="231" alt="LAME Official Logo" /> |
| 37 |
<h2 class="hilight">Introduction to encoding</h2> |
| 38 |
</div> |
| 39 |
<h3> Introduction</h3> |
| 40 |
<p> |
| 41 |
There is a lot of confusion surrounding the terms audio compression<a href="#note1"> |
| 42 |
<sup>1</sup></a>, audio encoding, and audio decoding. This section will give you |
| 43 |
an overview what audio coding (another one of these terms...) is all about. |
| 44 |
</p> |
| 45 |
<h3>The purpose of audio compression</h3> |
| 46 |
<p>Up to the advent of audio compression, high-quality digital audio data took |
| 47 |
a lot of hard disk space to store. Let us go through a short example. |
| 48 |
</p> |
| 49 |
<p> |
| 50 |
You want to sample 1 minute of your favourite song and store it on your harddisk. |
| 51 |
Because you want CD quality, you sample at 44.1 kHz, stereo, with 16 bits per sample. |
| 52 |
</p> |
| 53 |
<p> |
| 54 |
44100 Hz means that you have 44100 values per second coming in from your sound card |
| 55 |
(or input file). Multiply that by two because you have two channels. Multiply by |
| 56 |
another factor of two because you have two bytes per value (that's what 16 bit |
| 57 |
means). The song will take up 44100 <sup>samples</sup>/<sub>s</sub> · 2 channels |
| 58 |
· 2 <sup>bytes</sup>/<sub>sample</sub> · |
| 59 |
60 <sup>s</sup>/<sub>min</sub> ~ 10 MBytes of storage space on your harddisk. |
| 60 |
</p> |
| 61 |
<p> |
| 62 |
In order to stream this over internet, a speed of at least 1.41<sup>Mbits</sup>/ |
| 63 |
<sub>s</sub> is needed, |
| 64 |
which wasn't a common speed at all at the time MP3 was invented. |
| 65 |
If you wanted to download that, given an average 56k modem connected at 44k, it |
| 66 |
would take 1.41Mbits · 1000 <sup>kbits</sup>/<sub>Mbit</sub> / 44 kbits ~ 32 |
| 67 |
times as much. |
| 68 |
<br/>This means 32 minutes just to download one minute of music! |
| 69 |
</p> |
| 70 |
<p> |
| 71 |
Digital audio coding, which - in this context - is synonymously called digital |
| 72 |
audio compression as well, is the art of minimizing storage space (or channel |
| 73 |
bandwidth) requirements for audio data. Modern perceptual audio coding techniques |
| 74 |
(like MPEG Layer III) exploit the properties of the human ear (the perception of |
| 75 |
sound) to achieve a size reduction by a factor of 11 with little or no perceptible |
| 76 |
loss of quality. |
| 77 |
</p> |
| 78 |
<p> |
| 79 |
Therefore, such schemes are the key technology for high quality low bit-rate |
| 80 |
applications, like soundtracks for CD-ROM games, solid-state sound memories, |
| 81 |
Internet audio, digital audio broadcasting systems, and the like. |
| 82 |
</p> |
| 83 |
<h3>The two parts of audio compression</h3> |
| 84 |
<p> |
| 85 |
Audio compression really consists of two parts. The first part, called encoding, |
| 86 |
transforms the digital audio data that resides, say, in a WAVE file, into a highly |
| 87 |
compressed form called bitstream. To play the bitstream on your soundcard, you |
| 88 |
need the second part, called decoding. Decoding takes the bitstream and re-expands |
| 89 |
it to a WAVE file. |
| 90 |
</p> |
| 91 |
<p> |
| 92 |
The program that effects the first part is called an audio encoder. LAME is such |
| 93 |
an encoder . The program that does the second part is called an audio decoder. |
| 94 |
Nowadays there are lots of players that decode MP3 |
| 95 |
</p> |
| 96 |
<h3>Compression ratios, bitrate and quality</h3> |
| 97 |
<p> |
| 98 |
It has not been explicitly mentioned up to now: What you end up with after |
| 99 |
encoding and decoding is not the same sound file anymore: All superfluous |
| 100 |
information has been squeezed out, so to say. It is not the same file, but it |
| 101 |
will sound the same - more or less, depending on how much compression has been |
| 102 |
performed on it. |
| 103 |
</p> |
| 104 |
<p> |
| 105 |
Generally speaking, the lower the compression ratio achieved, the better the |
| 106 |
sound quality will be in the end - and vice versa.<br/> |
| 107 |
Table 1.1 gives you a rough estimate about the quality you can expect. |
| 108 |
</p> |
| 109 |
<p> |
| 110 |
Because compression ratio is a somewhat unwieldy measure, experts use the term |
| 111 |
bitrate when speaking of the strength of compression. Bitrate denotes the average |
| 112 |
number of bits that one second of audio data will take up in your compressed |
| 113 |
bitstream. Usually the units used will be kbps, which is kbits/s, or 1000 bits/s |
| 114 |
(not 1024).<br/> |
| 115 |
To calculate the number of bytes per second of audio data, simply divide the |
| 116 |
number of bits per second by eight. |
| 117 |
</p> |
| 118 |
<table align="center" cellpadding="5"> |
| 119 |
<caption><strong>table 1.1:</strong> bitrate versus sound quality</caption> |
| 120 |
<tr> |
| 121 |
<th>Bitrate</th> |
| 122 |
<th>Bandwidth</th> |
| 123 |
<th>Quality comparable to</th> |
| 124 |
</tr> |
| 125 |
<tr> |
| 126 |
<td>16 kbps mono</td> |
| 127 |
<td>5.5 khz</td> |
| 128 |
<td>above shortwave radio / telephone</td> |
| 129 |
</tr> |
| 130 |
<tr> |
| 131 |
<td>32 kbps mono</td> |
| 132 |
<td>8.5 khz</td> |
| 133 |
<td>near AM (medium wave) radio</td> |
| 134 |
</tr> |
| 135 |
<tr> |
| 136 |
<td>64kbps mono, 128 kbps stereo</td> |
| 137 |
<td>16 khz</td> |
| 138 |
<td>FM radio</td> |
| 139 |
</tr> |
| 140 |
<tr> |
| 141 |
<td style="border-bottom:0px">-V 3~-V 0 (160~200 kbps) <br/> |
| 142 |
(variable bitrate) |
| 143 |
</td> |
| 144 |
<td style="border-bottom:0px">18~20 khz</td> |
| 145 |
<td style="border-bottom:0px">perceptual transparency versus CD<a href="#transparency"><sup>2</sup> |
| 146 |
</a> |
| 147 |
</td> |
| 148 |
</tr> |
| 149 |
</table> |
| 150 |
<div id="notes"> |
| 151 |
<ol> |
| 152 |
<li><a name="note1"></a>Audio compression (also called coding) |
| 153 |
means reduce the size (bytes) that the original source requires to be stored. |
| 154 |
This is not the same than compressors in DSP (or audio effects). The latter |
| 155 |
reduces the dynamic range of the audio so that there is less difference in |
| 156 |
perceived loudness between its strong and subtle parts. |
| 157 |
</li> |
| 158 |
<li><a name="note2"></a>Lossy encoding (as opposed to lossless) cannot guarantee |
| 159 |
transparency all of the time. This is the value accepted as the <i>sweet spot</i>. |
| 160 |
</li> |
| 161 |
</ol> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
<div id="footer"> |
| 165 |
|
| 166 |
<a href="http://sourceforge.net/projects/lame"><img src="images/sflogo.gif" |
| 167 |
alt="Get LAME (Lame Aint an MP3 Encoder) at SourceForge.net. Fast, secure and Free Open Source software downloads" |
| 168 |
border="0" height="30" width="120" /></a> |
| 169 |
|
| 170 |
<a href="http://validator.w3.org/#validate_by_upload"><img src="images/valid-xhtml10.png" |
| 171 |
alt="Valid XHTML 1.0 Transitional" border="0" height="31" width="88" /></a> |
| 172 |
|
| 173 |
<a href="http://jigsaw.w3.org/css-validator/"><img src="images/valid-css.png" |
| 174 |
alt="Valid CSS!" border="0" height="31" width="88" /></a> |
| 175 |
|
| 176 |
<p>HTML markup and design by <a |
| 177 |
href="http://www.rarewares.org" target="_blank">Roberto Amorim</a> and <a |
| 178 |
href="http://www.maresweb.de" target="_blank">Sebastian Mares</a>. Logo by <a |
| 179 |
href="http://www.brightercreative.co.uk">Sam Fisher</a>.</p> |
| 180 |
|
| 181 |
</div> |
| 182 |
</div> |
| 183 |
|
| 184 |
</body> |
| 185 |
</html> |