Please consider a donation to the Higher Intellect project. See https://preterhuman.net/donate.php or the Donate to Higher Intellect page for more info.

SGI MIDI: Difference between revisions

From Higher Intellect Vintage Wiki
No edit summary
No edit summary
 
Line 66: Line 66:


[[Category:SGI]]
[[Category:SGI]]
[[Category:MIDI]]

Latest revision as of 01:13, 2 September 2020

Specifications[edit]

The SGI Indy workstation has two Macintosh compatible serial ports that may be used for MIDI interfaces. Note that on some early machines the serial line drivers had problems. There are many interfaces that can be used, but we've had the best luck with the following ones:

  • Opcode MIDI Translator II
  • Emu SoundEngine (GM Synth with built-in MIDI interface)

Features[edit]

The Silicon Graphics MIDI library offers access to the following interesting "features":

  • Timestamped input
  • Scheduled output
  • Synchronization with audio and video
  • Non-linear timebases
  • Multiple Application Access
  • Inter-application MIDI communication

Performance[edit]

Time-stamped Input[edit]

Input is time-stamped using the Unadjusted System Time or UST. UST provides an accurate high-resolution time base for digital media applications. It is calculated in nanoseconds, although the actual period of the clock varies with the underlying hardware.

MIDI data is received, parsed and timestamped in a UNIX STREAMS device driver. While this introduces some latency, our tests indicate that it is not a serious problem, as the driver is generally called from an interrupt. MIDI messages are timestamped when an entire message has been received. The time stamp can be considered to indicate the trailing edge of the data, although this may be changed in future releases.

Time stamps can be expressed in several different ways:

  • No time stamp (all stamps undefined)
  • Delta stamps (nanoseconds between messages)
  • Relative stamps (nanoseconds since a given time)
  • Delta ticks (metronome ticks between messages)
  • Relative ticks (metronome ticks since a given time)

No time stamps are self explanatory. Delta time modes simply return either the number of nanoseconds between two consecutive messages, or the number of ticks as expressed as fractions of a beat. Relative stamp modes are slightly more complex. A time (call it t0) is selected. The time stamp of each message becomes the difference in time between when the message was received (tn) and t0, in either ticks or nanoseconds.

Scheduled Output[edit]

MIDI output is done in terms of MIDI events. An event is a MIDI message (either a normal channel message or a system message, including system exclusive) plus a time stamp in one of the modes above. The time stamp is used by the MIDI driver to schedule when the message is actually sent out. The output is scheduled based on the UST. Accuracy to within 1ms is often possible, though not guaranteed at this time.

Synchronization with Audio and Video[edit]

Because MIDI uses UST time stamps, it is quite possible to synchronize MIDI output with audio and video. Audio provides a method by which a specific sample can be timed to leave the output jacks at a specified UST time. It is also possible to do this with MIDI using relative time stamps and by manipulating the t0, or origin time used by the scheduler. Similar techniques can be used for video. An example program is provided elsewhere.

Non-linear Time Bases[edit]

Non-linear time bases are supported by the MIDI driver. When using a "tick" mode, time stamps become the number of divisions of a quarter note. The method is very similar (if not identical) to that used by Standard MIDI Files.

Each unit of time is referred to as a "tick." A tick is a division of a quarter note, eg 1/96th. A tempo is defined in terms of microseconds per quarter note. The MIDI driver allows a tempo change to be an output event, to take effect at a scheduled time. Further, there is an additional mapping element of a "tempo scalar", which allows for changing the speed of playback without changing any time stamps or the apparent tempo. Speed changes can carry over across tempo changes.

Multiple Application Access[edit]

The MIDI driver allows any number of applications to receive MIDI events from the same MIDI interface, and to send data (within reason) out that same interface.

Any number of applications (up to a configurable limit) may open the MIDI driver, and connect to any of the configured MIDI interfaces. The MIDI driver makes a separate copy of each incoming MIDI event for each interested connection.

For output, each connection to the MIDI driver has its own time base. This allows the driver to merge MIDI streams with little difficulty, because the timing of an output message is dependent only on the messages in its own sequence. No attempt is made to prevent different streams destined for the same interface from interfering with one another. Note that running status must not be stripped, because an application has no way of knowing what messages may be sent from other applications.

Inter-application MIDI Communication[edit]

The MIDI driver can be configured with any number of "internal" MIDI interfaces. Each internal interface acts like a MIDI cable looped back on itself. This allows applications to communicated with each other in an accurately timed manner. It can be tricky: think what happens when you connect the MIDI out jack to the MIDI in on your keyboard!

If you want to have applications control each other, it is recommended that you use something besides internal MIDI, such as shared memory message passing. Internal MIDI is designed for MIDI data, not generalized control.