Отправляет email-рассылки с помощью сервиса Sendsay
  Все выпуски  

Язык программирования (и ОС) ФОРТ (FORTH) MIDI-гитары с Фортом внутри


from: http://zetetics.com/bj/papers/ztar1.htm

THE ‘ZTAR’ MIDI CONTROLLER

Bradford J. Rodriguez, Ph.D.

T-Recursive Technology, Collingwood, Ontario, Canada

and

Harvey Starr

Starr Labs, San Diego, California, USA


ABSTRACT

The Starr Labs ‘Ztar’ is a guitar-like controller for MIDI musical
synthesizers. Unlike 
devices which attempt to derive a MIDI control stream from the audio output of
a conventional 
guitar, the Ztar is a fully digital instrument with an internal microprocessor
and sensors for
frets and strings.

Hundreds of sensors must be sampled and processed in real time to generate a
MIDI control 
stream, and to avoid timing discrepancies that would be painfully noticeable
in a musical 
performance. The Ztar uses a Zilog Super8 microprocessor, programmed in a mixture
of Forth 
and assembler, to satisfy these requirements.

MIDI

The Musical Instrument Digital Interface (MIDI) was originally designed as a
protocol to carry 
control commands from a manual controller (such as a keyboard) to a music synthesizer.
These 
commands may represent "turn note on" or "turn note off," to name the two most
common examples.
Musical performances have demanding timing requirements -- a note duration of
1/64 of a beat 
is not uncommon. Therefore MIDI is carried at 31.25 Kbaud (320 microseconds per
byte), and a 
note command can take as few as two bytes [MMA88].

MIDI can command 128 different notes on or off -- more than enough for an 88-key
piano 
keyboard -- on any of 16 control "channels." The 16 channels may represent 16
different 
synthesizers, or 16 "voices" on a single synthesizer: channel 1 may be "piano,"
channel 2 
"pipe organ," and so forth. The Note-On command specifies channel number, note
number, and 
"velocity" -- an analog value representing how hard the key was struck.

Additional commands support:

    * "aftertouch," representing a continuing pressure on the key after the note
has been 
struck (this can be applied to a single note or to an entire channel);
    * "continuous controller," representing a variable control such as the pitch
or tremolo 
control of a synthesizer or the pedals of a piano;
    * supervisory messages, such as to select a different set of voices for the
16 synthesizer 
channels.

There are also MIDI commands for automatic "sequencers" which play a programmed
series of 
notes at a scheduled pace. A versatile MIDI controller should be able to generate
most of 
these commands.

THE ZTAR INSTRUMENT

A guitar is normally played by "fretting" a string (pressing the string on the
fingerboard at 
the right place to select the desired note), and then striking or strumming the
string. The 
Ztar instrument is played the same way; but notes are selected by pressing pressure-senstitive

keys which run the length of the fingerboard, rather than pressing guitar strings
(the 
positions of these keys mimic the conventional guitar). The note is played by
striking a 
string-like "trigger" on the body of the instrument; this trigger may be either
a 
pressure-sensitive key, or a conventional guitar string with an electronic pickup.
If guitar 
strings are used, it is only to provide a trigger signal; not to generate sound.

In the "guitar" mode, the trigger signal will cause the selected note for that
string to be 
output. But two additional options are available to the Ztar player. If the "piano"
mode is 
selected, the note is output as soon as it is selected on the fingerboard --
not requiring a 
trigger to be struck. If the "poly" mode is selected, multiple notes may be fretted
on a 
single string, and all will be played when the trigger is struck: essentially
playing a chord 
from one string. If these modes are combined, notes and chords may be played
on the 
fingerboard as though it were a conventional keyboard. In all modes, both the
initial velocity 
and the "afterpressure" of the fingers is sensed and output to the synthesizer.

The fingerboard represents a 6x24 key matrix (6 strings, each having 24 frets).
This matrix 
may be divided into 16 overlapping rectangular "zones." Each zone may control
a different MIDI 
channel; thus the six strings can control six different channels, or the lowest
frets on the 
strings can be used for special effects. Each zone can also have unique tuning
(transposition).

Beyond the guitar functions, the Ztar includes six or twelve pressure sensitive
pads, which 
can be programmed for a variety of special effects. For example, a pad can send
a programmed 
chord to the synthesizer when struck -- useful for drum effects -- or a pad may
act as a 
continuous controller, to provide pitch bend or afterpressure (to name just two
examples). A 
wide variety of MIDI commands can be programmed into the pads.

Other analog controllers supported by the Ztar are a joystick, two footpedals,
and a breath 
controller. These may be programmed to control any of the MIDI continuous controller
values, 
such as volume, pitch bend, and modulation.

The Ztar is programmed through a menu-driven operator interface, using a 2x40
LCD display and 
attached 11-key keypad. There are also up to sixteen "hot keys" which are dedicated
to 
specific control functions (such as to select the "triggered" vs. "piano" mode
described 
earlier, or to increase and decrease the synthesizer volume).

SOFTWARE ARCHITECTURE

The software is divided into two parts: the "Live mode" functions (those which
are involved 
with producing MIDI note outputs), and the operator interface or "Edit mode"
functions. 
(Despite the name, the instrument remains "live" and able to output notes even
when in the 
Edit mode.)

In Live mode, the Ztar must continuously scan 144 fingerboard keys, 6 strings,
12 pads, and 
assorted analog controllers, looking for an event which will produce a MIDI output.
Ideally, 
the instrument should be able to detect a keypress and a trigger event, map that
physical key 
to one or more programmed "zones," and generate and output the corresponding
MIDI "note" 
commands, all within a few milliseconds. For this reason, the "live mode" functions
are 
written in Super8 assembly lanauge.

In Edit mode, the Ztar performs the Live mode functions, and also scans the keypad
and updates 
the LCD display. The Ztar presents a hierarchical set of menus, and within each
menu are 
parameters which can be selected and altered. This operator interface code is
not 
time-sensitive, and is written almost entirely in high-level Forth.

The Ztar was originally developed using Inner Access Forth for the Zilog Super8,
a resident 
Forth compiler/interpreter that was supplied by Zilog in an external ROM. Since
this package 
did not include a Super8 assembler, it was necessary to translate assembler code
with the 
separate Zilog cross-assembler, and then manually insert the resulting object
code (in hex) 
into the Forth source. As the program became more elaborate, this development
environment 
became excessively awkward.

So, in early 1997 the Ztar program was converted to the MicroProcessor Engineering
Super8 
cross-compiler. In addition to providing a symbolic Super8 assembler, the conversion
to MPE 
Forth offered these benefits:

    * The Forth compiler/interpreter, which is not used in the final application,
can be 
"stripped" to save program space;
    * The "split" instruction & data space option of the Super8 is supported,
doubling the 
available memory space (64K ROM and 64K RAM);
    * Paged memory is supported, allowing an even larger memory expansion with
a 
newly-designed CPU board; and
    * "Umbilical" Forth allows interactive debugging on the target hardware.

MPE Forth also includes a multitasker. While the program is not currently so
programmed, its 
organization lends itself well to multitasking. In the future we expect to separate
the Live 
and Edit functions into two separate tasks.

FUTURE DIRECTIONS

Several variations of the Ztar product have been produced, using the same basic
processor and 
software platform. Recently a new "D5" CPU board has been designed, with a smaller
form factor 
and greatly expanded memory and I/O capacity, expanding further the range of
musical 
instruments which can be created by Starr Labs.

The simplest variation, the "Zbass," involves removing two "strings" from the
basic Ztar (and 
modifying the software accordingly). This produces a four-string instrument suited
to bass 
guitarists.

The "Z-board" is a keyboard instrument: essentially a Ztar with no string triggers,
played 
exclusively in the "piano" and "poly" modes. The Z-board offers an expanded 288-key

fingerboard, organized as twelve "strings" (rows) of 24 keys, in desktop package.

Starr Labs has recently introduced the Microzone, a "microtonal" keyboard for
music theorists. 
This dispenses with the conventional 12-note musical scale and instead allows
the octave to be 
arbitrarily subdivided. The Microtonal keyboard has 810 keys in a hexagonal array,
and like 
the Z-board, is played in "poly/piano" mode. It requires a MIDI synthesizer which
is capable 
of generating notes at arbitrary intervals.

Currently under development is a Percussion Controller, a MIDI controller for
drummers. This 
instrument expands upon the "pad" functions of the Ztar, allowing up to 32 external
pads using
a variety of physical sensors. It has no fingerboard or string triggers. The
pads are 
programmable with an extensive range of MIDI functions and sequence effects.

REFERENCES

[MMA88] MIDI Manufacturers Association, MIDI 1.0 Detailed Specification, Document
Version 4.0 
(June, 1988). Los Angeles, CA: International MIDI Association, 1988.

Information about Starr Labs’ products can be found at <http://www.catalog.com/starrlab>.

 

В избранное