1
This is a buffered audio player for Linux. POSIX-thread library is
2
used. This is still considered BETA software and may not work as
3
expected. Please mail me for bug reports, opinions or suggestions.
5
This is primarily made for use with MPEG-decoders. They typically
6
consume lots of CPU-time and some kind of audio buffer is needed to
7
reduce cutting while writing to audio device. You can also play any
8
audio files with tplay or use it with any program that writes audio
11
RIFF/WAVE (WAV) and Sun audio (AU) file headers are recognized by
16
In the source tree there is a readily compiled binary that is build
17
under Linux/ELF 2.0.30 with libc 5.4.20 and LinuxThreads 0.6 (the
18
thread library is statically linked).
22
tplay [-hvVmuxrf] [-s Hz] [-b 8|16] [-B kilobytes] [filename]
24
-h, --help Print help, then exit
25
-v, --version Print version, then exit
26
-V, --verbose Print useful information about the sample
27
-x, --swap Swap endianness
28
-r, --raw Force raw audio format. Ignore headers.
29
-f, --force Force playing with any parameters
30
-m, --mono Mono sample
31
-u, --usage Print buffer usage while playing
32
-s, --speed=SPEED Sample speed (Hz)
33
-b, --bytes=BYTES Bytes in a sample
34
-B, --buffer-size=SIZE Buffer size in (kB)
36
Buffer size is defaulted to 512k. It is about 3 seconds CD audio
37
(44100Hz/sample, 16bytes, stereo). If filename is not given, standard
38
input is used. If -x (or --swap) flag is set, the byte order of
39
audio sample is swapped before playing. The default is Intel little-
40
endian which is mostly used in x86 machines. The world outside Intel
42
Option -r (or --raw) forces tplay to handle the sample as an raw
43
PCM audio sample. Sun audio or WAV headers are ignored.
47
- Linux 2.0 or newer with audio card support
48
- POSIX thread library
51
There are several POSIX thread libraries available. I used
52
LinuxThreads by Xavier Leroy (Xavier.Leroy@inria.fr). LinuxThreads
53
library use clone() that is provided by Linux 2.0 kernel.
57
tplay starts one thread, named consumer, that reads circular audio
58
buffer and writes it to audio device. The producer is a function that
59
runs in parallel with the consumer and its task is to read the sample
60
file or standard input and write this data to audio buffer to meet
61
consumer's needs. Usually, the buffer is full but on the times when
62
CPU-time is suddenly needed for other processes (usually: disk
63
read/write), the producer can't write fast enough and consumer can use
64
the buffer to keep audio stream uninterrupted. If the buffer is used
65
and the producer is still unable to feed it fast enough, underflow
66
situation is met and consumer waits for awhile (typically: one second)
67
for the producer to fill the buffer again.
71
If you want to link tplay with static libpthread library, edit
72
Makefile and uncomment preferred LIBS-setting there. Type:
80
Jerko Golubovic <jerko.golubovic@public.srce.hr>
81
Jukka Palviainen <oh3kjt@ele.tut.fi>
85
Find out the best sizes for the audio buffer and one block.
87
Better RIFF/WAVE checking.