General Functions and Commands


Random Seed Initiation

rs(ui)

Summary
Seeds the internal pseudo random number generator. ui must be a value between 0 and 65536.  (The random number generator is implemented through the C standard library).  The default random seed is 1.

Scope
All subsequent random generated values will be initiated by  the initial seed value ui.  Thus, pseudo-random sequences can be regenerated exactly (on the same system) using the same seed value.


P-Factor

pf(f)

Summary
Any value occurring after a pf(f) statement will be scaled by "f" amount. The "pf" function is automatically cancelled at the end of each p-field (negative values may also be used). For example:

i1 = 3 0 5 { 
      p2 .1 
      p3 10 
      p4 pf(2.5) mo(T 1. 0 10)
      p5 100.3 
    }
    
will rescale the "move" contents to 0 to 25.

Restrictions:
PF can only be used in the i-block (but not in P2). It can be used in P3 also (but be careful as negative (-) values will cause rests to be created!).

PF takes effect exactly where it occurs in a p-field and will be in effect until the beginning of the next p-field.


Random Deviation

rd(f)

Summary
Any value occurring after an rd(f) statement will be deviated by the amount:

value + or - (value * f/2)
If you have established a deviation and wish to cancel it later you can specify rd(0).  Typical values: f is a scalar where 0 is 0 % deviation and 1 is 100% deviation (but higher values may certainly be employed!).

IMPORTANT:  The placement of rd is very important; when using in p-fields use caution that it is placed appropriately.  For example:

i1 = 3 0 5 { 
  p2 .1 
  p3 10 
 
  rd(.1)  ;turn on +/- 5% deviation
  p4 5000 
  
  rd(0)   ;turn off deviation (incorrect!)
  p5 100.3 
}
While it would appear that this turns on 10% deviation after p3 and then off before p5, that's not the case.  P3 will process the first "10", then turn on the deviation.  This deviation will then apply to the rest of the 10s in p3 (because the i-block has to play for 5 beats).  After the initial p4 value of 5000 is processed, the deviation will be turned of for the rest of p4!  Do it like this instead:

i1 = 3 0 5 { 
  p2 .1 
  p3 10 
  p4 rd(.1) 5000    ;turn on +/- 5% deviation
  p5 rd( 0) 100.3   ;turn off deviation (correct!)

}
Example
rd(.25)
For a datum value of 100 (this can be literal or generated by a function), rd will deviate from the value by a maximum of +-12.5.
Scope:  All subsequent values (or functions) will add a deviation within +f/2 to -f/2 to the current value.  A nice way to make rhythmic values seem a bit more human is to specify a small deviation value (such as .05).


Random Deviation (limited to current p-field)

dv(f)

Summary
The DV command functions exactly like RD (see above) except that it only affects the current p-field (it is reset to 0 at the beginning of each p-field). Any value occurring after an dv(f) statement will be deviated by the amount:

value + or - (value * f/2)
If you have established a deviation and wish to cancel it later you can specify rd(0).  Typical values: f is a scalar where 0 is 0 % deviation and 1 is 100% deviation (but higher values may certainly be employed!).

IMPORTANT:  When using DV (p-field random deviation) in combination with RD (global random deviation), both deviations are added together to create a cummulative random deviation. Moreover, the cummulative duration will add a deviation within +(RD+DV)/2 to -(RD+DV)/2 to the current value.


Tempo (G-Area Only)

As of version 2.0, the TE command has been expanded and now allows for static tempos (ala version 1.0) AND tempo changes. (This one's for you Allan!)

How Tempos Work

Tempos can be defined in two ways:

1) a generic tempo
FORMAT: te(f), where f = a floating point value listing the tempo

2) a dynamic definition (a tempo change)
FORMAT: te(start-beat, end-beat, tempo1, tempo2, type)

where tempo is in beats-per-minute and type is a code in the following table:
Code Transformation
F Flat (Linear)
E Exponential
L Logarithmic (Inv. Exp.)
S Sine (270-360 deg.)
C Inverse Sine (180-90 deg.)
Vn User Defined Curve (based on exponents)
    n=1 Linear (same as "F")
    n=2 Exponential (same as "E")
    n=.5 Logarithmic (same as "L")
    n=3 Steep Exponential
    n=.25 Steep Logarithmic
Move Types for MO (move), MS (move sets), and TE (tempo)

N.B. beats start from 0.

Dynamic tempo changes need not be listed contiguously; if a subsequent definition doesn't start where the previous one ended, the end tempo of the previous definition will be held.

If two definitions coexist with conflicting times the second definition will override the first. For example, with


    te(10, 20, 90, 60, e)
    te(15, 30, 120, 120)

the second one will override the first at start time 15. (The tempo in this example will be 60 until beat 10, then move exponentially from 90 to 60 through beat 20. This, however will be interrupted and, at beat 15, the tempo will be reset to 120.)

Tempos can only be defined in the global-area and affect all i- blocks thereafter, unless a new tempo definition (or set of definitions) are listed.

Tempo data is global and will remain in effect across all i-blocks until the end of the global score-time. When complex tempo scenarios arise, it is advised to debug them by invoking the "-t" command-line option -- this gives verbose information about tempo changes and events. To cancel a tempo change, that particular time-segment must be overwritten with another tempo change. If there is no tempo definition, the tempo defaults to 60 bpm.

Here is an example input file; the output is that written to the console by the "-t" command-line flag.

Input File:

te(10 20 60 120 V3) te(25 30 120 90 F) i1 = 4 0 35 { p2 1 p3 1 p4 mo(T 1. F 0 34) ;plot each beat }
"-t" Console Output:
Stored Tempos (There are 3 defs): 1: Stime 0.00, Etime 0.00, Stempo 60.00, Etempo 60.00, Type E 2: Stime 10.00, Etime 20.00, Stempo 60.00, Etempo 120.00, Type U, Vcurve = 3.00 3: Stime 25.00, Etime 30.00, Stempo 120.00, Etempo 90.00, Type F > Beat 0.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 1.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 2.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 3.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 4.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 5.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 6.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 7.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 8.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 9.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 10.00 Tempo = 60.00 Val = 1.00 (bts) 1.00 (secs) > Beat 11.00 Tempo = 60.06 Val = 1.00 (bts) 1.00 (secs) > Beat 12.00 Tempo = 60.48 Val = 1.00 (bts) 0.99 (secs) > Beat 13.00 Tempo = 61.62 Val = 1.00 (bts) 0.97 (secs) > Beat 14.00 Tempo = 63.84 Val = 1.00 (bts) 0.94 (secs) > Beat 15.00 Tempo = 67.50 Val = 1.00 (bts) 0.89 (secs) > Beat 16.00 Tempo = 72.96 Val = 1.00 (bts) 0.82 (secs) > Beat 17.00 Tempo = 80.58 Val = 1.00 (bts) 0.74 (secs) > Beat 18.00 Tempo = 90.72 Val = 1.00 (bts) 0.66 (secs) > Beat 19.00 Tempo = 103.74 Val = 1.00 (bts) 0.58 (secs) > Beat 20.00 Tempo = 120.00 Val = 1.00 (bts) 0.50 (secs) > Beat 21.00 Tempo = 120.00 Val = 1.00 (bts) 0.50 (secs) > Beat 22.00 Tempo = 120.00 Val = 1.00 (bts) 0.50 (secs) > Beat 23.00 Tempo = 120.00 Val = 1.00 (bts) 0.50 (secs) > Beat 24.00 Tempo = 120.00 Val = 1.00 (bts) 0.50 (secs) > Beat 25.00 Tempo = 120.00 Val = 1.00 (bts) 0.50 (secs) > Beat 26.00 Tempo = 114.00 Val = 1.00 (bts) 0.53 (secs) > Beat 27.00 Tempo = 108.00 Val = 1.00 (bts) 0.56 (secs) > Beat 28.00 Tempo = 102.00 Val = 1.00 (bts) 0.59 (secs) > Beat 29.00 Tempo = 96.00 Val = 1.00 (bts) 0.62 (secs) > Beat 30.00 Tempo = 90.00 Val = 1.00 (bts) 0.67 (secs) > Beat 31.00 Tempo = 90.00 Val = 1.00 (bts) 0.67 (secs) > Beat 32.00 Tempo = 90.00 Val = 1.00 (bts) 0.67 (secs) > Beat 33.00 Tempo = 90.00 Val = 1.00 (bts) 0.67 (secs) > Beat 34.00 Tempo = 90.00 Val = 1.00 (bts) 0.67 (secs) Line 12: T evaluated at = 35.00 35 events generated in block #1 (i1). Total i-block duration: 27.23 (secs), 34.00 (beats) Cummulative i-block duration: 27.23 (secs) Global cummulative duration of all i-blocks = 27.23 (secs)