The Declarations Section |
The Declarations Section |
Device Declarations |
Instrument DeclarationsTao provides a set of classes for creating pieces of the material described in section *. Each class deals with a creating a piece of material of a particular geometrical shape, so for example the user can create strings, circular sheets, rectangular sheets and elliptical sheets. The way in which Tao's cellular material is actually implementated provides for future support of irregularly shaped components but in the present version the user is limited to these geometrical primitives.In practice though this is not a serious limitation since there are many other techniques available for designing interesting instruments. These include damping and locking parts of an instrument and constructing compound instruments by coupling several pieces of material together using Connector devices. All of these techniques provide ample room for experimentation. In order to create a primitive instrument several pieces of information are required. These include the instrument type, the name by which it will be referred to in the script, its x and y frequencies, and its decay time. The general form of an instrument declaration is illustrated by the following string declaration: String string(<pitch>, <decay_time>); where In the next example the placeholders String string(C#5+1/2, 4.5 secs); In this example the length of the string is set such that its pitch
is C sharp plus a quarter-tone (1/2 a semitone) in octave 5, and
its decay time is four and a half seconds.
The The A second practical example is given below, this time creating a
rectangular sheet called Rectangle rect(200 Hz, 500 Hz, 60 secs); In this example two pitch arguments are specified, and both are given in frequency format. The first determines the size of the instrument in the x direction and the second, the size in the y direction. It may seem slightly unintuitive at first to be specifying the size of a rectangular sheet in units of Hertz rather than physical dimensions such as metres or millimetres, but this practice is adopted for a number of good reasons:
Another advantage of specifying dimensions by pitch or frequency is that it becomes a simple matter to construct an instrument which has an array of similar components but with different pitches for each. For example the following code fragment creates a set of rectangular components with uniform y dimension but pitches tuned to fractions of an octave for the x dimension. This kind of instrument might be the starting point for some sort of pitched percussion instrument for example: Rectangle rect1(8.0 oct, 500 Hz, 60 secs); Rectangle rect2(8.2 oct, 500 Hz, 60 secs); Rectangle rect3(8.4 oct, 500 Hz, 60 secs); Rectangle rect4(8.6 oct, 500 Hz, 60 secs); Rectangle rect5(8.8 oct, 500 Hz, 60 secs); Rectangle rect6(9.0 oct, 500 Hz, 60 secs); This example shows yet another form of the pitch argument, i.e.
octave/fraction format
or The previous example opens the way for describing another important
technique often used when creating instruments with arrays of similar components.
Tao provides an array facility for grouping
together such components and giving them a common name. For example
the following script code has much the same effect as the previous example
but logically groups the six rectangular components together into an
array with a single name Rectangle rect_array[6]= { (8.0 oct, 500 Hz, 60 secs), (8.2 oct, 500 Hz, 60 secs), (8.4 oct, 500 Hz, 60 secs), (8.6 oct, 500 Hz, 60 secs), (8.8 oct, 500 Hz, 60 secs), (9.0 oct, 500 Hz, 60 secs) }; The individual components can be accessed using syntax which will be very familiar to C and C++ programmers: rect_array[0], rect_array[1] .. rect_array[5] The declarations for circular, elliptical and triangular sheets of material follow a similar format to the examples presented in this section, with elliptical and triangular sheets requiring two pitch values and circular sheets requiring only one (determining the diameter). Examples are given below: Circle circle(5.03 pch, 20 secs) Ellipse ellipse(6.00 pch, 50 Hz, 1 min + 20 secs) Triangle triangle(100 Hz, 6.5 oct, 600 msecs) These declarations introduce the final pitch notation,
octave/semitone format
or Note also that the different pitch formats can be used side by side in an instrument declaration requiring more than one pitch.
| ||
The Declarations Section |
The Declarations Section |
Device Declarations |
©1999,2000 Mark Pearson
m.pearson@ukonline.co.uk April 30, 2000 |