Gen Functions

Back to Main

Many of the parameters of PVCX have an 'Edit Function' button next to them. These parameters can be controlled by a function that changes over time. Clicking on the 'Edit Function' button will bring up a text field that you can put a function in to. There are six different types of functions.

The following help is taken from the Eastman Computer Music site at http://www.esm.rochester.edu/onlinedocs/pvc.ecmc.html, edited solely to remove UNIX/Linux-specific references.

In the following definitions, T = Time (in seconds) and V = value.

gen1 creates linear {straight line} segments

gen1 -Llength t1 v1 ... tN vN

gen2 generates harmonic waveforms from sine {a} & cosine {b} amps

gen2 -Llength [-o (default) or -c] a1 ... aN b0 ... bM N

gen3 generates amp values & linear connections at equally spaced time points

gen3 -Llength v1 v2 ... vN

gen4 generates exponenetial segments; "a" values determine shape & depth of curve: 0 = linear, neg. = exponential, pos. = inverse expo.

gen4 -Llength t1 v1 a1 ... tN vN

gen5 is like Csound gen 9 : harmonic1/amp/phase harmonic2/amp/phase

gen5 -Llength h1 a1 p1 ... hN aN pN

gen6 generates a table of random numbers between +1 and -1

gen6 -Llength


A quick tutorial on gen1 through gen5 is provided below. Those who want additional information on CMUSIC gen routines can consult Appendix D in F. Richard Moore's Elements of Computer Music text.

gen1 creates linear {straight line} segments

syntax: gen1 -Llength t1 v1 ... tN vN

Examples: Either of the following two lines would generate an identical result:

gen1 -L100 0 0 .5 2.5 1. 0

gen1 -L100 0 0 50 2.5 100 0

Result : the values ascend linearly from 0 to 2.5 half way through the table, then descend from 2.5 to 0 during the second half of the table


gen2 generates harmonic waveforms from alternating sine {a} & cosine {b} amplitude values. Generally, only sine values are used.

syntax: gen2 -Llength [-o (default) or -c] a1 ... aN b0 ... bM N

Example:

gen2 -L100 1. 0 1/3 0 1/5 0 1/7 0

Result: harmonics 1,3,5,7 in sine phase are created with proportions of a square wave


gen3 generates amplitude values and linear connections at equally spaced time points

syntax: gen3 -Llength v1 v2 ... vN

Example:

gen3 -L100 1 .35 1.2 0

Result: Values decrease linearly from 1. to .35 1/3 of the way through the table, then increase from .35 to 1.2 at 2/3 way through the table, then decrease from 1.2 to 0 at the end of the table


gen4 can be a powerful but complicated envelope generating routine to use because one must specify 3 values for each breakpoint except the last, where only 2 arguments are necessary. These arguments for each breakpoint are: time (t), value (v), and (a), which determines the slope of the curve between this breakpoint and the next. an a value of 0 specifies linear connection
negative a values (e.g. -1) specify exponential curves, where most of the change comes near the beginning of the following slope
positive a values (e.g. 1) specify inverse exponential curves, where most of the change comes near the end of the following slope

Syntax: gen4 -Llength t1 v1 a1 t2 v2 a2 ... tN vN

Example:

gen4 -L50 0 -2. 1 .33 4 1. .67 2.5 -1 1. 0

Result: Values in the table move with an inverse exponential slope from 02 to 4. over the first 1/3 of the table, then from 4. to 2.5 over the second third of the table, then exponentially from 2.5 to 0 over the final third of the table.


gen5 generates harmonic (or, less often, inharmonic) waveforms. The user specifies one or more partials, and for each partial, three arguments: the partial frequency (as a multiplier of a fundamental of 1), it's relative amplitude (on a scale of 0 to 1), and its phase (between 0 and 360 degrees). The resulting table numbers typically have values between +1. and -1.

Syntax: gen5 -Llength h1 a1 p1 ... hN aN pN

Three examples:

gen5 -L1000 1 1 0

Result: One cycle of a sine wave with values between +1. and -1.

gen5 -L1000 3 1 90 3

Result: Three cycles (the third harmonic) of a cosine wave (a sine wave with a 90 degree phase shift)

gen5 -L1000 2 1 0 4 .5 0 7 .2 0

Result: This produces a waveshape that includes harmonic 2 at 100 % amplitude, harmonic 4 at 50 % amplitude and harmonic 7 at 20 % amplitude