/*
 *  @(#) MPEG Audio Player maplay 1.1, last edit of this file: 2/21/94 18:10:22
 *  @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
 *  @(#) Berlin University of Technology
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */


This is the README file of the MPEG Audio Player "maplay", Version 1.1.
Besides this file, you should now own a copy of the following files:

  ANNOUNCEMENT		an announcement for this program
  INSTALL		infos about compiling and installing the program
  COPYING		the GNU General Public License
  Makefile		a makefile
  configuration.sh	a shell script used from the makefile

and the source files

  all.h			maplay.c		subband_layer_1.h
  crc.c			obuffer.c		subband_layer_2.c
  crc.h			obuffer.h		subband_layer_2.h
  header.c		scalefactors.c		synthesis_filter.c
  header.h		scalefactors.h		synthesis_filter.h
  ibitstream.c		subband.h
  ibitstream.h		subband_layer_1.c


0) Introduction

MPEG is a standard created by the ISO (International Organization for
Standardization) and the IEC (International Electrotechnical Commission).
The full name of this standard is "ISO/IEC DIS 11172: Information
Technology - Coding of moving pictures and associated audio for digital
storage media ut to about 1.5 Mbit/s". As the name already states,
it deals with digital video and audio. The video part of this standard has
inspired many people to write decoders and a few encoders for it.
Best known should be the Berkeley player. Players for the audio part on
the other hand are very rare. The ones I know are the XING player for W*nd*ws
and a sample implementation of the ISO, which also includes an encoder.

The audio part of the MPEG standard specifies three layers, whereat each
layer specifies its own audio file format. All three layers are using similar
audio coding techniques, but they vary in efficiency and complexity.
Layer I needs the fewest calculation time for en-/decoding a stream, layer III
the most. But a layer I MPEG audio stream is bigger than a layer III stream
at the same quality. This program is able to decode and play only layer I
and II streams, layer III is not supported (yet?!?).

Like the MPEG video standard, the audio part also uses a lossy compression
algorithm, which means that you can't get back 100% the original from a
MPEG audio stream. Layer II MPEG audio streams are compressed by ratios
from 1:3 up to 1:24 compared to raw PCM data, like on an audio CD.
But the quality is still very (very) near to the original at ratios between
1:5 and 1:12. You will love it... :-)


1) What does the program maplay?

maplay version 1.1 is the first release of my MPEG audio player/decoder.
It decodes layer I and layer II MPEG audio streams and plays them
using a CD-quality audio device. Currently supported devices are the
dbri device of SPARC 10 computers and the audio device of Silicon
Graphics Indigo machines. But it should not be a problem to adapt
the program to other audio devices. Audio device without CD-quality
- which means no 16 Bit resolution and 32, 44.1, 48 kHz sample frequencies -
are not supported directly, but can be used with the "decode to stdout" option
and an audio format converter.

The player supports all modes, which are single channel, stereo,
joint stereo and dual channel, and all bitrates except the free mode.
The missing free mode support should not be a problem for now, because
I haven't seen such a stream by now.

Currently the program needs approximately 50% of the cpu time on SPARC 10
machines and Indigos for realtime playing of a single channel stream.
To play a strereo stream in realtime, the programm needs the whole cpu time.
I hope that I can reduce these requirements for cpu power in the next release.

Besides realtime playing of audio streams, the program can decode streams
to stdout for further conversions. The output consists of signed short PCM
values. For stereo streams, the values are interleaved, which means that
a value for the left channel is followed by a value for the right channel
and so on.


2) How to create the executable "maplay"?

Please read the file INSTALL for this topic.


3) How to start the program?

For a quick test on a SPARC 10 or Indigo, enter "./maplay -v filename", where
filename is the name of an audio stream, like "jennifer.mp2". This stream
has been posted along with the sources and is the beginning of Jennifer Rush's
wonderful song "The Power of Love". It is coded in Joint Stereo Mode with
128 kbit/s, which is a compression ratio of 1:11.

If you don't use a SPARC 10 or Indigo, you can't play the stream directly.
But if you execute "maplay -v -s filename | your_converter", you can convert
the stream into all formats that your converter supports. Unfortunately, I
can't be of much help for you to find such a program. The only good converter
I know is the "soundfiler" on Indigos. But if you have an Indigo, you don't
need an converter...


4) Command line options

maplay [-v] [-s] [-l] [-r] [-us] [-uh] [-ul] [-c] [-f ushort] filename

with:

  filename	filename of a MPEG audio stream or - for stdin
  -h		short help
  -v		verbose mode
		You will get information about the stream, like mode, bitrate,
		copyright etc., if you use this option.
  -s		stdout mode
		This option tells the program to decode the stream to stdout.
		The created output contains 16 Bit PCM samples. If the stream
		is in stereo mode, the samples of both channels are
		interleaved, the sample for the left channel first.
  -l		maplay decodes (and playes) the left channel of stereo streams
		only. This option halves the computation effort.
  -r		Same as above, but decodes the right channel only
  -us, -uh, -ul	These options are for SPARC 10 machines only currently.
		They specify where the audio signal should be send.
		"-us" means speaker, "-uh" headphone and "-ul" line out.
  -c		This option instructs the program to report filter range
		violations to stderr. Sometimes PCM values calculated by
		the synthesis filter exceede the 16 Bit boundary and must
		be mapped to these boundaries. If you can hear this, you
		may use the next option.
  -f ushort	maplay uses this scalefactor instead of the default value 32768
		for the synthesis filter. You can reduce or eliminate range
		violations with this option, but lower scalefactor values
		reduce the signal noise ratio, too. You should need thise
		option very seldom.



Enjoy MPEG audio,
bye,
     Tobias Bading  (email: bading@cs.tu-berlin.de)
