<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <TITLE>Introduction</TITLE> <META NAME="description" CONTENT="Introduction"> <META NAME="keywords" CONTENT="lame"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso_8859_1"> <LINK REL="STYLESHEET" HREF="lame.css"> </HEAD> <BODY TEXT=#000000 BGCOLOR=#F9FBFB LINK=#006666 VLINK=#4C4C4C ALINK=#995500> <FONT FACE = Helvetica ><strong>Subsections</strong> <UL> <LI><A HREF="node6.html#SECTION00311000000000000000"> The purpose of audio compression</A> <LI><A HREF="node6.html#SECTION00312000000000000000"> The two parts of audio compression</A> <LI><A HREF="node6.html#SECTION00313000000000000000"> Compression ratios, bitrate and quality</A> </UL> <HR> <H1><A NAME="SECTION00310000000000000000"> Introduction</A> </H1> There is a lot of confusion surrounding the terms <I>audio compression</I>, <I>audio encoding</I>, and <I>audio decoding</I>. This section will give you an overview what audio coding (another one of these terms...) is all about. <P> <H2><A NAME="SECTION00311000000000000000"> The purpose of audio compression</A> </H2> <P> Up to the advent of audio compression, high-quality digital audio data took a lot of hard disk space to store. Let us go through a short example. <P> You want to, say, sample your favorite 1-minute song and store it on your harddisk. Because you want CD quality, you sample at 44.1 kHz, stereo, with 16 bits per sample. <P> 44100 Hz means that you have 44100 values per second coming in from your sound card (or input file). Multiply that by two because you have two channels. Multiply by another factor of two because you have two bytes per value (that's what 16 bit means). The song will take up <NOBR>44100 samples/s · 2 channels · 2 bytes/sample · 60 s/min ~ 10 MBytes</NOBR> of storage space on your harddisk. <P> If you wanted to download that over the internet, given an average 56k modem connected at 44k (which is a typical case), it would take you (at least) <NOBR>10000000 bytes · 8 bits/byte / (44000 bits/s) · / (60 s/min) ~ 30 minutes</NOBR> <DIV ALIGN="CENTER"> <B>Just to download one minute of music!</B> </DIV> <P> Digital audio coding, which - in this context - is synonymously called digital audio compression as well, is the art of minimizing storage space (or channel bandwidth) requirements for audio data. Modern perceptual audio coding techniques (like MPEG Layer III) exploit the properties of the human ear (the perception of sound) to achieve a size reduction by a factor of 11 with little or no perceptible loss of quality. <P> Therefore, such schemes are the key technology for high quality low bit-rate applications, like soundtracks for CD-ROM games, solid-state sound memories, Internet audio, digital audio broadcasting systems, and the like. <P> <H2><A NAME="SECTION00312000000000000000"> The two parts of audio compression</A> </H2> <P> Audio compression really consists of two parts. The first part, called <I>encoding</I>, transforms the digital audio data that resides, say, in a WAVE file, into a highly compressed form called <I>bitstream</I>. To play the bitstream on your soundcard, you need the second part, called <I>decoding</I>. Decoding takes the bitstream and re-expands it to a WAVE file. <P> The program that effects the first part is called an audio <I>encoder</I>. <i>LAME</i> is such an encoder . The program that does the second part is called an audio <I>decoder</I>. One well-known MPEG Layer III decoder is <tt>Xmms</tt>, another <TT>mpg123</TT>. Both can be found on <A NAME="tex2html1" HREF="http://www.mp3-tech.org">ww.mp3-tech.org</A> . <H2><A NAME="SECTION00313000000000000000"> Compression ratios, bitrate and quality</A> </H2> <P> It has not been explicitly mentioned up to now: What you end up with after encoding and decoding is not the same sound file anymore: All superflous information has been squeezed out, so to say. It is not the same <I>file</I>, but it will <I>sound</I> the same - more or less, depending on how much compression had been performed on it. <P> Generally speaking, the lower the compression ratio achieved, the better the sound quality will be in the end - and <I>vice versa</I>. Table <A HREF="node6.html#table-soundq">1.1</A> gives you an overview about quality achievable. <P> Because compression ratio is a somewhat unwieldy measure, experts use the term <I>bitrate</I> when speaking of the strength of compression. Bitrate denotes the average number of bits that one second of audio data will take up in your compressed bitstream. Usually the units used will be kbps, which is <SUP>kbits</SUP>/<SUB>s</SUB>, or 1000 <SUP>bits</SUP>/<SUB>s</SUB>. To calculate the number of bytes per second of audio data, simply divide the number of bits per second by eight. <P> <BR> <DIV ALIGN="CENTER"><A NAME="table-soundq"> </A> <A NAME="95"> </A> <TABLE CELLPADDING=3 BORDER="1" width="512" height="225"> <CAPTION><STRONG>Table 1.1:</STRONG> Bitrate versus sound quality</CAPTION> <TR VALIGN="TOP"> <TD ALIGN="RIGHT" nowrap width="115">Bitrate</TD> <TD ALIGN="RIGHT" nowrap width="67">Bandwidth</TD> <TD ALIGN="LEFT" nowrap width="246">Quality comparable to or better than</TD> </TR> <TR VALIGN="TOP"> <TD ALIGN="RIGHT" nowrap width="115">16 kbps</TD> <TD ALIGN="RIGHT" nowrap width="67">4.5 kHz</TD> <TD ALIGN="LEFT" nowrap width="246">shortwave radio</TD> </TR> <TR VALIGN="TOP"> <TD ALIGN="RIGHT" nowrap width="115">32 kbps</TD> <TD ALIGN="RIGHT" nowrap width="67">7.5 kHz</TD> <TD ALIGN="LEFT" nowrap width="246">AM radio</TD> </TR> <TR VALIGN="TOP"> <TD ALIGN="RIGHT" nowrap width="115">96 kbps</TD> <TD ALIGN="RIGHT" nowrap width="67">11 kHz</TD> <TD ALIGN="LEFT" nowrap width="246">FM radio</TD> </TR> <tr valign="TOP"> <td align="RIGHT" nowrap width="115">128 kbps</td> <td align="RIGHT" nowrap width="67">16 kHz</td> <td align="LEFT" nowrap width="246">near CD</td> </tr> <tr valign="TOP"> <td align="RIGHT" nowrap width="115">160-180 kbps <br> (variable bitrate)</td> <td align="RIGHT" nowrap width="67">20 kHz</td> <td align="LEFT" nowrap width="246">perceptual transparency</td> </tr> <TR VALIGN="TOP"> <TD ALIGN="RIGHT" nowrap width="115">256 kbps</TD> <TD ALIGN="RIGHT" nowrap width="67">22 kHz</TD> <TD ALIGN="LEFT" nowrap width="246">studio</TD> </TR> </TABLE> </DIV> <BR> </font> </BODY> </HTML>