1159b3361Sopenharmony_ci<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2159b3361Sopenharmony_ci        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3159b3361Sopenharmony_ci<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4159b3361Sopenharmony_ci <head>
5159b3361Sopenharmony_ci  <meta name="generator" content="PSPad editor, www.pspad.com" />
6159b3361Sopenharmony_ci  <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
7159b3361Sopenharmony_ci  <link rel="stylesheet" type="text/css" href="styles/lame.css" />
8159b3361Sopenharmony_ci  <title>Introduction to encoding</title>
9159b3361Sopenharmony_ci </head>
10159b3361Sopenharmony_ci <body>
11159b3361Sopenharmony_ci<div id="menu">
12159b3361Sopenharmony_ci    <ul>
13159b3361Sopenharmony_ci        <li><a href="index.html">Index page</a></li>
14159b3361Sopenharmony_ci        <li><a href="about.html">About LAME</a></li>
15159b3361Sopenharmony_ci        <li><a style="border: 0" href="introduction.html">Intro to encoding</a>
16159b3361Sopenharmony_ci    <div id="submenu">
17159b3361Sopenharmony_ci        <ul>
18159b3361Sopenharmony_ci            <li><a href="cbr.html">CBR </a></li>
19159b3361Sopenharmony_ci            <li><a href="abr.html">ABR </a></li>
20159b3361Sopenharmony_ci        <li><a href="vbr.html">VBR </a></li>
21159b3361Sopenharmony_ci        <li><a style="border: 0" href="ms_stereo.html">M/S Stereo</a></li>
22159b3361Sopenharmony_ci        </ul>
23159b3361Sopenharmony_ci    </div>
24159b3361Sopenharmony_ci    </li>
25159b3361Sopenharmony_ci        <li><a href="usage.html">Usage of LAME</a></li>
26159b3361Sopenharmony_ci        <li><a href="history.html">Version history</a></li>
27159b3361Sopenharmony_ci        <li><a href="contributors.html">Coders of LAME</a></li>
28159b3361Sopenharmony_ci        <li><a href="contact.html">Contact LAME</a></li>
29159b3361Sopenharmony_ci        <li><a style="border: 0" href="links.html">LAME links</a></li>
30159b3361Sopenharmony_ci    </ul>
31159b3361Sopenharmony_ci</div>
32159b3361Sopenharmony_ci<div id="container">
33159b3361Sopenharmony_ci<div id="content">
34159b3361Sopenharmony_ci
35159b3361Sopenharmony_ci<div align="center">
36159b3361Sopenharmony_ci    <img src="images/logo.gif" width="358" height="231" alt="LAME Official Logo" />
37159b3361Sopenharmony_ci    <h2 class="hilight">Introduction to encoding</h2>
38159b3361Sopenharmony_ci</div>
39159b3361Sopenharmony_ci<h3> Introduction</h3>
40159b3361Sopenharmony_ci<p>
41159b3361Sopenharmony_ci    There is a lot of confusion surrounding the terms audio compression<a href="#note1">
42159b3361Sopenharmony_ci    <sup>1</sup></a>, audio encoding, and audio decoding. This section will give you
43159b3361Sopenharmony_ci    an overview what audio coding (another one of these terms...) is all about.
44159b3361Sopenharmony_ci</p>
45159b3361Sopenharmony_ci<h3>The purpose of audio compression</h3>
46159b3361Sopenharmony_ci<p>Up to the advent of audio compression, high-quality digital audio data took
47159b3361Sopenharmony_ci    a lot of hard disk space to store. Let us go through a short example.
48159b3361Sopenharmony_ci</p>
49159b3361Sopenharmony_ci<p>
50159b3361Sopenharmony_ci    You want to sample 1 minute of your favourite song and store it on your harddisk.
51159b3361Sopenharmony_ci    Because you want CD quality, you sample at 44.1 kHz, stereo, with 16 bits per sample.
52159b3361Sopenharmony_ci</p>
53159b3361Sopenharmony_ci<p>
54159b3361Sopenharmony_ci    44100 Hz means that you have 44100 values per second coming in from your sound card
55159b3361Sopenharmony_ci    (or input file). Multiply that by two because you have two channels. Multiply by
56159b3361Sopenharmony_ci    another factor of two because you have two bytes per value (that's what 16 bit
57159b3361Sopenharmony_ci    means). The song will take up 44100 <sup>samples</sup>/<sub>s</sub> · 2 channels
58159b3361Sopenharmony_ci    · 2 <sup>bytes</sup>/<sub>sample</sub> ·
59159b3361Sopenharmony_ci    60 <sup>s</sup>/<sub>min</sub> ~ 10 MBytes of storage space on your harddisk.
60159b3361Sopenharmony_ci</p>
61159b3361Sopenharmony_ci<p>
62159b3361Sopenharmony_ci    In order to stream this over internet, a speed of at least 1.41<sup>Mbits</sup>/
63159b3361Sopenharmony_ci    <sub>s</sub> is needed,
64159b3361Sopenharmony_ci    which wasn't a common speed at all at the time MP3 was invented.  
65159b3361Sopenharmony_ci    If you wanted to download that, given an average 56k modem connected at 44k, it
66159b3361Sopenharmony_ci    would take 1.41Mbits · 1000 <sup>kbits</sup>/<sub>Mbit</sub> / 44 kbits ~ 32
67159b3361Sopenharmony_ci    times as much.
68159b3361Sopenharmony_ci    <br/>This means 32 minutes just to download one minute of music!
69159b3361Sopenharmony_ci</p>
70159b3361Sopenharmony_ci<p>
71159b3361Sopenharmony_ci    Digital audio coding, which - in this context - is synonymously called digital
72159b3361Sopenharmony_ci    audio compression as well, is the art of minimizing storage space (or channel
73159b3361Sopenharmony_ci    bandwidth) requirements for audio data. Modern perceptual audio coding techniques
74159b3361Sopenharmony_ci    (like MPEG Layer III) exploit the properties of the human ear (the perception of
75159b3361Sopenharmony_ci    sound) to achieve a size reduction by a factor of 11 with little or no perceptible
76159b3361Sopenharmony_ci    loss of quality.
77159b3361Sopenharmony_ci</p>
78159b3361Sopenharmony_ci<p>
79159b3361Sopenharmony_ci    Therefore, such schemes are the key technology for high quality low bit-rate
80159b3361Sopenharmony_ci    applications, like soundtracks for CD-ROM games, solid-state sound memories,
81159b3361Sopenharmony_ci    Internet audio, digital audio broadcasting systems, and the like.
82159b3361Sopenharmony_ci</p>
83159b3361Sopenharmony_ci<h3>The two parts of audio compression</h3>
84159b3361Sopenharmony_ci<p>
85159b3361Sopenharmony_ci    Audio compression really consists of two parts. The first part, called encoding,
86159b3361Sopenharmony_ci    transforms the digital audio data that resides, say, in a WAVE file, into a highly
87159b3361Sopenharmony_ci    compressed form called bitstream. To play the bitstream on your soundcard, you
88159b3361Sopenharmony_ci    need the second part, called decoding. Decoding takes the bitstream and re-expands
89159b3361Sopenharmony_ci    it to a WAVE file.
90159b3361Sopenharmony_ci</p>
91159b3361Sopenharmony_ci<p>
92159b3361Sopenharmony_ci    The program that effects the first part is called an audio encoder. LAME is such
93159b3361Sopenharmony_ci    an encoder . The program that does the second part is called an audio decoder.
94159b3361Sopenharmony_ci    Nowadays there are lots of players that decode MP3
95159b3361Sopenharmony_ci</p>
96159b3361Sopenharmony_ci<h3>Compression ratios, bitrate and quality</h3>
97159b3361Sopenharmony_ci<p>
98159b3361Sopenharmony_ci    It has not been explicitly mentioned up to now: What you end up with after
99159b3361Sopenharmony_ci    encoding and decoding is not the same sound file anymore: All superfluous
100159b3361Sopenharmony_ci    information has been squeezed out, so to say. It is not the same file, but it
101159b3361Sopenharmony_ci    will sound the same - more or less, depending on how much compression has been
102159b3361Sopenharmony_ci    performed on it.
103159b3361Sopenharmony_ci</p>
104159b3361Sopenharmony_ci<p>
105159b3361Sopenharmony_ci    Generally speaking, the lower the compression ratio achieved, the better the
106159b3361Sopenharmony_ci    sound quality will be in the end - and vice versa.<br/>
107159b3361Sopenharmony_ci    Table 1.1 gives you a rough estimate about the quality you can expect.
108159b3361Sopenharmony_ci</p>
109159b3361Sopenharmony_ci<p>
110159b3361Sopenharmony_ci    Because compression ratio is a somewhat unwieldy measure, experts use the term
111159b3361Sopenharmony_ci    bitrate when speaking of the strength of compression. Bitrate denotes the average
112159b3361Sopenharmony_ci    number of bits that one second of audio data will take up in your compressed
113159b3361Sopenharmony_ci    bitstream. Usually the units used will be kbps, which is kbits/s, or 1000 bits/s
114159b3361Sopenharmony_ci    (not 1024).<br/>
115159b3361Sopenharmony_ci    To calculate the number of bytes per second of audio data, simply divide the
116159b3361Sopenharmony_ci    number of bits per second by eight.
117159b3361Sopenharmony_ci</p>
118159b3361Sopenharmony_ci<table align="center" cellpadding="5">
119159b3361Sopenharmony_ci    <caption><strong>table 1.1:</strong> bitrate versus sound quality</caption>
120159b3361Sopenharmony_ci    <tr>
121159b3361Sopenharmony_ci        <th>Bitrate</th>
122159b3361Sopenharmony_ci        <th>Bandwidth</th>
123159b3361Sopenharmony_ci        <th>Quality comparable to</th>
124159b3361Sopenharmony_ci    </tr>
125159b3361Sopenharmony_ci    <tr>
126159b3361Sopenharmony_ci        <td>16 kbps mono</td>
127159b3361Sopenharmony_ci        <td>5.5 khz</td>
128159b3361Sopenharmony_ci        <td>above shortwave radio / telephone</td>
129159b3361Sopenharmony_ci    </tr>
130159b3361Sopenharmony_ci    <tr>
131159b3361Sopenharmony_ci        <td>32 kbps mono</td>
132159b3361Sopenharmony_ci        <td>8.5 khz</td>
133159b3361Sopenharmony_ci        <td>near AM (medium wave) radio</td>
134159b3361Sopenharmony_ci    </tr>
135159b3361Sopenharmony_ci    <tr>
136159b3361Sopenharmony_ci        <td>64kbps mono, 128 kbps stereo</td>
137159b3361Sopenharmony_ci        <td>16 khz</td>
138159b3361Sopenharmony_ci        <td>FM radio</td>
139159b3361Sopenharmony_ci    </tr>
140159b3361Sopenharmony_ci    <tr>
141159b3361Sopenharmony_ci        <td style="border-bottom:0px">-V 3~-V 0 (160~200 kbps) <br/>
142159b3361Sopenharmony_ci            (variable bitrate)
143159b3361Sopenharmony_ci        </td>
144159b3361Sopenharmony_ci        <td style="border-bottom:0px">18~20 khz</td>
145159b3361Sopenharmony_ci        <td style="border-bottom:0px">perceptual transparency versus CD<a href="#transparency"><sup>2</sup>
146159b3361Sopenharmony_ci            </a>
147159b3361Sopenharmony_ci        </td>
148159b3361Sopenharmony_ci    </tr>
149159b3361Sopenharmony_ci</table>
150159b3361Sopenharmony_ci<div id="notes">
151159b3361Sopenharmony_ci    <ol>
152159b3361Sopenharmony_ci        <li><a name="note1"></a>Audio compression (also called coding)
153159b3361Sopenharmony_ci            means reduce the size (bytes) that the original source requires to be stored.
154159b3361Sopenharmony_ci            This is not the same than compressors in DSP (or audio effects). The latter
155159b3361Sopenharmony_ci            reduces the dynamic range of the audio so that there is less difference in
156159b3361Sopenharmony_ci            perceived loudness between its strong and subtle parts.
157159b3361Sopenharmony_ci        </li>
158159b3361Sopenharmony_ci        <li><a name="note2"></a>Lossy encoding (as opposed to lossless) cannot guarantee
159159b3361Sopenharmony_ci            transparency all of the time. This is the value accepted as the <i>sweet spot</i>. 
160159b3361Sopenharmony_ci        </li>
161159b3361Sopenharmony_ci    </ol>
162159b3361Sopenharmony_ci</div>
163159b3361Sopenharmony_ci</div>
164159b3361Sopenharmony_ci<div id="footer">
165159b3361Sopenharmony_ci
166159b3361Sopenharmony_ci<a href="http://sourceforge.net/projects/lame"><img src="images/sflogo.gif"
167159b3361Sopenharmony_ci alt="Get LAME (Lame Aint an MP3 Encoder) at SourceForge.net. Fast, secure and Free Open Source software downloads"
168159b3361Sopenharmony_ci border="0" height="30" width="120" /></a>
169159b3361Sopenharmony_ci
170159b3361Sopenharmony_ci<a href="http://validator.w3.org/#validate_by_upload"><img src="images/valid-xhtml10.png"
171159b3361Sopenharmony_ci alt="Valid XHTML 1.0 Transitional" border="0" height="31" width="88" /></a>
172159b3361Sopenharmony_ci
173159b3361Sopenharmony_ci<a href="http://jigsaw.w3.org/css-validator/"><img src="images/valid-css.png"
174159b3361Sopenharmony_ci alt="Valid CSS!" border="0" height="31" width="88" /></a>
175159b3361Sopenharmony_ci
176159b3361Sopenharmony_ci<p>HTML markup and design by <a
177159b3361Sopenharmony_cihref="http://www.rarewares.org" target="_blank">Roberto Amorim</a> and <a
178159b3361Sopenharmony_cihref="http://www.maresweb.de" target="_blank">Sebastian Mares</a>. Logo by <a 
179159b3361Sopenharmony_cihref="http://www.brightercreative.co.uk">Sam Fisher</a>.</p>
180159b3361Sopenharmony_ci
181159b3361Sopenharmony_ci</div>
182159b3361Sopenharmony_ci</div>
183159b3361Sopenharmony_ci
184159b3361Sopenharmony_ci </body>
185159b3361Sopenharmony_ci</html>
186