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.

SOME REAL ApPLICATIONS 749<br />

name followed by several parameters, which specify where the inputs come<br />

from and where the output goes. Available unit generators include several<br />

kinds <strong>of</strong> oscillators, amplifiers, mixers, several different filters, delay lines,<br />

mathematical operators, nonlinear distorters (table lookup elements), noise<br />

generators, and the content <strong>of</strong> existing sound files. As many unit generators<br />

as desired may be combined in an instrument definition, and, since 32-bit<br />

floating-point arithmetic is used, error accumulation is generally not a<br />

concern.<br />

Figure 19-15 shows a schematic representation <strong>of</strong> the OSC unit<br />

generator along with a prototype OSC statement. The statement begins with<br />

the keyword, OSC, followed by the name <strong>of</strong> an I/O block that will receive its<br />

output. I/O blocks are different from constants and parameters and are used<br />

to pass sample values among the unit generators in an instrument. The<br />

reason they are special is that signal samples are calculated in blocks to<br />

improve computation speed. I/O blocks are identified as B1, B2, ... up to<br />

the limit <strong>of</strong> memory. The second and third fields specify the output<br />

amplitude and the increment for the table lookup pointer, respectively. Each<br />

may be parameters from note statements (P-type variables), V-type variables,<br />

constants, or other I/O blocks. The resulting amplitude value simply<br />

multiplies sample values read from the wavetable. The frequency <strong>of</strong> the<br />

oscillator is I*SR/FL, where I is the resulting increment value, SR is the<br />

prevailing sample rate, and FL is the length <strong>of</strong> the wavetable. The next field<br />

specifies which wavetable to use. Wavetables are created later in the functiongeneration<br />

section and are identified by number. Like the amplitude and<br />

increment fields, variables may be used to specify the function number to be<br />

used.<br />

The last field effectively specifies the initial value <strong>of</strong> the waveform table<br />

pointer. If the letter D (for "dynamic" variable) is used, then the initial value<br />

is zero. Use <strong>of</strong> a P-type or a V-type variable allows the oscillator's initial phase<br />

to be controlled. Internally, a temporary storage location is allocated to hold<br />

the wavetable pointer when a note using the oscillator starts and is freed<br />

when the note ends. Every time a note starts, a new storage location is<br />

allocated so an instrument may play any number <strong>of</strong> notes simultaneously.<br />

Also shown in Fig. 19-15 are some valid OSC statements. Example 1 is<br />

the simplest possible OSC statement. It outputs to I/O block number 1, uses<br />

function number 1 for its wavetable, and always starts its waveform at the<br />

beginning <strong>of</strong> the table. The amplitude <strong>of</strong> the note is specified by the fifth P­<br />

field in note statements that play it, and frequency is specified by the sixth P­<br />

field. Example 2 is similar except that the wavetable to be used may be<br />

specified in the note statements rather than being constant in the i,nstrument<br />

definition. In example 3, the amplitude is the content <strong>of</strong> another I/O block<br />

from a previous statement that presumably has samples <strong>of</strong> an envelope shape.<br />

The same can be done for frequency as in Example 4 in which the content <strong>of</strong><br />

B1 sets the instantaneous frequency.

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

Saved successfully!

Ooh no, something went wrong!