scoreproc.README

                      scoreproc - score processing utility

Command line options
====================

Usage of scoreproc can be printed by 'scoreproc -h'.

Syntax of program file
======================

A scoreproc program file can contain any number of score processing statements;
each statement is written in a separate line, with a list of arguments
separated by spaces or tabs. Comments start with "#" or ";".

Examples:

# comment
; another comment
blah -2 1.234e+5 .3 # statement "blah" with the arguments -2, 123400, and 0.3
  add 4 7.0         # white space before statement is ignored
mul  5    1.6       # arguments can be separated by any number of spaces / tabs

Score events
============

Events are read from a Csound score file, which has to be in sorted format (the
output of "scsort", or score.srt). Only i statements are recognized, all other
events (like tempo, function tables etc.) are ignored. The i statements are
stored as a list of note-on and note-off events.
Note-on events have the same p-fields as i statements in score files (i.e.
p1 = instrument number, p2 = start time, p3 = duration etc.), but also an
additional parameter p0, which stores the time offset (in beats) to p2. All
p-fields can be read and written.  Reading from a p-field that does not exist
returns zero, writes are ignored.
Note-off events exist only for notes with a non-zero, positive p3 value (i-time
only (p3 = 0) and held (p3 < 0) notes have no note-off). In the case of these
events, p2 stores the note-off time (which is actually (p2 + p3) of the
corresponding note-on event), while p0 is the note-off time offset. Other
parameters are the same as that of note-on events, however, only p0 can be
written.
When printing the output score file, p2 and p3 are modified by the time offset
(p0) parameter:
    p2 = p2 + (p0 of note-on)
    p3 = p3 - (p0 of note-on) + (p0 of note-off)
p3 is not changed if the note has no note-off (p3 <= 0). If the new p3 value
is zero, or negative, it is set to 1e-36 to avoid changing normal notes to held
or i-time only.

Score processing statements
===========================

pformat p fw [prec [l1 [l2]]]
-----------------------------

Set printing format for p-field p (>= 1). fw is the field width in characters,
prec is the precision (number of digits after the decimal point, >= 0). Values
are limited to the range l1 to l2 before printing (in the case of p3, zero and
negative values (i-time only and held notes) are always printed unchanged,
regardless of limits).
The default printing format is:
                    +-------------+-----------+-------------+-------------+
                    | Field width | Precision | Lower limit | Upper limit |
+-------------------+-------------+-----------+-------------+-------------+
| p1 (instrument):  |           1 |         0 |         1.0 |     1.0e+36 |
+-------------------+-------------+-----------+-------------+-------------+
| p2 (start time):  |          10 |         4 |         0.0 |     1.0e+36 |
+-------------------+-------------+-----------+-------------+-------------+
| p3 (duration):    |          10 |         4 |       0.001 |     1.0e+36 |
+-------------------+-------------+-----------+-------------+-------------+
| p4 (note number): |           3 |         0 |         0.0 |       127.0 |
+-------------------+-------------+-----------+-------------+-------------+
| p5 (velocity):    |           3 |         0 |         0.0 |       127.0 |
+-------------------+-------------+-----------+-------------+-------------+
| p6 and above:     |          10 |         4 |    -1.0e+36 |     1.0e+36 |
+-------------------+-------------+-----------+-------------+-------------+

mask mnum mode [p l1 l2 loop]
-----------------------------
Set event mask #mnum. There are 4 event masks, numbered 0 - 3; only notes that
match all event masks are processed, or printed. mode=0 disables the specified
mask; mode 1 will include events with the value of p-field "p" in the range of
(l1 + k*loop) to (l2 + k*loop) (k = any integer number for loop > 0.0, and 0 if
loop is zero or negative). In the case of mode 2, only events that are not in
this range are included.
By default, all masks are disabled.

Example:

mask 0 1 1 2.0 2.0 -1              # select instr 2 for processing
mask 1 1 2 -0.0001 3.9999 8.0      # 0<=p2<4, 8<=p2<12, 16<=p2<20, ...
add 3 0.1                          # increase note length by 0.1 beats
mask 0 0                           # clear masks, so all notes can be printed
mask 1 0

set p x
-------
Set the value of p-field p (p >= 0) to x.

add p x
-------
Add x to p-field p.

mul p x
-------
Multiply p-field p by x.

pow p x
-------
Raise p-field p to the x-th power.

quant p s [q]
-------------
Quantize function:
    x = z + (x - z) * q
where x is the value of p-field p, and z is the integer multiply of "s"
closest to x. The default value of "q" is zero, which means full quantization.

Examples:

# quantize start time and duration

quant 2 0.25 0.0
quant 3 0.25 0.3

# quantize start time and note-off time

modulate 0 0.0 1.0 0.0 0 2             # copy p2 to p0
quant 0 0.25 0.0                       # quantize to 0.25 beats
modulate 0 1.0 -1.0 0.0 0 2            # p0 = quantized value - p2
modulate 2 1.0 1.0 0.0 0 0             # p2 = quantized value
modulate 3 1.0 -1.0 0.0 0 0            # change length to correct note-off time
quant 3 0.25 0.0                       # quantize duration
limit 3 0.25 1.0e4                     # min. length is 0.25 beats
mul 0 0.0                              # clear p0

limit p l1 l2
-------------
Limit the value of p-field p to the range of l1 to l2.

seed x
------
Set random seed to any integer in the range 1 to 2^31 - 2. A value of zero
means seeding from current time (in microseconds or seconds, depending on
compile time settings).

modulate p mc mm mp mode ...
----------------------------
Modulate p-field "p" by another p-field, random noise, sine, or triangle / saw
wave, according to this formula:
    x = x * mc + y * mm + x * y * mp
where x is the value of p-field p, and y is the output of the modulator
function selected by "mode".
Available modes are:
  - mode 0, additional parameters: p2
    Modulate by the value of p-field p2.
  - mode 1, additional parameters: [w]
    Modulate by random numbers in the range -1.0 to 1.0. The distribution of
    output values (y) is abs(y)^(1/w - 1) if w > 0, and abs(1 - y)^(-1/w - 1)
    for negative w values. Setting w to 0, -1, or 1 will generate uniform
    distribution random numbers. The default value of w is 0.
  - mode 2 and 3, additional parameters: sp ep loop
    Modulate by y = sin (2PI * (sp + (ep - sp) * (p2 mod loop) / loop)). sp is
    the start phase (between 0 and 1), ep is the end phase, and loop is the
    loop time in beats. DC offset is removed, and the output is scaled to have
    a peak to peak amplitude of 2.0. If sp = ep, output will be zero.
    In the case of mode 3, this function is integrated (useful for modulating
    tempo).
  - mode 4 and 5, additional parameters: at loop
    Modulate by triangle / saw wave. Attack time (rise from -1 to 1) is
    (at / loop), and decay time is ((1 - at) / loop) in beats. Allowed values
    for at are in the range of 0 to 1. Mode 5 integrates the output.

Examples:

# randomize note length by +/- 10 percent

modulate 3 1.0 0.0 0.1 1 2.0           # noise distribution = 1/sqrt(x)

# modulate tempo with 1/4 cosine wave, depth = 2 percent, loop time = 4 beats

modulate 0 1.0 -0.02 0.0 3 0.25 0.5 4.0

AUTHOR
======

scoreproc-1.0 was written in July 2001 by Istvan Varga <iv@mailbox.hu>.

Back to scoreproc page

Back to home page