[Topic]
CMIO

The CMIO (Common Music Input/Output) window facilitates the generation of musical events to and from sound synthesis and display applications. The window provides a high-level interface to the system's IO capabilities and offers a structured alternative to evaluating input and output expressions in the Lisp REPL, or read-eval-print loop. CMIO windows perform their own error handling and, by default, report Lisp errors without forcing the user into the Lisp debugger. This means that novice users can experiment with algorithmic composition and sound rendering systems in a fairly forgiving environment without necessarily knowing much about Lisp evaluation beforehand.

Which sound applications (labeled targets in the window) are active at any given time depends both on what programs are installed on the host computer and what software systems have been loaded into Lisp. These sound system do not need to be loaded ahead of musical experimentation; the window's Systems and Files pages permit external software such as CLM, CMN and Midishare to be dynamically configured and loaded at any appropriate point in the working process.

To render musical events to a sound application, the user first selects the target's application page, then enters an event expression in the Events buffer and clicks the Compose button (Example 1). Each target application page has numerous fields for customizing its IO behavior. These fields can be initialized to the user's personal preference by passing appropriate arguments to the cmio function when the window is created and then set to different values as part of the ongoing process of experimentation.

The CMIO graphical user interface is implemented in GTK and currently runs on Linux and OS X. Please consult the documentation on configuring GTK for further information.

Window Layout

The CMIO interface consists of four GUI components arranged from top to bottom in the window:

Each tabbed page contains a set of fields representing the input/output features of a given application or task. The right-justified pages (such as Help or Systems) control more general features of the window or in the surrounding Lisp environment.

Example 1. The four components of a CMIO window: Sources, Targets, Executive and the Status line. Event IO is the currently active source page and Midi is the currently selected target.

[cmio1.png]

Color highlighting provides visual clues as to how information on a page is interpreted by the interface:

Notebooks and Pages

Each application, or task, is represented by a tabbed notebook page inside the window. The pages of the Sources notebook relate to the creation of source material in CM: generating musical event data and defining aggregate structure with seq containers. The Targets notebook pages define various "destinations" that musical data can be rendered to or imported from. The following sections briefly describe the layout and functionality of each Notebook's pages.

Sources Notebook

Containers

The Containers page is used to create, rename and delete seq containers.

[cmio2.png]

Event IO

The Event IO page is used to generate musical events to and from the currently selected target page. Using the Event IO page in conjunction with the current target page is equivalent to calling the events function in the REPL.

[cmio3.png]

Help

The Help page is not yet implemented.

Targets Notebook

While each target page has its own unique set of fields, most targets allow one or more file names to be specified in an associated buffer. File names may include directory components and the contents is always merged against the current working directory (visible in the Executive frame) to produce a fully specified pathname. In addition, most files have an associated Versions check box that, if active (checked), automatically appends a new number to the file's name each time the Compose button is pressed so that previous versions of the file will not be overwritten.

CLM

The CLM page manages input and output to CLM score files and CLM audio files.

[cmio5.png]

The remaining fields on the page are specific to CLM audio files, see the CLM documentation on with-sound for more information.

CMN

The CMN page manages output to CMN score files and EPS files.

[cmio6.png]

Csound

The Csound page manages input and output to CSound score files and audio files.

[cmio7.png]

MIDI

The MIDI page manages input and output to MIDI files.

[cmio8.png]

Midishare

The Midishare page supports direct connections to a Midishare Port or to a Midishare player (sequencer) application.

[cmio9.png]

Plotter

The Plotter page allows musical events to be generated to Plotter windows where they can be displayed, edited using GUI tools and mixed to other target applications.

[cmio10.png]

To generate sound events from an existing Plotter window to a target application, call the plotter-data function in the Events buffer on the Event IO source page.

Seq

The Seq page allows musical events to be generated to seq containers. The seq object can then be displayed, mixed to other target applications and saved in files to be loaded at a later time.

[cmio11.png]

Files

The Files page associates file handlers with the various file types used in the system. Handers can be external programs, shell scripts, or Lisp functions. Programs and shell scripts are passed the current target file by appending it after last user-supplied argument. To define a Lisp function handler, specify the hander in a function call list along with any arguments to pass to the function. The target file is passed to the function by inserting it before the first user-supplied argument to the function.

[cmio12.png]

Systems

The Systems page allows external sound systems to be loaded into Lisp. Systems that are already loaded are marked with a green dot and the associated load button is disabled. Systems that are not loaded are marked with a red dot and their load button is enabled. Systems that cannot be loaded are marked by an error icon. This condition may arise if the host environment is missing software or runtime libraries.

[cmio13.png]

The Executive

The Executive page manages the interface between Common Music and the host operating system.

[cmio14.png]

Error Handling and Notification

A CMIO window facilitates musical tasks that would otherwise be accomplished by evaluating expressions inside the Lisp REPL window. Under normal conditions, lisp evaluation errors will cause the REPL to stop execution in an error break. But the CMIO window executes via foreign function (GTK) callbacks that do not expect the flow of control to be interrupted. As a result, Lisp error breaks inside CMIO will likely cause the window to freeze and — in some cases — may even cause the Lisp session to abruptly terminate. For this reason the CMIO window evaluates CM function calls in such a way that error messages are reported in the message line without triggering Lisp error breaks. If you need to enter the Lisp break loop in order to debug a problem then set the global variable *cm-break-on-errors* to true, but realize that once the break loop is left the CMIO window (and possibly the whole GTK session) may no longer work.