xref: /openbsd-src/share/man/man4/midi.4 (revision db3296cf5c1dd9058ceecc3a29fe4aaa0bd26000)
1.\" $OpenBSD: midi.4,v 1.13 2003/06/06 10:29:41 jmc Exp $
2.\" $NetBSD: midi.4,v 1.4 1998/08/22 14:45:35 augustss Exp $
3.\"
4.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
5.\" All rights reserved.
6.\"
7.\" Redistribution and use in source and binary forms, with or without
8.\" modification, are permitted provided that the following conditions
9.\" are met:
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. All advertising materials mentioning features or use of this software
16.\"    must display the following acknowledgement:
17.\"        This product includes software developed by the NetBSD
18.\"        Foundation, Inc. and its contributors.
19.\" 4. Neither the name of The NetBSD Foundation nor the names of its
20.\"    contributors may be used to endorse or promote products derived
21.\"    from this software without specific prior written permission.
22.\"
23.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33.\" POSSIBILITY OF SUCH DAMAGE.
34.\"
35.Dd August 6, 1998
36.Dt MIDI 4
37.Os
38.Sh NAME
39.Nm midi
40.Nd device-independent MIDI driver layer
41.Sh SYNOPSIS
42.Cd "# alpha"
43.Cd "midi* at opl?"
44.Cd "midi* at pcppi?"
45.Pp
46.Cd "# i386"
47.Cd "midi* at autri?"
48.Cd "midi* at opl?"
49.Cd "midi* at sb?"
50.Cd "midi* at wss?"
51.Ct "midi* at ym?"
52.Cd "midi* at mpu?"
53.Ct "midi* at ympu?"
54.Pp
55.Cd "# sparc64"
56.Cd "midi* at autri?"
57.Pp
58.Cd "pseudo-device sequencer"
59.Pp
60.Fd #include <sys/types.h>
61.Fd #include <sys/midiio.h>
62.Sh DESCRIPTION
63The
64.Nm
65driver provides support for various MIDI peripherals.
66It provides a uniform programming interface layer above different
67underlying MIDI hardware drivers.
68The MIDI hardware can be of many different kinds, e.g., an external
69synthesizer on a MIDI port (or a serial port), the PC speaker, an
70internal FM synth, or a wavetable synth.
71.Pp
72There are two device file types available for MIDI operation:
73.Pa /dev/rmidiN ,
74and
75.Pa /dev/music .
76The
77.Pa /dev/rmidiN
78devices provides raw access to a MIDI device.
79Data written is sent to the physical device as fast as possible and
80is uninterpreted.
81Reading from the device returns data as soon as it becomes available.
82A moderate amount of buffering is available both for reading and writing.
83The raw MIDI devices are mostly useful for non realtime operations, such as
84downloading patches to a device, since it is hard to get the accurate timing
85needed for quality music from a user program.
86But the devices can act as a simple patchboard for MIDI devices.
87For example, a MIDI keyboard could be connected to a synthesizer by
88the command
89.Pp
90.Cd "cat -u /dev/rmidi1 >/dev/rmidi2"
91.Pp
92The
93.Pa /dev/music
94device is a MIDI sequencer device.
95Data sent to and from this device not only contains the information sent to the
96MIDI device, but also timing information.
97The kernel will make sure that data is sent to the physical device at the
98indicated time.
99The sequencer device uses the
100.Pa /dev/midiN
101devices internally and they are unavailable when used by the sequencer.
102.Pp
103The API for the sequencer device is binary compatible with the OSS sequencer
104interface.
105.Sh FILES
106.Bl -tag -width /dev/sequencer -compact
107.It Pa /dev/rmidiN
108.It Pa /dev/music
109.It Pa /dev/sequencer
110.El
111.Sh SEE ALSO
112.Xr midiplay 1 ,
113.Xr ioctl 2 ,
114.Xr ossaudio 3 ,
115.Xr audio 4 ,
116.Xr autri 4 ,
117.Xr mpu 4 ,
118.Xr opl 4 ,
119.Xr pcppi 4 ,
120.Xr sb 4 ,
121.Xr wss 4 ,
122.Xr ym 4
123.Sh HISTORY
124The
125.Nm
126driver first appeared in
127.Nx 1.4 .
128