Eliminate references to the ``U word'' and make page conform to Berkeley

conventions for formatting.  (Print it out on a PostScript printer
to see the difference.)
This commit is contained in:
Garrett Wollman 1994-02-03 07:32:01 +00:00
parent 36ae463bf0
commit fa93649905
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1079
2 changed files with 318 additions and 154 deletions

View File

@ -1,83 +1,141 @@
.Dd November 7, 1993
.TH SPKR 4
.Dt SPKR 4
.Os FreeBSD
.SH NAME
.Sh NAME
.Nm spkr
.Nd console speaker device driver
.SH DESCRIPTION
.Sh SYNOPSIS
.Cd psuedo-device speaker
.Fd #include <machine/speaker.h>
.Sh DESCRIPTION
The speaker device driver allows applications to control the PC console
speaker on an IBM-PC-compatible machine running UNIX.
.PP
Only one process may have this device open at any given time; open() and
close() are used to lock and relinquish it. An attempt to open() when
another process has the device locked will return -1 with an EBUSY error
indication. Writes to the device are interpreted as 'play strings' in a
simple ASCII melody notation. An ioctl() for tone generation at arbitrary
speaker on an
.Tn IBM-PC Ns --compatible
machine running FreeBSD.
.Pp
Only one process may have this device open at any given time;
.Xr open 2
and
.Xr close 2
are used to lock and relinquish it. An attempt to open when
another process has the device locked will return -1 with an
.Er EBUSY
error
indication. Writes to the device are interpreted as `play strings' in a
simple ASCII melody notation. An
.Xr ioctl 2
request
for tone generation at arbitrary
frequencies is also supported.
.PP
Sound-generation does \fInot\fR monopolize the processor; in fact, the driver
.Pp
Sound-generation does not monopolize the processor; in fact, the driver
spends most of its time sleeping while the PC hardware is emitting
tones. Other processes may emit beeps while the driver is running.
.PP
Applications may call ioctl() on a speaker file descriptor to control the
speaker driver directly; definitions for the ioctl() interface are in
machine/speaker.h. The tone_t structure used in these calls has two fields,
specifying a frequency (in hz) and a duration (in 1/100ths of a second).
.Pp
Applications may call
.Xr ioctl 2
on a speaker file descriptor to control the
speaker driver directly; definitions for the
.Xr ioctl 2
interface are in
.Pa /usr/include/machine/speaker.h .
The
.Li tone_t
structure used in these calls has two fields,
specifying a frequency (in Hz) and a duration (in 1/100ths of a second).
A frequency of zero is interpreted as a rest.
.PP
At present there are two such ioctls. SPKRTONE accepts a pointer to a
single tone structure as third argument and plays it. SPKRTUNE accepts a
.Pp
At present there are two such
.Xr ioctl 2
calls.
.Dv SPKRTONE
accepts a pointer to a
single tone structure as third argument and plays it.
.Dv SPKRTUNE
accepts a
pointer to the first of an array of tone structures and plays them in
continuous sequence; this array must be terminated by a final member with
a zero duration.
.PP
.Pp
The play-string language is modelled on the PLAY statement conventions of
IBM BASIC 2.0. The MB, MF and X primitives of PLAY are not useful in a UNIX
environment and are omitted. The `octave-tracking' feature and the slur
mark are new.
.PP
.Tn IBM
Advanced BASIC 2.0. The
.Li MB ,
.Li MF ,
and
.Li X
primitives of PLAY are not
useful in a timesharing environment and are omitted. The `octave-tracking'
feature and the slur mark are new.
.Pp
There are 84 accessible notes numbered 1-83 in 7 octaves, each running from
C to B, numbered 0-6; the scale is equal-tempered A440 and octave 3 starts
with middle C. By default, the play function emits half-second notes with the
with middle C. By default, the play function emits half-second notes with the
last 1/16th second being `rest time'.
.PP
.Pp
Play strings are interpreted left to right as a series of play command groups;
letter case is ignored. Play command groups are as follows:
.PP
CDEFGAB -- letters A through G cause the corresponding note to be played in the
current octave. A note letter may optionally be followed by an \fIaccidental
sign\fR, one of # + or -; the first two of these cause it to be sharped one
half-tone, the last causes it to be flatted one half-tone. It may also be
followed by a time value number and by sustain dots (see below). Time values
are interpreted as for the L command below.
.PP
O <n> -- if <n> is numeric, this sets the current octave. <n> may also be one
of 'L' or 'N' to enable or disable octave-tracking (it is disabled by default).
When octave-tracking is on, interpretation of a pair of letter notes will
change octaves if necessary in order to make the smallest possible jump between
notes. Thus "olbc" will be played as "olb>c", and "olcb" as "olc<b". Octave
locking is disabled for one letter note following >, < and O[0123456].
(The octave-locking feature is not supported in Microsoft Basic.)
.PP
> -- bump the current octave up one.
.PP
< -- drop the current octave down one.
.PP
N <n> -- play note n, n being 1 to 84 or 0 for a rest of current time value.
.Bl -tag -width CDEFGABxx
.It Li CDEFGAB
Letters A through G cause the corresponding note to be played in the
current octave. A note letter may optionally be followed by an
.Dq Em "accidental sign" ,
one of # + or -; the first two of these cause it to be sharped one
half-tone, the last causes it to be flatted one half-tone. It may
also be followed by a time value number and by sustain dots (see
below). Time values are interpreted as for the L command below.
.It Ns Li O Sy n
If
.Sy n
is numeric, this sets the current octave.
.Sy n
may also be one of
.Li L
or
.Li N
to enable or disable octave-tracking (it is disabled by default).
When octave-tracking is on, interpretation of a pair of letter notes
will change octaves if necessary in order to make the smallest
possible jump between notes. Thus ``olbc'' will be played as
``olb>c'', and ``olcb'' as ``olc<b''. Octave locking is disabled for
one letter note following >, < and O[0123456]. (The octave-locking
feature is not supported in
.Tn IBM
BASIC.)
.It Li >
Bump the current octave up one.
.It Li <
Drop the current octave down one.
.It Ns Li N Sy n
Play note
.Sy n ,
.Sy n
being 1 to 84 or 0 for a rest of current time value.
May be followed by sustain dots.
.PP
L <n> -- sets the current time value for notes. The default is L4, quarter or
crotchet notes. The lowest possible value is 1; values up to 64 are accepted.
L1 sets whole notes, L2 sets half notes, L4 sets quarter notes, etc..
.PP
P <n> -- pause (rest), with <n> interpreted as for L. May be followed by
sustain dots. May also be written '~'.
.PP
T <n> -- Sets the number of quarter notes per minute; default is 120. Musical
.It Ns Li L Sy n
Sets the current time value for notes. The default is
.Li L4 ,
quarter or crotchet notes. The lowest possible value is 1; values up
to 64 are accepted.
.Li L1
sets whole notes,
.Li L2
sets half notes,
.Li L4
sets quarter notes, etc.
.It Ns Li P Sy n
Pause (rest), with
.Sy n
interpreted as for
.Ns Li L Sy n .
May be followed by
sustain dots. May also be written
.Li ~ .
.It Ns Li T Sy n
Sets the number of quarter notes per minute; default is 120. Musical
names for common tempi are:
.TS
a a a.
.Bd -literal -offset indent
Tempo Beats Per Minute
very slow Larghissimo
Largo 40-60
@ -95,41 +153,65 @@ fast Allegretto
Veloce
Presto 168-208
very fast Prestissimo
.TE
.PP
M[LNS] -- set articulation. MN (N for normal) is the default; the last 1/8th of
the note's value is rest time. You can set ML for legato (no rest space) or
MS (staccato) 1/4 rest space.
.PP
Notes (that is, CDEFGAB or N command character groups) may be followed by
.Ed
.It Li M[LNS]
Set articulation.
.Li MN
.Ns No ( Li N
for normal) is the default; the last 1/8th of
the note's value is rest time. You can set
.Li ML
for legato (no rest space) or
.Li MS
for staccato (1/4 rest space).
.El
.Pp
Notes (that is,
.Li CDEFGAB
or
.Li N
command character groups) may be followed by
sustain dots. Each dot causes the note's value to be lengthened by one-half
for each one. Thus, a note dotted once is held for 3/2 of its undotted value;
dotted twice, it is held 9/4, and three times would give 27/8.
.PP
.Pp
A note and its sustain dots may also be followed by a slur mark (underscore).
This causes the normal micro-rest after the note to be filled in, slurring it
to the next one. (The slur feature is not supported in Microsoft Basic.)
.PP
to the next one. (The slur feature is not supported in
.Tn IBM
BASIC.)
.Pp
Whitespace in play strings is simply skipped and may be used to separate
melody sections.
.SH BUGS
.Sh BUGS
Due to roundoff in the pitch tables and slop in the tone-generation and timer
hardware (neither of which was designed for precision), neither pitch accuracy
nor timings will be mathematically exact. There is no volume control.
.PP
.Pp
The action of two or more sustain dots does not reflect standard musical
notation, in which each dot adds half the value of the previous dot
modifier, not half the value of the note as modified. Thus, a note dotted
once is held for 3/2 of its undotted value; dotted twice, it is held 7/4,
and three times would give 15/8. The multiply-by-3/2 interpretation,
however, is specified in the IBM BASIC manual and has been retained for
however, is specified in the
.Tn IBM
BASIC manual and has been retained for
compatibility.
.PP
.Pp
In play strings which are very long (longer than your system's physical I/O
blocks) note suffixes or numbers may occasionally be parsed incorrectly due
to crossing a block boundary.
.SH FILES
/dev/speaker -- speaker device file
.SH AUTHOR
.Sh FILES
.Bl -tag -width /dev/speakerxx
.It Pa /dev/speaker
speaker device file
.El
.Sh AUTHOR
Eric S. Raymond <esr@snark.thyrsus.com) June 1990
FreeBSD port -- Andrew A. Chernov <ache@astral.msk.su>
.Sh "PORTED BY"
Andrew A. Chernov <ache@astral.msk.su>
.Sh HISTORY
The
.Nm
device appeared in
.Fx 1.0 .

View File

@ -1,83 +1,141 @@
.Dd November 7, 1993
.TH SPKR 4
.Dt SPKR 4
.Os FreeBSD
.SH NAME
.Sh NAME
.Nm spkr
.Nd console speaker device driver
.SH DESCRIPTION
.Sh SYNOPSIS
.Cd psuedo-device speaker
.Fd #include <machine/speaker.h>
.Sh DESCRIPTION
The speaker device driver allows applications to control the PC console
speaker on an IBM-PC-compatible machine running UNIX.
.PP
Only one process may have this device open at any given time; open() and
close() are used to lock and relinquish it. An attempt to open() when
another process has the device locked will return -1 with an EBUSY error
indication. Writes to the device are interpreted as 'play strings' in a
simple ASCII melody notation. An ioctl() for tone generation at arbitrary
speaker on an
.Tn IBM-PC Ns --compatible
machine running FreeBSD.
.Pp
Only one process may have this device open at any given time;
.Xr open 2
and
.Xr close 2
are used to lock and relinquish it. An attempt to open when
another process has the device locked will return -1 with an
.Er EBUSY
error
indication. Writes to the device are interpreted as `play strings' in a
simple ASCII melody notation. An
.Xr ioctl 2
request
for tone generation at arbitrary
frequencies is also supported.
.PP
Sound-generation does \fInot\fR monopolize the processor; in fact, the driver
.Pp
Sound-generation does not monopolize the processor; in fact, the driver
spends most of its time sleeping while the PC hardware is emitting
tones. Other processes may emit beeps while the driver is running.
.PP
Applications may call ioctl() on a speaker file descriptor to control the
speaker driver directly; definitions for the ioctl() interface are in
machine/speaker.h. The tone_t structure used in these calls has two fields,
specifying a frequency (in hz) and a duration (in 1/100ths of a second).
.Pp
Applications may call
.Xr ioctl 2
on a speaker file descriptor to control the
speaker driver directly; definitions for the
.Xr ioctl 2
interface are in
.Pa /usr/include/machine/speaker.h .
The
.Li tone_t
structure used in these calls has two fields,
specifying a frequency (in Hz) and a duration (in 1/100ths of a second).
A frequency of zero is interpreted as a rest.
.PP
At present there are two such ioctls. SPKRTONE accepts a pointer to a
single tone structure as third argument and plays it. SPKRTUNE accepts a
.Pp
At present there are two such
.Xr ioctl 2
calls.
.Dv SPKRTONE
accepts a pointer to a
single tone structure as third argument and plays it.
.Dv SPKRTUNE
accepts a
pointer to the first of an array of tone structures and plays them in
continuous sequence; this array must be terminated by a final member with
a zero duration.
.PP
.Pp
The play-string language is modelled on the PLAY statement conventions of
IBM BASIC 2.0. The MB, MF and X primitives of PLAY are not useful in a UNIX
environment and are omitted. The `octave-tracking' feature and the slur
mark are new.
.PP
.Tn IBM
Advanced BASIC 2.0. The
.Li MB ,
.Li MF ,
and
.Li X
primitives of PLAY are not
useful in a timesharing environment and are omitted. The `octave-tracking'
feature and the slur mark are new.
.Pp
There are 84 accessible notes numbered 1-83 in 7 octaves, each running from
C to B, numbered 0-6; the scale is equal-tempered A440 and octave 3 starts
with middle C. By default, the play function emits half-second notes with the
with middle C. By default, the play function emits half-second notes with the
last 1/16th second being `rest time'.
.PP
.Pp
Play strings are interpreted left to right as a series of play command groups;
letter case is ignored. Play command groups are as follows:
.PP
CDEFGAB -- letters A through G cause the corresponding note to be played in the
current octave. A note letter may optionally be followed by an \fIaccidental
sign\fR, one of # + or -; the first two of these cause it to be sharped one
half-tone, the last causes it to be flatted one half-tone. It may also be
followed by a time value number and by sustain dots (see below). Time values
are interpreted as for the L command below.
.PP
O <n> -- if <n> is numeric, this sets the current octave. <n> may also be one
of 'L' or 'N' to enable or disable octave-tracking (it is disabled by default).
When octave-tracking is on, interpretation of a pair of letter notes will
change octaves if necessary in order to make the smallest possible jump between
notes. Thus "olbc" will be played as "olb>c", and "olcb" as "olc<b". Octave
locking is disabled for one letter note following >, < and O[0123456].
(The octave-locking feature is not supported in Microsoft Basic.)
.PP
> -- bump the current octave up one.
.PP
< -- drop the current octave down one.
.PP
N <n> -- play note n, n being 1 to 84 or 0 for a rest of current time value.
.Bl -tag -width CDEFGABxx
.It Li CDEFGAB
Letters A through G cause the corresponding note to be played in the
current octave. A note letter may optionally be followed by an
.Dq Em "accidental sign" ,
one of # + or -; the first two of these cause it to be sharped one
half-tone, the last causes it to be flatted one half-tone. It may
also be followed by a time value number and by sustain dots (see
below). Time values are interpreted as for the L command below.
.It Ns Li O Sy n
If
.Sy n
is numeric, this sets the current octave.
.Sy n
may also be one of
.Li L
or
.Li N
to enable or disable octave-tracking (it is disabled by default).
When octave-tracking is on, interpretation of a pair of letter notes
will change octaves if necessary in order to make the smallest
possible jump between notes. Thus ``olbc'' will be played as
``olb>c'', and ``olcb'' as ``olc<b''. Octave locking is disabled for
one letter note following >, < and O[0123456]. (The octave-locking
feature is not supported in
.Tn IBM
BASIC.)
.It Li >
Bump the current octave up one.
.It Li <
Drop the current octave down one.
.It Ns Li N Sy n
Play note
.Sy n ,
.Sy n
being 1 to 84 or 0 for a rest of current time value.
May be followed by sustain dots.
.PP
L <n> -- sets the current time value for notes. The default is L4, quarter or
crotchet notes. The lowest possible value is 1; values up to 64 are accepted.
L1 sets whole notes, L2 sets half notes, L4 sets quarter notes, etc..
.PP
P <n> -- pause (rest), with <n> interpreted as for L. May be followed by
sustain dots. May also be written '~'.
.PP
T <n> -- Sets the number of quarter notes per minute; default is 120. Musical
.It Ns Li L Sy n
Sets the current time value for notes. The default is
.Li L4 ,
quarter or crotchet notes. The lowest possible value is 1; values up
to 64 are accepted.
.Li L1
sets whole notes,
.Li L2
sets half notes,
.Li L4
sets quarter notes, etc.
.It Ns Li P Sy n
Pause (rest), with
.Sy n
interpreted as for
.Ns Li L Sy n .
May be followed by
sustain dots. May also be written
.Li ~ .
.It Ns Li T Sy n
Sets the number of quarter notes per minute; default is 120. Musical
names for common tempi are:
.TS
a a a.
.Bd -literal -offset indent
Tempo Beats Per Minute
very slow Larghissimo
Largo 40-60
@ -95,41 +153,65 @@ fast Allegretto
Veloce
Presto 168-208
very fast Prestissimo
.TE
.PP
M[LNS] -- set articulation. MN (N for normal) is the default; the last 1/8th of
the note's value is rest time. You can set ML for legato (no rest space) or
MS (staccato) 1/4 rest space.
.PP
Notes (that is, CDEFGAB or N command character groups) may be followed by
.Ed
.It Li M[LNS]
Set articulation.
.Li MN
.Ns No ( Li N
for normal) is the default; the last 1/8th of
the note's value is rest time. You can set
.Li ML
for legato (no rest space) or
.Li MS
for staccato (1/4 rest space).
.El
.Pp
Notes (that is,
.Li CDEFGAB
or
.Li N
command character groups) may be followed by
sustain dots. Each dot causes the note's value to be lengthened by one-half
for each one. Thus, a note dotted once is held for 3/2 of its undotted value;
dotted twice, it is held 9/4, and three times would give 27/8.
.PP
.Pp
A note and its sustain dots may also be followed by a slur mark (underscore).
This causes the normal micro-rest after the note to be filled in, slurring it
to the next one. (The slur feature is not supported in Microsoft Basic.)
.PP
to the next one. (The slur feature is not supported in
.Tn IBM
BASIC.)
.Pp
Whitespace in play strings is simply skipped and may be used to separate
melody sections.
.SH BUGS
.Sh BUGS
Due to roundoff in the pitch tables and slop in the tone-generation and timer
hardware (neither of which was designed for precision), neither pitch accuracy
nor timings will be mathematically exact. There is no volume control.
.PP
.Pp
The action of two or more sustain dots does not reflect standard musical
notation, in which each dot adds half the value of the previous dot
modifier, not half the value of the note as modified. Thus, a note dotted
once is held for 3/2 of its undotted value; dotted twice, it is held 7/4,
and three times would give 15/8. The multiply-by-3/2 interpretation,
however, is specified in the IBM BASIC manual and has been retained for
however, is specified in the
.Tn IBM
BASIC manual and has been retained for
compatibility.
.PP
.Pp
In play strings which are very long (longer than your system's physical I/O
blocks) note suffixes or numbers may occasionally be parsed incorrectly due
to crossing a block boundary.
.SH FILES
/dev/speaker -- speaker device file
.SH AUTHOR
.Sh FILES
.Bl -tag -width /dev/speakerxx
.It Pa /dev/speaker
speaker device file
.El
.Sh AUTHOR
Eric S. Raymond <esr@snark.thyrsus.com) June 1990
FreeBSD port -- Andrew A. Chernov <ache@astral.msk.su>
.Sh "PORTED BY"
Andrew A. Chernov <ache@astral.msk.su>
.Sh HISTORY
The
.Nm
device appeared in
.Fx 1.0 .