seam.basic.lib

SEAM Basics library. Its official prefix is sba.

Reusable low-level building blocks that EXTEND the standard Faust basics.lib: only elements not already provided upstream are kept here.

References

Sweep Functions

Ramp/counter generators used across SEAM instruments.


(sba.)sweep

Repeating sample counter. Differs from ba.sweep: it counts from 0 to (p*t)-1 (via the 1' seed) rather than starting at 1, and uses p*t as the period.

Usage

sweep(p,t) : _

Where:

  • p: base period in samples
  • t: period multiplier (final period is p*t)

Test

sba = library("seam.basic.lib");
sweep_test = sba.sweep(1,10);

(sba.)lsweep

Linear sweep from 0 up to Nyquist (ma.SR/2), repeating every sec seconds.

Usage

lsweep(sec,t) : _

Where:

  • sec: sweep duration in seconds
  • t: period multiplier

Test

sba = library("seam.basic.lib");
lsweep_test = sba.lsweep(0.01,1);

(sba.)zsweep

Zero-padded sweep: a sweep of length p preceded by p samples of zero, yielding a 2p+1 frame useful for zero-padded spectral analysis.

Usage

zsweep(p) : _

Where:

  • p: sweep length in samples

Test

sba = library("seam.basic.lib");
zsweep_test = sba.zsweep(10);

(sba.)zerox

One-sample pulse on a rising zero crossing (negative -> non-negative). A directional variant of ma.zc, which fires on any crossing.

Usage

_ : zerox : _

Where the input is any signal; output is 1 for one sample at each upward zero crossing, 0 otherwise.

Test

os = library("oscillators.lib");
sba = library("seam.basic.lib");
zerox_test = os.osc(1000) : sba.zerox;

List Functions


(sba.)revlist

Parallel bus of n constants counting DOWN: n, n-1, ... , 1.

Usage

revlist(n)

Where:

  • n: number of parallel outputs (compile-time constant)

Test

sba = library("seam.basic.lib");
revlist_test = sba.revlist(23);

(sba.)lrev

Reverse a list-literal: the parallel bus (x0,x1,...,xn) becomes (xn,...,x1,x0). Generalizes revlist (which only generates a descending counter) to any list of values.

Usage

lrev((x0,x1,...,xn))

Where:

  • the argument is a list-literal (compile-time parallel expression)

Test

sba = library("seam.basic.lib");
lrev_test = sba.lrev((10,20,30));

(sba.)lrot

Cyclically rotate a list-literal by k: ((1,2,3,4),1) becomes (2,3,4,1). k is taken modulo the list length, so any integer is valid; positive k rotates left, negative rotates right.

Usage

lrot((x0,x1,...,xn), k)

Where:

  • the first argument is a list-literal
  • k: rotation amount (compile-time integer)

Test

sba = library("seam.basic.lib");
lrot_test = sba.lrot((1,2,3,4),1);

Scaling


(sba.)scalel

Linear (affine) rescale of x from input range [a,b] to output range [c,d].

Usage

_ : scalel(a,b,c,d) : _

Where:

  • a, b: input range (min, max)
  • c, d: output range (min, max)

Test

os = library("oscillators.lib");
sba = library("seam.basic.lib");
scalel_test = os.osc(1000) : sba.scalel(-1,1,0,1);

(sba.)scalee

Exponential (geometric) rescale of x from input range [a,b] to output range [c,d]. Perceptually uniform — a linear control sounds even — so it is ideal for frequency and gain. The curve is fixed by the ratio d/c.

Requires c and d non-zero and of the same sign; for ranges that include zero use scalec.

Usage

_ : scalee(a,b,c,d) : _

Where:

  • a, b: input range (min, max)
  • c, d: output range (min, max), same sign, non-zero

Test

os = library("oscillators.lib");
sba = library("seam.basic.lib");
scalee_test = os.osc(1) : sba.scalee(-1,1,20,20000);

(sba.)scalec

Curved (power) rescale of x from [a,b] to [c,d], shaped by curve: curve=1 is linear, curve>1 eases in (slow start), curve<1 eases out (fast start). Works for any output range, including c=0. Keep x within [a,b] (a negative normalized base with a fractional curve is undefined).

Usage

_ : scalec(a,b,c,d,curve) : _

Where:

  • a, b: input range (min, max)
  • c, d: output range (min, max)
  • curve: curvature exponent (>0); 1 = linear

Test

os = library("oscillators.lib");
sba = library("seam.basic.lib");
scalec_test = os.osc(1) : sba.scalec(-1,1,0,1,2);