lps(1)

NAME
lps - play long samples

SYNOPSIS
lps [-VQqausUbwimfe] [-n [rate]]
    [-c channels] [-r rate] [-v volume]
    file [file [...]]

DESCRIPTION
Play sound files with unlimited length by loading parts of it while continiously playing the sample. Can handle files with a sampling precision of 8 or 16-bit on 1 or 2 channels. Due to the sound hardware of the Atari ST replaying is always 8-bit on 1 channel. lps has the ability to recognize unsigned linear, signed linear or logarithmic coded samples. For replaying a sound file you need a fast device (for example a harddisk or a ramdisk). Floppy-disks are to slow!

SUPPORTED FORMATS
Interchange File Format 8SVX by Electronic Arts (*.iff/*.svx)
Audio format by NeXT and Sun (*.snd/*.au)
Audio format by Audio-Visual-Research (*.avr)
Resource Interchange File Format by Microsoft (*.wav)
Creative Voice file format by Creative Labs (*.voc)
HSND-format introduced by Maxon's CrazySounds (*.hsn)
Audio format used by Sound Machine (*.sam)
    If you want to play one of the formats above, simply put the filename (with its extension) to the argument. No options need to be set. All parameters are taken from the header of the formated file. Options, normaly changing the sound type are ignored. Only the -V, -Q, -n, -q, -v, -f, -e options are noticed.

raw data or unknown formats
    First let me explain, why an unknown formated file can be played. Many formats store the sampled data in a single block using signed, unsigned or U-law encoding. The header information used by the format is very small, compared with the sound data, so we play the whole file decoding it with one of the three sample types. The information in the header is interpreted as normal sound data.
    As we have no header information how to handle the raw sound file all the parameters have to be filled by the user (see OPTIONS). Options not set in the command line are filled with default values. The default settings are 8012 Hz, 8-bit, 1 channel (mono), the byteorder is motorola. If the sample type is unknown an algorithm is used by default to find out. But note, the algorithm needs three things to work correctly: the sample precision (-b/-w), the used byteorder (-m/-i) and time! In general the encoding scheme for raw sound files on the Atari ST is unsigned linear (-u).

COMMANDS
To abort replay without MiNT, simply press any key; running MiNT with or without MultiTOS use ^C (Control+C) or the shell command:

OPTIONS
-V
    Shows the version number, date and time of creation and the name of the author (wow, that's me!). Also details on processing the sound file are displayed. This includes some technical information taken from the file's header, the requested memory, further more the setting of the MFP's timer registers and the resulting replay rate. This option cancels an older -Q option.

-Q (set by default)
    No informations are printed to stdout, except error messages. This option cancels an older -V option.

-n [rate]
    Forces lps to play only every second sample, while using half the sampling rate. This reduces the quality, but saves processor time. For good results try this on speech. If you set the optional parameter rate only sound files with a sampling rate higher the one you set are concerned by this function. This option cancels an older -q option.

-q (set by default)
    Use the full quality to replay a sound file. This option cancels an older -n option.

-r rate (set by default to 8012 Hz)
    Sets the rate for playing a raw or unknown sound file. You can not change the rate of a formated sound file. rate can range from 96 Hz up to 65535 Hz. This is only a theoretical value! I did not want to set any limit. Typical results are: 8 MHz ST with RLL-harddisk up to 16 kHz; 16 MHz Mega STe with AT-Bus-harddisk up to 27 kHz. This option cancels older rate settings.

-v volume (set by default to 1000)
    This changes the amplitude. A value less than 1000 decreases, one greater 1000 increases the amplitude. volume is limited from 0 to 32767. Note: we perceive volume logarithmically, not linearly. The "Volume Adjustment" field shown by sox using the stat effect gives you the argument (divded by 1000) which makes the sample as loud as possible.

-c channels (set by default to 1 channel / mono)
    Sets the number of channels used in the sound. channels can be set to 1 for mono or 2 for stereo. You can not change this for a formated sound file. Remember: This is only to interprete raw files the right way. Replaying is always on 1 channel! This option cancels older channel settings.

-a (set by default)
    Sets the sample type automaticly by running an algorithm which scans the entire sound file. The algorithm has to know the correct sampling precision (-b/-w) and the used byteorder (-m/-i) to calculate the right sample type. If you set the verbose option (-V), the current percentage of the scanned part in relation to the whole file is displayed. Use the proposed type, if you plan to play it again. You can only use this option on an unformated sound file. This option cancels older -s, -u and -U options.

-u
    Sets the sample type to unsigned linear. You can only change the sample type of an unformated sound file. This option cancels older -s, -a and -U options.

-s
    Sets the sample type to signed linear. You can only change the sample type of an unformated sound file. This option cancels older -u, -a and -U options.

-U
    Sets the sample type to U-law. You can only change the sample type of an unformated sound file. This option cancels older -s, -a and -u options.

-b (set by default)
    Forces lps to set the sampling precision of a headerless sound file to 8-bit (byte). You can only change the precision of an unformated sound file. This option cancels an older -w option.

-w
    Forces lps to set the sampling precision of a headerless sound file to 16-bit (word). You can only change the precision of an unformated sound file. Remember: This is only to interprete raw files the right way. Replaying is always 8-bit! This option cancels an older -b option.

-m (set by default)
    This option tells the program to handle the byteorder of 16-bit samples in a raw sound file the way the motorola processors (and others) do - first the most significant byte followed by the least significant byte. There is no effect if you combine the 8-bit precision option (-b) with this option. You can only change the byteorder of an unformated sound file. This option cancels an older -i option.

-i
    This option tells the program to handle the byteorder of 16-bit samples in a raw sound file the way the intel processors do - first the least significant byte followed by the most significant byte. There is no effect if you combine the 8-bit precision option (-b) with this option. You can only change the byteorder of an unformated sound file. This option cancels an older -m option.

-f
    If you want to play a file with a corrupted header, lps normally prints an error message and terminates. If this option is found, the informations in the header are fully ignored. The sound file is played in raw mode. However, now you have to set the rate, the sampling type and all this stuff on your own. This option cancels an older -e option.

-e (set by default)
    If this option is set, a known format is interpreted automatically. All informations about the data in the sound file are taken from the header within the file. The known formats are specified above. If the format is unknown, the sound is played according to your settings. This option cancels an older -f option.

ENVIRONMENT
ARGV
    ARGV-protocol supported. The protocol was set because of the limited TOS command line (a maximum length of 127 chars). If your shell gives the command line to the ARGV variable, all chains are broken, in any other case accept the limit of TOS. You can't set this variable of your own!

LPS
    The variable is used for a global command line, that is observed every time you start the sound player. It will work the same way, the normal command line does. You can specify every option and any soundfiles to be played before any other. The options from the local command line overwrite the global ones! I set this variable to '-Vn16500'.

NOTES
Supports TOS, MiNT and MultiTOS.

Tested with TOS 1.4, TOS 2.5, MiNT 0.95, MiNT 1.04, MiNT 1.08, MiNT 1.09, MultiTOS based on MiNT 1.04, MiNT 1.08 and MiNT 1.09 on my Atari ST, an Atari STe, an Atari Mega STe and on a Falcon 030. Also tested with the Gemini-shell Mupfel.

Full assembler source.

The actual frequency used to play the sound is as close as absolutely possible. Sound output takes place in MFP's timer-a interrupt, using a ringbuffer with eight 1024 byte buffers. Replaying and reloading is synchronized by semaphores.

The arguments -V, -s, -u, -U, -b, -w, -c, -r and -v have the same intension as they have in sox (Note: the argument of -v has to be multiplied with 1000).

If you have an account on a host connected to the internet, try

And always remember: Peak performance is the performance, the manufacturer garantees! Especially running lps with MiNT!

BUGS
The maximum rate of replaying depends on the processor's heartbeat rate, the type of 680xx you use and on the transfer rate of your harddisk. My system can play (not using the nice-option, running with TOS) sounds up to about 16 KHz with the correct speed. Using a higher rate makes lps stammer. See -n option for help!

COPYRIGHT
This program is in the Public Domain. Do anything with it - but any trouble you cause (including, but not limited to keeping the household awake) is your own resposibility.

THANKS TO
Guido van Rossum (guido@cwi.nl)
    for the posting of FAQs concerning audio file formats
once more Guido van Rossum
    for his posting in alt.binaries.sounds.d : Program to classify headerless sound files
Brian Foley (bfoley@greatlakes.central.sun.com)
    for posting details about U-law
Peter Veith (Peter_Veith@bn.maus.de)
    for helping with the HSND format
Christen Bach (bach@satan.vmsmail.ethz.ch)
    for sending me a patch to let lps work on a Falcon 030
Christian Ernst (cnernst@cip.informatik.uni-erlangen.de)
    for beta-testing

AUTHOR
Uwe Reder (uereder@cip.informatik.uni-erlangen.de)