A simple string instrument

The simplest possible instrument consists of a single string. The following script illustrates how to create such an instrument, `pluck' it and generate an output file.

    Audio rate: 44100;

    String string(100 Hz, 20 secs);
    Output output(stereo);

    Init:
        string.lockEnds();
        ...

    Score 20 secs:
        At 0 secs for 1 msecs:
            string(0.1).applyForce(1.0);
            ...
        output.chL: string(0.1);
        output.chR: string(0.9);

	Every 0.1 secs: Print Time, newline; ...
        ...

The first line of this script declares the audio sampling rate of any output files generated (which in the current version has to be 44100). A single string with a fundamental frequency of 100Hz is created, followed by a single two-channel output device which will be used to write the movements of the string to a soundfile.

The statement string.lockEnds() is contained within the Init block of the script. This block of statements is executed once just prior to the performance and is delimited (as with any block of statements in Tao with a : just after the keyword |Init| and a ... just after the last statement.

The score is fairly self-explanatory. It has a duration of 20 seconds and for a short time interval at the beginning of the performance a fixed force of magnitude 1 is applied to a point on the string one tenth of the way along its length. The movements of two points on the string are traced throughout the performance and


©1999,2000 Mark Pearson m.pearson@ukonline.co.uk April 30, 2000