shithub: wl3d

ref: 3b2f4d3df58368ce53243dd992612b9fcb7f0d1a
dir: /man/1/opl2/

View raw version
.TH OPL2 1
.SH NAME
opl2 \- OPL2 chip emulator
.SH SYNOPSIS
.B opl2
[
.B -n
.I rate
] [
.I file
]
.SH DESCRIPTION
.I Opl2
is an emulator of a single Yamaha 3812 chip, also known as
.SM OPL2.
.PP
The emulated chip is programmed by a stream of commands either from stdin or
from
.IR file .
Guided by these commands, it then synthesizes a number of 16 bit little-endian samples for a sampling rate of 44.1 kHz.
Each is duplicated for stereo sound and written to stdout.
.PP
While the output's sampling rate is the same as the audio device's default (see
.IR audio (3)),
the chip is meant to be sampled at a much lower rate, 700 Hz by default.
A different expected sampling rate is given in Hz using the
.B -n
parameter.
Internally, for each sample,
.I opl2
generates a number of additional samples depending on this rate.
.PP
Commands are 4 bytes formatted as follows, where the size of each field is given in bytes between brackets:
.RS
.IR register [1]
.IR value [1]
.IR delay [2]
.RE
.PP
Each command specifies a
.I value
to be written to an
.SM OPL2
chip
.IR register ,
modifying its internal state.
The
.I delay
field indicates a multiple of the expected sampling period (the inverse of the expected sampling rate) during which the chip should be sampled before processing the next command.
Output is then triggered by a non-zero delay.
.I Delay
is stored as a 16-bit unsigned integer in little-endian byte order.
.SH "SEE ALSO"
.IR wl3d (1) ,
.IR audio (3)
.SH HISTORY
.I Opl2
first appeared for 9front (May, 2016), based on
.I fmopl.c
from the Multiple Arcade Machine Emulator (
.SM MAME
).