SoundComp language: Process
The description of a process, i.e. a network of process elements, determines how a voice that employs this process for sound generation, sounds.
This description shows how a network of elements, each doing some mostly mathematical operation on a number of signals, is interconnected.
Each process element has a number of inputs and a number of outputs. In general, each input and output has its unique semantics and is
unambiguously identified by its name.
The general structure of a process definition is:
process <name> { inputs <inputassignments> variables <variableslist> processes { processlist } outputs <outputlist> }
where
Process definitions is the part of the language with the largest - and still growing - number of terminal symbols, most of them representing a certain kind of mathematical operation:
Numbers can usually be floating point numbers with a period as decimal separator. No grouping symbol can be used.
Usual mathematical operators are:
+ - * / ^ = > < >= <= != <> ( )
in their usual meaning (^ being the "power" symbol).
generators:
sine, cosine, sawtooth, unitysawtooth, pwm, bwlpwm, bwlsawtooth, whitenoise, pinknoise:
These terminals denote signal generators. Signal generators create a certain basic "waveform" signal which the name aims to describe; there are inputs for
frequency (how fast does the generator oscillate)
phase offset (for popular effects like "FM synthesis" that in most cases are misnamed "phase distortion" effects)
synchronization (phase reset on a 0->1 transition; some generators fix the phase as long as synchronization stays active)
synchronization phase (the phase that the signal is set to when a synchronization occurs)
asymmetry/duty cycle: some generators allow to make the signal appear asymmetric, the input ranges from 0 to 1, 0.5 being the symmetric case. Note that the phase offset can influence the behaviour.
Not all signal generators support all inputs.
The generators create the following signals: sine: a simple sine generator with a single output
cosine: a dual phase sine generator with an additional output phase shifted by pi/2.
sawtooth: A signal rising linearly from -1 to 1, then suddenly falling back to -1
unitysawtooth: a signal rising linearly from 0 to 1, then suddenly falling back to 0
pwm: a signal jumping back and forth between 0 and 1
whitenoise: a noise signal with a strong emphasis on high frequencies
pinknoise: a noise signal without a strong emphasis on high frequencies
bwlpwm, bwlsawtooth: bandwidth limited versions of pwm and sawtooth: Bandwidth limiting applies already within the signal generation, thereby avoiding a large portion of aliasing frequencies. These tend to sound "clearer" than the unlimited and thereby aliasing variants.
soundbank (not yet implemented): a generator that creates signals from input files, changing the pitch via tdhs or PSOLA
envelope:
An envelope generator (the well known ADSR generator). Inputs are:
attack (speed)
decay (speed)
sustain (level 0-1)
release (speed)
* gate (binary signal)
More complex envelopes can be generated by combining multiple ADSR signals through delay/addition/multiplication.
Envelopes are usually used to modulate the signal, either by simple multiplication (amplitude modification), or by using the envelope level to achieve some other kind of manipulation, for example a filter edge frequency.
A rather strange but valid way to use an envelope generator would be to take a PWM sound as a source (on the gate) and use the envelope generator (with unusally short attack, decay, release times) to distort the PWM signal.
Mathematical constants:
pi, e, NaN, samplerate
* sometimes in formulas you might need to refer to natural constants, create an invalid number or refer to the global sample rate.
Mathematical functions:
sin, asin, sinh, cos, acos, cosh, tan, atan, tanh, exp, log2, log10, log, sqrt, sign, int, round:
The set of trigonometric functions is a little redundant, to ease using them.
Note that "sin" is a mathematical function which takes exactly one nameless parameter, whereas "sine" is a signal generator with larger set of named parameters and an internal state. The same applies to other similar symbols as well, don't mess them up.
The decimal number after a logarithm indicates the base; log without a number means natural logarithm.
Signal shapers:
third, clip, (envelope as described above), aliaser, quantizer
Filters:
pinkfilter: A filter with a good approximation of a 3dB/octave low pass response over almost the whole audible range. Used in pinknoise to create pink from white noise, but can also be used separately.
svf: a state variable filter: has a signal input, an edge frequency control input, a Q factor input. Separate outputs for band pass, low pass, high pass.
parametricallpass: an all pass variant with signal, Q and edge frequency input. Can be used to create low pass, high pass, band pass, notch filters by different linear combinations with the input signal.
pseudohilbert: a filter with an almost constant amplitude response and a phase shift of 90 degreees. Usually used in kinds of "trigonometric trickery"
Other signal manipulators:
freqshift: shift all frequencies by a constant frequency offset
tdhs: shift all frequencies by a constant factor
PSOLA (not yet implemented): shift all frequencies by a constant factor (alternative algorithm)
flanger (not yet implemented)
phaser (not yet implemented)
chorus (not yet implemented)
Besides these terminals, the names of inputs can be used; in addition, the outputs of subprocesses can be referred to in the form
<subprocessname>.<outputname>