Writing a script

First of all open a new text file in your favourite text editor and copy the following text into it:

    Audio rate: 44100;

    String string(200 Hz, 20 secs);

    Output output(stereo);

    Init:
        string.lockEnds();
        ...

    Score 20 secs:
        At 0 secs for 1 msecs:
            string(0.2).applyForce(1.0);
            ...

        output.chL: string(0.1);
        output.chR: string(0.9);
        ...

Now save the file as "new.tao".

In plain English this script does the following:

  1. declares the audio sampling rate for any output files to be 44.1 KHz
  2. declares a string instrument called string
  3. declares a two channel output device called output
  4. initialises the string by locking both ends (fixing them at their initial position: z=0)
  5. states that the performance will last for 20 seconds
  6. applies a fixed force of magnitude 1.0 to a point on the string one fifth of the way along its length (from the left hand side) for a short time interval (0 seconds to 0.001 seconds)
  7. writes the movements of the string out to a stereo output file called "new_output.dat" with the left and right channels following the movements of a point one tenth of the way along its length and another point nine tenths of the way along the string, respectively.

In case you are wondering, the name of an output file is formed by appending the name of the output device onto the name of the script (minus the .tao extension) and adding a .dat extension, indicating that the file contains raw floating point data, i.e. "new_output.dat". These files require further processing before they can be played back. See section *.


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