MADPLAY(1)

NAME
madplay - decode and play MPEG audio stream(s)

SYNOPSIS
madplay [options] file ...
madplay [options] -o [type:]path file ...

DESCRIPTION
madplay is a command-line front-end to the MAD library.

MAD is a high-quality MPEG audio decoder. It currently supports MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II, and Layer III a.k.a. MP3) are fully implemented.

Among the special features of MAD are 24-bit PCM resolution and 100% fixed-point (integer) computation.

MAD does not yet support MPEG-2 multichannel audio (although it should be backward compatible with such streams) nor does it currently support AAC.

By default madplay reads and decodes one or more input files containing MPEG audio data and plays them on the native audio device. If the input file is a single dash (-), data is read from standard input.

Decoded output may optionally be redirected to a file instead of being played on the audio device by using the -o (--output) option.

OPTIONS

  Verbosity

-v or --verbose
    Show information about the stream during decoding, including playing time, audio layer, bit rate, sampling frequency, and stereo mode.

-q or --quiet
    Do not show any information during decoding, except warnings.

-Q or --very-quiet
    Do not show any information during decoding, including warnings.

  Audio Output

-o or --output=[type:]path
    Direct output to path, rather than playing audio on the native audio device. The format of the output is specified by type which can be any of the supported output formats (see below.) If a format is not specified, one will be inferred from path. If path is a single dash (-), the output will be written to standard output.

-d or --no-dither
    Do not dither the output PCM samples. This may result in lower sound quality but is useful for analyzing output from the decoder.

--downsample
    Reduce the output sampling frequency 2:1. This also reduces the computational overhead of the decoder.

--fade-in[=duration]
    Gradually fade-in the audio from each file over duration. If not specified, the default duration is 0:05 (five seconds.)

-a or --attenuate=decibels or --amplify=decibels
    Attenuate or amplify the signal by decibels (dB). The signal is attenuated if the decibel value is negative; it is amplified if the value is positive. The decibel value must be in the range -175 to +18. The value may be fractional, e.g. -1.5. A value of 0 will leave the signal unchanged. Each step of 6 dB will approximately halve (in the negative direction) or double (in the positive direction) the strength of the signal.

  Channel Selection

For dual channel streams, an output channel should be selected. If one is not selected, the first (left) channel will be used.

For stereo streams, making a channel selection other than stereo will cause the output to be monaural.

-1 or --left
    Output the first (left) channel only.

-2 or --right
    Output the second (right) channel only.

-m or --mono
    Mix the left and right channels together.

-S or --stereo
    Force stereo output, even if the stream is single or dual channel.

  Playback

-s or --start=time
    Begin playing at time, given as an offset from the beginning of the first file (0:00:00), seeking as necessary.

-t or --time=duration
    Stop playback after the playing time of the output audio equals duration.

-z or --shuffle
    Randomize the list of files given on the command line for playback.

-r or --repeat[=max]
    Play the input files max times, or indefinitely. Playback can still be stopped by giving a time limit with the -t (--time) option. If -z (--shuffle) is also used, the files will be continuously shuffled and repeated in such a way that the same file is not played again until at least half of the other files have played in the interim.

  Miscellaneous

-V or --version
    Display the effective version and build options for madplay, and exit.

--license
    Display a license message and exit.

-h or --help
    Display a usage message and exit.

Output Formats
Other than playing on the native audio device, the following output formats are supported:

raw binary signed 16-bit host-endian linear PCM, stereo interleaved

wave
    Microsoft RIFF/WAVE, 16-bit PCM format (*.wav)

snd Sun/NeXT audio file format, 8-bit ISDN mu-law (*.au, *.snd)

hex hexadecimal signed 24-bit linear PCM, stereo interleaved, one sample per output line (debug builds only)

null
    no output (usually for testing or timing the decoder)

Time Specifications
For options which accept a time or duration argument, the following time specifications are recognized:

hh:mm:ss.ddd
    Hours, minutes, seconds, and decimal fractions of a second. This specification is flexible; hh:mm:ss , mmm:ss , :ss , sss.ddd , .ddd , and ssss are all acceptable. The component values are not constrained to any particular range or number of digits.

frac/unit
    A length of time specified as a rational number, in seconds. This can be used for sample-granularity, for example 32/44100 for 32 samples, assuming a 44100 Hz sample frequency.

time1+time2
    A composite time made by adding two time values together. This permits mixing the above specification forms.

The resolution of any time value cannot exceed 1/352800000 seconds.

DIAGNOSTICS

error: frame #: lost synchronization
    If encountered at the beginning of a file, this means the file contains something other than an ID3v2 tag before the MPEG audio data. If encountered in the middle of a file, it may mean the file is corrupt. This message is most commonly encountered, however, at the end of a file if the file contains an ID3v1 tag that is not aligned to an MPEG audio frame boundary. In this case, the message is harmless and may be ignored.

error: frame #: bad main_data_begin pointer
    This message can occur while decoding a Layer III stream that has been cut or spliced without preserving its bit reservoir. The affected frame cannot be properly decoded, but it will be used to help restore the bit reservoir for the next frame.

Most other messages indicate a deficiency in the input stream.

When a frame cannot be properly decoded, a concealment strategy is used as follows:

•   If the previous frame was properly decoded, it is repeated in place of the current frame.

•   If the previous frame was not properly decoded, the current frame is muted.

CONFORMING TO
MAD conforms to Part 3 of the ISO/IEC 11172 (MPEG-1) international standard for decoding MPEG audio. In addition, MAD supports the extension to Lower Sampling Frequencies (LSF) as defined in Part 3 of ISO/IEC 13818 (MPEG-2).

The output from MAD has been tested and found to satisfy the ISO/IEC 11172-4 computational accuracy requirements for compliance. In most configurations, MAD is a Full Layer III ISO/IEC 11172-3 audio decoder as defined by the standard.

NOTES
Because MAD produces output samples with a precision greater than 24 bits, by default madplay will dither the output to the necessary number of bits, usually 16. This produces high quality audio that generally sounds superior to the output of a simple rounding algorithm. However, dithering may unfavorably affect an analytic examination of the output, and therefore it may be disabled by using the -d (--no-dither) option.

MAD is implemented entirely without the use of floating point arithmetic and should therefore perform well on all architectures, especially those without an FPU.

BUGS
Granularity of start and stop times (--start and --time) is not yet as fine as this specification suggests.

AUTHOR
Robert Leslie <rob@mars.org>

SEE ALSO
ISO/IEC 11172-3, ISO/IEC 13818-3; tests for compliance are defined in ISO/IEC 11172-4 and ISO/IEC 13818-4.