OSS API Specification Appendix C - /dev/music input events

The following table contains a list of possible input events that can be read from /dev/music.

Each event is a 8 byte record. The first byte (b0) contains the category code which determines the meaning and encoding of the remaining bytes. All events with unknown category are undefined and should be ignored.

In most categories byte 1 is the synthesizer number that generated this event and byte 2 (sometimes byte 1) contains the actual event code. The remaining bytes will be used as parameters (8, 16 or 32 bit integers). Note that numbering of most parameters starts from 0 (instead of 1).
 
Byte 0 Meaning
EV_CHN_VOICE MIDI Voice messages. b1=dev, b2=EVENT, b3=MIDI chn, b4=note, b5=parm
b2=EVENT Macro Description
MIDI_NOTEON SEQ_START_NOTE MIDI note ON, b5=velocity
MIDI_NOTEOFF SEQ_STOP_NOTE MIDI note OFF, b5=velocity
MIDI_KEY_PRESSURE SEQ_KEY_PRESSURE MIDI key pressure, b5=pressure
EV_CHN_COMMON MIDI channel messages, b1=dev, b2=EVENT, b3=MIDI chn, b4=parm1, b5=parm2, b6/b7=parm3 (16 bit value)
b2=EVENT Macro Description
MIDI_CHN_PRESSURE SEQ_CHN_PRESSURE MIDI channel pressure, b4=pressure
MIDI_PGM_CHANGE SEQ_PGM_CHANGE MIDI program change, b4=instrument
MIDI_CTL_CHANGE SEQ_CONTROL MIDI control change, b4=controller, b6/b7=value
MIDI_PITCH_BEND SEQ_BENDER MIDI pitch bend, b6/b7=bender value
EV_SYSEX System exclusive messages, b1=dev. Bytes b2 to b7 are used to hod the sysex data (6 bytes/event record). Unused trailing bytes are filled with 0xff. Number of subsequent sysex events from the same device may be used to carry long sysex messages.  A sysex message will begin with the sysex start byte (0xf0) and end with sysex end byte (0xf7). All byte values between start and end should be between 0x00 and 0x7e.
EV_TIMING Timing events (/dev/music specific), b1=EVENT, b4-b7=parm (32 bit value)
 
b1=EVENT Macro Description
TMR_START SEQ_START_TIMER Start timer
TMR_STOP SEQ_STOP_TIMER Stop timer
TMR_CONTINUE SEQ_CONTINUE_TIMER Continue timer
TMR_WAIT_ABS SEQ_WAIT_TIME Wait for absolute time, parm=tick
TMR_WAIT_REL SEQ_DELTA_TIME Wait relative time, parm=ticks
TMR_ECHO SEQ_ECHO_BACK Echo event, parm=application_use
TMR_TEMPO SEQ_SET_TEMPO Set tempo, parm=tempo
TMR_SPP SEQ_SONGPOS Set song position, parm=pos
TMR_TIMESIG SEQ_TIME_SIGNATURE Set time signature, parm=sig
EV_SEQ_LOCAL Not used as input events. Should be ignored if seen.
EV_SYSTEM MIDI system and real time messages  (0xf1 to 0xff) (only input at this moment).  Support added in OSS 3.9.4. These events need to be enabled using ioctls SNDCTL_SEQ_TIMING_ENABLE, SNDCTL_SEQ_ACTSENS_ENABLE and SNECTL_SEQ_RT_ENABLE.

The number of data bytes depends on the MIDI message.
Byte Meaning
0 EV_SYSTEM
1 Device number
2 1st message byte
3 2nd message byte (if present)
4 3rd message byte (if present)

Back to OSS Programmer's Guide