]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man4/spkr.4
This is the Linux generic soundcard driver, version 1.0c. Supports
[FreeBSD/FreeBSD.git] / share / man / man4 / spkr.4
1 .TH SPKR 4
2 .SH NAME
3 spkr \- console speaker device driver
4 .SH DESCRIPTION
5 The speaker device driver allows applications to control the PC console
6 speaker on an IBM-PC-compatible machine running UNIX.
7 .PP
8 Only one process may have this device open at any given time; open() and
9 close() are used to lock and relinquish it. An attempt to open() when
10 another process has the device locked will return -1 with an EBUSY error
11 indication. Writes to the device are interpreted as 'play strings' in a
12 simple ASCII melody notation. An ioctl() for tone generation at arbitrary
13 frequencies is also supported.
14 .PP
15 Sound-generation does \fInot\fR monopolize the processor; in fact, the driver
16 spends most of its time sleeping while the PC hardware is emitting
17 tones. Other processes may emit beeps while the driver is running.
18 .PP
19 Applications may call ioctl() on a speaker file descriptor to control the
20 speaker driver directly; definitions for the ioctl() interface are in
21 sys/spkr.h. The tone_t structure used in these calls has two fields,
22 specifying a frequency (in hz) and a duration (in 1/100ths of a second).
23 A frequency of zero is interpreted as a rest.
24 .PP
25 At present there are two such ioctls. SPKRTONE accepts a pointer to a
26 single tone structure as third argument and plays it. SPKRTUNE accepts a
27 pointer to the first of an array of tone structures and plays them in
28 continuous sequence; this array must be terminated by a final member with
29 a zero duration.
30 .PP
31 The play-string language is modelled on the PLAY statement conventions of
32 IBM BASIC 2.0. The MB, MF and X primitives of PLAY are not useful in a UNIX 
33 environment and are omitted. The `octave-tracking' feature is also new.
34 .PP
35 There are 84 accessible notes numbered 1-83 in 7 octaves, each running from
36 C to B, numbered 0-6; the scale is equal-tempered A440 and octave 3 starts
37 with middle C. By default, the play function emits half-second notes with the
38 last 1/16th second being `rest time'.
39 .PP
40 Play strings are interpreted left to right as a series of play command groups;
41 letter case is ignored. Play command groups are as follows:
42 .PP
43 CDEFGAB -- letters A through G cause the corresponding note to be played in the
44 current octave. A note letter may optionally be followed by an \fIaccidental
45 sign\fR, one of # + or -; the first two of these cause it to be sharped one
46 half-tone, the last causes it to be flatted one half-tone. It may also be
47 followed by a time value number and by sustain dots (see below). Time values
48 are interpreted as for the L command below;.
49 .PP
50 O <n> -- if <n> is numeric, this sets the current octave. <n> may also be one
51 of 'L' or 'N' to enable or disable octave-tracking (it is disabled by default).
52 When octave-tracking is on, interpretation of a pair of letter notes will
53 change octaves if necessary in order to make the smallest possible jump between
54 notes. Thus "olbc" will be played as "olb>c", and "olcb" as "olc<b". Octave
55 locking is disabled for one letter note following by >, < and O[0123456].
56 .PP
57 > -- bump the current octave up one.
58 .PP
59 < -- drop the current octave down one.
60 .PP
61 N <n> -- play note n, n being 1 to 84 or 0 for a rest of current time value.
62 May be followedv by sustain dots.
63 .PP
64 L <n> -- sets the current time value for notes. The default is L4, quarter
65 notes. The lowest possible value is 1; values up to 64 are accepted. L1 sets
66 whole notes, L2 sets half notes, L4 sets quarter notes, etc..
67 .PP
68 P <n> -- pause (rest), with <n> interpreted as for L. May be followed by
69 sustain dots. May also be written '~'.
70 .PP
71 T <n> -- Sets the number of quarter notes per minute; default is 120. Musical
72 names for common tempi are:
73
74 .TS
75 a a a.
76                 Tempo           Beats Per Minute
77 very slow       Larghissimo     
78                 Largo           40-60
79                 Larghetto       60-66
80                 Grave           
81                 Lento           
82                 Adagio          66-76
83 slow            Adagietto       
84                 Andante         76-108
85 medium          Andantino       
86                 Moderato        108-120
87 fast            Allegretto      
88                 Allegro         120-168
89                 Vivace          
90                 Veloce          
91                 Presto          168-208
92 very fast       Prestissimo     
93 .TE
94 .PP
95 M[LNS] -- set articulation. MN (N for normal) is the default; the last 1/8th of
96 the note's value is rest time. You can set ML for legato (no rest space) or
97 MS (staccato) 1/4 rest space.
98 .PP
99 Notes (that is, CDEFGAB or N command character groups) may be followed by
100 sustain dots. Each dot causes the note's value to be lengthened by one-half
101 for each one. Thus, a note dotted once is held for 3/2 of its undotted value;
102 dotted twice, it is held 9/4, and three times would give 27/8. 
103 .PP
104 Whitespace in play strings is simply skipped and may be used to separate
105 melody sections.
106 .SH BUGS
107 Due to roundoff in the pitch tables and slop in the tone-generation and timer
108 hardware (neither of which was designed for precision), neither pitch accuracy
109 nor timings will be mathematically exact. There is no volume control.
110 .PP
111 In play strings which are very long (longer than your system's physical I/O
112 blocks) note suffixes or numbers may occasionally be parsed incorrectly due
113 to crossing a block boundary.
114 .SH FILES
115 /dev/speaker -- speaker device file
116 .SH AUTHOR
117 Eric S. Raymond (esr@snark.thyrsus.com) Feb 1990