.TH bsvplay 1 "2008-02-06" "hxtools" "hxtools"
.SH Name
bsvplay \(em convert BASICA music data to PCM
.SH Syntax
\fBbsvplay\fP [\fB\-i\fP \fIpart\fP] [\fB\-q\fP \fIpart\fP] [\fB\-r\fP
\fIrate\fP] [\fIfile\fP...] \fB| aplay \-f dat \-c 1\fP
.SH Description
bsvplay will convert BASICA binary music data to linear 16-bit raw PCM.
Normally, you will be wanting to pipe it into a raw PCM player like
\fBaplay\fP(1) to actually output it to a sound device. Consider lowring the
system volume beforehand to avoid surprise loud output. Square waves contain
odd harmonics and the total power is ~57% higher (1.95 dB). By default, bsvplay
mix a square wave rendition with a sine wave rendition 1:1 to reduce the effect
of odd harmonics and reduce the power.
.PP
Do note that the music data is embedded in BSV/EXE/COM files and needs to
be manually located. It is usually very evident from a regular pattern in
hexdumps.
.SH Options
.TP
\fB\-q\fP \fIpart\fP
Part to mix square waves in (default: 1.0)
.TP
\fB\-i\fP \fIpart\fP
Part to mix sine waves in (default: 1.0). If \fB\-q2 \-i1\fP
is specified for example,
the final PCM output will consist of 2/3*squarepcm + 1/3*sinpcm.
.TP
\fB\-r\fP \fIrate\fP
PCM sample rate (default: 48000 Hz)
.TP
\fB\-\-pianoman\fP
Assume the input is Pianoman MUS.
.SH File format
The BASICA format is defined 6-byte tuples of divisor, duration and pause.
.PP
.nf
	struct bsv_insn {
		uint16_t divisor;
		uint16_t duration; /* in ticks */
		uint16_t af_pause; /* in ticks */
	};
.fi
.PP
where divisor specifies the divisor value that it directly handed to the x86 PC
speaker. The following formula holds:
.PP
.nf
	frequency = 1193181 / divisor;
.fi
.SH See also
\fBaplay\fP(1), \fBqplay\fP(1), \fBhxtools\fP(7)
