|   Learning the Basics   |   Learning the Basics   |   Damping the ends of the string   | 
| A simple string instrumentThe 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  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 
     | ||
|   Learning the Basics   |   Learning the Basics   |   Damping the ends of the string   | 
| ©1999,2000 Mark Pearson
m.pearson@ukonline.co.uk April 30, 2000 | ||