Basics

Samplerate

Sample rate is the rate at which the samples are read from your sound card when you sample. Sample rate is directly linked to audio bandwidth achievable: A sound file with a sample rate of 8 kHz does not contain frequencies beyond 4 kHz. This means that you should always use the highest sample rate that your sound card supports when you sample a signal.

Bitrate

The main parameter controlling the sound quality is the bitrate that the encoder runs at. In a nutshell, the higher the bitrate, the better the quality.

The bitrate of the bitstream output is selected via the -b switch. The bitrate is specified in bits/second. The bitrate is the total bitrate for all encoded channels, i.e. if you select -b 128000 and encode in stereo, both channels will be stuffed into one bitstream of 128000 bits/second.

The encoder supports bitrates of 32, 40, 48, 56, 64, 96, 112, 128, 160, 192, 224, 256 and 320 kBit/s.

Stereo mode

 
 stereo
In this mode, the encoder makes no use of potentially existing correlations between the two input channels. It can, however, negotiate the bit demand between both channel, i.e. give one channel more bits if the other contains silence.

 joint stereo
In this mode, the encoder will make use of a correlation between both channels. The signal will be matrixed into a sum ("mid") and difference ("side") signal. For quasi-mono signals, this will give a significant gain in encoding quality.

This mode does not destroy phase information like IS stereo that may be used by other encoders and thus can be used to encode DOLBY ProLogic surround signals.


 force joint stereo
This mode will force MS joint stereo on all frames. It's faster and it uses some special mid & side masking threshold.
 
 mono
The input will be encoded as a mono signal. If it was a stereo signal, it will be downsampled to mono.

Encoding speed

Several factors influence the speed of the encoder. They include:

Version V3.04 of the encoder reaches realtime speed on a Pentium 166 when encoding at 64 kBit/s, 22,050 kHz, stereo. On a SUN Sparc Ultra-1 (143 MHz) the performance is similar.

Input file specification

The encoder can read AIFF, AIFF-C, WAV/RIFF, and raw PCM data files. While the first three only work from a file, plain PCM data can be fed into the encoder via a pipe. This is useful for live encoding (also known as streaming).

Input from file: filename

filename
will tell the encoder the filename it reads it input from. If the file is a RIFF/WAVE, or an AIFF/AIFC file, the encoder will automatically adapt to the sound file format. For other formats or plain PCM data, see below.

Piping data into the encoder

-
tells the encoder to get its input from stdin rather than from a file. This only works when the input is plain pcm data (see below).

plain PCM data input

If the encoder gets its input as plain pcm data (or if it does not recognize the sound format by itself), you need to tell it all about the structure of the PCM stream, i.e. the samplerate.
-s  samplerate
The sample rate in the input file. The default is 44.1 kHz.
-x 
The input file is endian inversed compared to your platform.
For stereo files, the encoder assumes that the PCM data is interleaved and that the sample for the right channel follows that for the left channel.

As an example, -s 22050 would be used to read a 22.05 kHz.

Remember that this feature is only needed for input from files other than RIFF/WAV, AIFF and AIFC.

Output file specification

The output is a plain Layer-3 stream wich can be piped into other applications. This is useful for live streaming.

filename
tells the encoder the filename of the file that the encoder will write the bitstream to. If the file does not exist, it is created; if it does exist, it will be overwritten.

Streaming data out of the encoder

- 
tells the encoder to write its output into stdout rather than in a file.