Language reference

This reference documents all the reserved words in the lyd language, these a pre-existing sound sources and filters.

Arithmetic

Parantheses can be used to override or document precedence for the in-fix operations +,-,*,/,% and ^

+ - * / min max rcp sqrt ^ % abs neg

Sources

Sources are oscillators and other signal generators generate a time/sample dependent output and provides the changing elements of the equation expressed in the lyd language.

adsr ddadsr sin saw ramp square triangle pulse noise input time wave wave_loop abssin possin pulssin evensin evenpossin

Filters

Filters adjust various qualities of a signal, ranging from providing chorus to masking out portions of the signal.

reverb low_pass high_pass band_pass notch peak_eq low_shelf high_shelf

Mixers

Mixers

mix mix3 mix4 cycle nop

+

Adds values together value1 + value2

-

Subtracts values value1 - value2

*

Multiplies values, useful for scaling amplitude expression1 * expression2

/

Divides values, value1 / value2

min (expression1, expression2)

Returns the smallest of two values

max (expression1, expression2)

Returns the largest of two values

rcp (expression)

Returns the reciprocal (1/value)

sqrt (expression)

Performs a square root on the input value

^

Raises the value1 to the power of value2, value1 ^ value2

%

Floating point modulus, value1 % value2

abs (expression)

Makes the input value positive

neg (expression)

Negates input value

adsr (attack, decay, sustain, release)

ADSR Envelope - provides values in range 0.0-1.0 if oscillators are multiplied with an ADSR the amplitude will sink to 0.0 after release and the voice will be automatically freed after release when it no longer makes audio, sin(120)*adsr(0.3,0.3,0.8,1.5)

ddadsr (delay, duration, atack, decay, sustain, release)

DDADSR Envelope - like ADSR, but with delay and duration first

sin (hz)

Sine wave osicllator

saw (hz)

Sawtooth oscillator

ramp (hz)

Ramp oscillator, opposite of sawtooth.

square (hz)

Square wave oscillator equivalent to a pulse with pulse width 0.5, values varying between -1.0 and 1.0

triangle (hz)

Triangle waveform

pulse (hz, width)

Pulse oscillator to simulate square wave use a width of 0.5

noise ()

Noise generator produces evenly distributed values in the range 0.0 to 1.0

input ()

Used when implementing filters, acts as a signal source.

time ()

current time of sample running, in seconds

wave ('wave-identifier'[, hz])

PCM data oscillator, first argument is a string, second argument if present is gives pitch deviation determined by desired playback hz assuming sample recorded is middle-C, wave('test.wav') or wave('test.wav', 440.0)

wave_loop ('test.wav', hz)

Like wave() but loops the given sample, needs to be scaled with an adsr to be silenced.

abssin (hz)

OPL2 oscillator

possin (hz)

OPL2 oscillator

pulssin (hz)

OPL2 oscillator

evensin (hz)

OPL3 oscillator

evenpossin (hz)

OPL3 oscillator

reverb (amount, delay, signal)

Reverb filter

low_pass (gain, hz, bandwidth, signal)

Low pass filter, for performance reasons the parameters of filters are not varying with sample accurate precision but vary per chunk of processed audio (at least for each 256 samples).

high_pass (gain, hz, bandwidth, signal)

High pass filter

band_pass (gain, hz, bandwidth, signal)

Band pass filter

notch (gain, hz, bandwidth, signal)

notch filter

peak_eq (gain, hz, bandwidth, signal)

peak eq filter

low_shelf (gain, hz, bandwidth, signal)

low shelf filter

high_shelf (gain, hz, bandwidth, signal)

high shelf filter

mix (a,b)

Mixes two inputs averaging down amplitude

mix3 (a,b,c)

Mixes three inputs evenly

mix4 (a,b,c,d)

Mixes four inputs evenly

cycle (frequency, expr1, expr2[, expr3])

Cycles between provided input streams first argument gives frequency of source hopping.

nop

used internally for scalars, outputs the literal value supplied.