NetBSD/usr.bin/midirecord/midirecord.1

165 lines
5.0 KiB
Groff

.\" $NetBSD: midirecord.1,v 1.8 2020/03/14 09:01:11 wiz Exp $
.\"
.\" Copyright (c) 1998, 1999, 2001, 2002, 2010, 2014, 2015, 2020 Matthew R. Green
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd March 13, 2020
.Dt MIDIRECORD 1
.Os
.Sh NAME
.Nm midirecord
.Nd record midi files
.Sh SYNOPSIS
.Nm
.Op Fl aDfhoqV
.Op Fl B Ar buffersize
.Op Fl c Ar channels
.Op Fl d Ar devices
.Op Fl f Ar sequencerdev
.Op Fl n Ar notesperbeat
.Op Fl R Ar roundbeats
.Op Fl r Ar raw_output
.Op Fl T Ar tempo
.Op Fl t Ar time
.Ar file
.Sh DESCRIPTION
The
.Nm
program converts the sequencer events read on
.Ar sequencerdev
to the named MIDI SMF output.
If the file name is \-, output will go to the standard output.
By default, timing for events begins with the first event.
The
.Fl o
flag may be used to start timing events at the process start up.
.Sh OPTIONS
The following options are available:
.Bl -tag -width XnXnotesperbeatX
.It Fl a
Append to the specified file, rather than overwriting.
.It Fl B Ar buffersize
Set the sequencer device read buffer size to
.Ar buffersize .
The default value is 32768 bytes.
.It Fl c Ar channels
Sets the filter list of channels to
.Ar channels ,
which is a comma separated list of channels to filter in.
.It Fl D
Enable debug log.
.It Fl d Ar devices
Sets the filter list of devices to
.Ar devices ,
which is a comma separated list of devices to filter in.
.It Fl f Ar sequencerdev
Sets the sequencer device to use to
.Ar sequencerdev .
The default is
.Pa /dev/music .
.It Fl h
Print a help message.
.It Fl n Ar notesperbeat
Sets the MIDI notes (clocks) per beat to
.Ar notesperbeat .
.It Fl o
Start the relative timer at process start up instead of at
the first event.
.It Fl q
Be quiet.
.It Fl R Ar roundbeats
Round timings to
.Ar roundbeats
of a note.
Output will always be aligned to this many beats.
.It Fl r Ar raw_output
Create the raw output of the sequencer device in
.Ar raw_output .
.It Fl T Ar tempo
Set the tempo for the recording to
.Ar tempo .
.It Fl t Ar time
Sets the maximum amount of time to record.
Format is [hh:]mm:ss[.dddddd].
.It Fl V
Be verbose.
.El
.Sh ENVIRONMENT
.Bl -tag -width MIDIDEVICE
.It Ev MIDIDEVICE
the midi device to be used.
.El
.Sh EXAMPLES
You can use
.Nm
to observe activity on a MIDI bus using the
.Fl D
and
.Fl V
options and learn about device-specific MIDI messages.
.Pp
For instance, to determine the MIDI messages needed to switch to ARP mode
on a Korg minilogue XD synthesizer, which does not document any control
change or non-registered parameter numbers for this function but does
document that ARP is part of the
.Dq VOICE TYPE MODE ,
parameter these messages were seen:
.Pp
.Dl midi_event_chn_common_to_output:444: MIDI_CTL_CHANGE: channel 0 ctrl 62 val 10
.Dl midi_event_chn_common_to_output:444: MIDI_CTL_CHANGE: channel 0 ctrl 6 val 1
.Pp
which shows that CC#62 (hexadecimal) was set to value 10 (also
hexadecimal), and that CC#6 was set to value 1.
As CC#62 is also the least significant byte of the non-registered
parameter number, we can guess that NRPN 0,62 controls the
.Dq VOICE MODE TYPE
parameter documented in the synthesizer manual, and that the value 1
set to CC#6 (Control Data Entry MSB) turns on ARP mode.
For completeness, setting both CC#62 and CC#63 for the parameter
number, as well as CC#6 and CC#26 (Control Data Entry MSB) to 0
provides a complete NRPN control message.
.Sh SEE ALSO
.Xr midiplay 1 ,
.Xr midi 4 ,
.Xr sequencer 4
.Sh HISTORY
The
.Nm
program was first seen in
.Nx 7 .
.Sh AUTHORS
The
.Nm
program was written by
.An Matthew R. Green Aq Mt mrg@eterna.com.au .
.Sh BUGS
SYSEX, LOCAL and FULLSIZE messages are not currently handled, but the
.Nx
.Xr sequencer 4
device does not generate them.
.Pp
.Nm
will hang after the timeout waiting for the very next message before
it will exit and finish writing the file.