22.09.2015 Views

of Microprocessors

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

Musical-Applications-of-Microprocessors-2ed-Chamberlin-H-1987

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

754 MUSICAL ApPLICATIONS OF MICROPROCESSORS<br />

VERSION generator carries sound file reading even further. With VER­<br />

SION, a particular note recorded in a sound file can be identified in terms <strong>of</strong><br />

file positions for the beginning <strong>of</strong> the attack, beginning <strong>of</strong> steady-state,<br />

beginning <strong>of</strong> decay, and end <strong>of</strong> decay. Then, with additional parameters, the<br />

note can be replayed at a different pitch and with a different duration (by<br />

truncating or repeating the steady-state samples). Transitions from one<br />

envelope segment to the next are smoothed by interpolation, the degree <strong>of</strong><br />

which can also be specified.<br />

Many unit generators are quite simple. ADN for example has one<br />

output and any number <strong>of</strong> inputs that are simply added together to form the<br />

output. LOOKUP has an input, an output, and uses a wavetable to translate<br />

the input to the output. Two parameters also specify the expected range <strong>of</strong><br />

inputs. Besides use as a nonlinear waveshaper, it can be used in a myriad <strong>of</strong><br />

ways to tailor response curves in instruments more efficiently than using<br />

complex expressions in parameter fields. SEG is an envelope generator that<br />

uses a waveform table for the envelope shape. The table is divided into a<br />

number <strong>of</strong> segments (usually three), which correspond to envelope phases.<br />

Parameters determine the amount <strong>of</strong> time spent in each segment according to<br />

either constants in the SEG statement or variables from the NOTE<br />

statement. A very useful feature is that the duration <strong>of</strong> designated segments<br />

may be calculated automatically from the total note duration.<br />

Complete instrument definitions require an INS statement at the<br />

beginning and an END statement at the end. The INS statement includes an<br />

"action time" field, which can be set nonzero to avoid using memory for the<br />

instrument definition until needed. If the instrument is to be heard, the<br />

OUT unit generator must also be included. OUT accepts the final<br />

instrument output as an I/O block and sums it with other instruments that<br />

may be playing into the C-MUSIC standard output sample stream, which<br />

will ultimately go to a sound file. For stereo or quad output, OUT requires<br />

two or four inputs. If an instrument is to sound in only one channel, the<br />

other inputs are set to zero.<br />

Figure 19-17 shows a complete, generalized, FM-type instrument<br />

block diagram and its corresponding definition. Wavetable F2 is expected to<br />

have an overall amplitude envelope shape, F3 a deviation envelope, and F4 an<br />

envelope to vary the modulation frequency. Fl is just a sine wave for classical<br />

FM, although it could be some other shape for complex FM. The instrument<br />

is controlled by three P-fields in NOTE statements. P5 and P6 are the usual<br />

duration and amplitude parameters, while P7 sets the average ratio <strong>of</strong><br />

modulation to carrier frequency. Below is the complete C-MUSIC instrument<br />

definition for this instrument, which is called GENFM. Note that, since FM<br />

synthesis can be adversely affected by table lookup truncation error, the size<br />

<strong>of</strong> F1 has been set to 8,192 samples.<br />

The function generation score section specifies the content <strong>of</strong> wavetables.<br />

This section consists <strong>of</strong> a series <strong>of</strong> GEN statements, each <strong>of</strong> which will

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!