Skip to content

Drawn Mathematical Reference

atom edited this page Sep 3, 2026 · 1 revision

Drawn Mathematical Reference

This page owns the exact v3 Drawn construction, transform, selector, numerical, and authority contracts. For first use, see Drawn Waveform. For practical importable shapes, see Drawn Wave-Shape Recipes.

Canonical pipeline

A current numeric recipe executes in this order:

data
→ resample_mode
→ wrap          (where meaningful)
→ canonical bounded 512-sample Float32 Drawn waveform
→ transform     (optional)
→ normalise     (optional final gain)
→ final bounded 512-sample Float32 Drawn waveform

The defining stage-boundary rule is:

A ; B == canonical-materialise(A) ; B

A stage-2 transform consumes the exact canonical 512-sample Float32 stage-1 table. It does not receive sparse authored anchors, private Float64 work arrays, or temporary pre-admission overshoot.

Stage 1: resample_mode

resample_mode answers:

Given these authored points, what completed Drawn waveform do they describe?

Current schema-13 construction vocabulary includes:

  • linear
  • steps
  • pow
  • pow-symmetric
  • superellipse
  • cardinal
  • cardinal-limit
  • cardinal-clip
  • fourier / fourier-clip

The table below gives the values or selectors each operation accepts. Fourier can be used in either resample_mode or transform; Haar and Walsh are used in transform.

Drawn operations and defaults

Use this table to answer three practical questions: where does the operation go, what kind of value or selector can it take, and what happens when the operation name is written without one?

Numeric values are written after =, for example steps=0.3 or cardinal=-0.5. Decimal values are allowed for the construction controls. Fourier, Haar, and Walsh selectors use whole-number component numbers only, for example fourier=:8,-3. The Default column shows the value or selector used when the operation name is written by itself.

Operation Use in Value or selector Default What it does
linear resample_mode no value no value Connects authored points with straight lines.
steps resample_mode number from −1 to +1; decimals allowed 0 0 gives exact held Steps. Nonzero values slew between held-state boundaries; ±1 meets wrapped Linear.
pow resample_mode any nonzero number; decimals allowed 2 Signed Power interpolation. ±1 is Linear.
pow-symmetric resample_mode any nonzero number; decimals allowed 2 Symmetric signed-Power interpolation. ±1 is Linear.
superellipse resample_mode positive: 1 or more; negative: −1 or less; decimals allowed 2 Generalised superellipse interpolation. ±1 is Linear; ±2 are exact circle-in/out.
cardinal resample_mode number from −1 to +1; decimals allowed 0.621864 Signed Cardinal interpolation, with proportional whole-wave fitting only if the result needs to be brought inside ±1.
cardinal-limit resample_mode number from −1 to +1; decimals allowed 0.621864 The same Cardinal scale with local rail-safe tangent limiting.
cardinal-clip resample_mode number from −1 to +1; decimals allowed 0.621864 The same Cardinal scale followed by hard clipping at ±1.
fourier resample_mode or transform whole-number component selector, 0–256 0: Selects Fourier components.
fourier-clip resample_mode or transform whole-number component selector, 0–256 0: Same selection as Fourier, with hard clipping if the reconstruction overshoots ±1.
haar transform whole-number band selector, 0–9 0: Selects Haar bands. Band 0 is mean/DC; bands 1–9 run from coarsest to finest dyadic detail.
haar-clip transform whole-number band selector, 0–9 0: Same Haar selection, with hard clipping if the reconstruction overshoots ±1.
walsh transform whole-number sequency selector, 0–511 0: Selects Walsh-Hadamard components in sequency order.
walsh-clip transform whole-number sequency selector, 0–511 0: Same Walsh selection, with hard clipping if the reconstruction overshoots ±1.

For Fourier, Haar, and Walsh, 0: means the full selector range. Writing only the operation name—fourier, haar, or walsh—has the same effect. See Shared selector grammar for selecting ranges, individual components, and inverted components.

Construction controls are numbers rather than fixed integer steps: values such as steps=0.3, steps=-0.1375, or cardinal=0.79 are valid. FWG examples use a leading zero before the decimal point for readability and consistency. Selector component numbers are whole numbers.

Pipeline-field defaults

These fields control the Drawn pipeline around the operations above:

Field What it controls If it is not specified
resample_mode How authored data becomes the stage-1 Drawn waveform linear is used.
wrap Whether stage-1 construction connects the last authored point back to the first Off by default for Linear, Power, Power Symmetric, Superellipse, and the Cardinal family. Steps and Fourier turn wrap on by definition.
transform An optional second operation on the completed canonical 512-sample stage-1 waveform No transform is applied.
normalise Optional final uniform peak gain after construction and any transform Normalisation is off.

For Steps and Fourier, the mode itself turns wrap on. You do not need to write wrap:true, and writing wrap:false does not turn it off. Haar and Walsh operate after stage 1 on the completed 512-sample waveform, so wrap does not apply to them.

The stricter distinction between an absent field and explicit JSON null is covered under Omitted fields versus JSON null.

Numeric point-count mapping

Current schema-13 construction data is normally limited to 1–512 authored amplitudes. Exactly 512 values are literal for ordinary/local construction modes; shorter sequences are reconstructed according to their mode. The deliberate exceptions are Fourier/Fourier-clip, which may analyse an exact 512-value table, and dense non-wrapped Linear, which may accept more than 512 source values.

One value. Local modes fill the 512-sample Drawn table with that value.

2–511 values with open Linear. The values are evenly spaced from the first stored sample to the last and connected by straight lines. [1,-1] therefore becomes a falling ramp whose playback seam jumps back to +1.

2–511 values with Steps. Every authored value is an equal-duration held state. [1,-1] gives 256 samples of +1 followed by 256 samples of −1. With source counts that do not divide 512 evenly, state lengths differ by at most one sample.

More than 512 values. Only non-wrapped linear has a defined dense-contour interpretation, up to 65,536 numeric values subject to ordinary import limits. FWG reduces that over-resolved piecewise-linear contour into the 512-sample Drawn surface. Wrapped Linear, Steps, and sparse mathematical constructions do not silently invent another downsampling meaning.

Numeric data must contain JSON numbers. Strings, null, and non-finite values are not silently coerced. Finite authored amplitudes outside ±1 are clipped at the Drawn input boundary.

These authored-point-count rules belong to stage 1. Haar, Walsh, and stage-2 Fourier do not receive the original authored point count: they always consume the completed canonical 512-internal-cycle-sample Float32 waveform produced at the stage-1 boundary.

Detailed stage-1 construction behavior

steps — exact holds, analogue-style slew, and signed boundary-to-boundary curves

Musician starting point: soften a square-wave edge

A two-state Drawn waveform is the simplest way to hear what parameterised Steps does:

{
  "data": [-1, 1],
  "resample_mode": "steps=-0.1",
  "wrap": true
}

Exact steps zero square wave compared with a steps minus 0.1 square wave whose edges have finite curved slew

Importable steps=-0.1 slew recipe

steps=0 is the mathematically exact square: the output jumps instantaneously between the two authored states. steps=-0.1 is one useful classic-synth-style slew example. It begins moving immediately after each state boundary, moves fastest near the edge, then progressively settles toward the new level. The waveform therefore keeps much of its square/pulse character without requiring an infinitely vertical transition.

That fast-starting, gradually settling edge resembles a common RC-like slew shape found around real analogue oscillator and waveform-shaping circuitry. FWG is emulating that broad analogue behaviour, not claiming a component-level model of one particular vintage synthesizer. The complementary steps=+0.1 puts most of the movement late in the interval instead.

There is no preferred slew value or preferred sign. The value must remain between −1 and +1. Decimal values are welcome, including -0.05, -0.1375, 0.083, or scientific notation. Smaller nonzero magnitudes stay nearer a hard step; larger magnitudes spend more of each state interval moving; the two signs place that movement on complementary sides of the same cyclic state boundaries. Audition both signs and change the amount by ear.

Exact square compared with several negative Steps slew amounts, showing progressively broader finite transitions

The diagram above deliberately uses only one sign so the amount is easy to read. The earlier comparison shows steps=-0.1 and steps=+0.1 together; neither sign is more correct. By steps=±1, both directions meet the wrapped-linear triangle endpoint.

Engineering reference

Bare steps and steps=0 are exact held-state reconstruction. The authored values divide the cycle into equal-duration states:

{
  "data": [-1, 1],
  "resample_mode": "steps",
  "wrap": true
}

At the 512-internal-cycle-sample core this is exactly:

  • samples 0–255: -1;
  • samples 256–511: +1.

That is a mathematically exact discrete 50% square wave under this phase convention. There is no curved approximation in steps=0: each state is held exactly until the next state begins.

Parameterized Steps keeps the same ideal equal-duration cyclic state boundaries but bends the interval between them. For any nonzero value between −1 and +1:

p = 1 / |steps|
  • steps>0 uses the existing positive Power direction u^p: slow start, fast finish;
  • steps<0 uses the complementary negative Power direction 1-(1-u)^p: fast start, slow finish;
  • each authored value is an ideal boundary anchor at the beginning of its equal-duration state interval, and the continuous curve reaches the next authored boundary exactly;
  • when an ideal boundary falls between two of the 512 internal-cycle-sample positions, the sampled table does not invent an extra sample merely to hit it;
  • the final authored value connects back to the first through the cycle seam in exactly the same way.

For a single state-to-state interval, the signed function curves make the symmetry easier to see:

Overlaid parameterised Steps progress functions for negative and positive values with the linear endpoint between them

The graph is normalised to one interval: horizontal position is progress between two fixed state boundaries and vertical position is progress from the old state to the next one. It is an engineering view of the same slew heard in the square-wave examples.

This gives useful landmarks without inventing another scale:

Steps value Internal Power exponent Character
0 special case exact classic Steps / exact holds
±0.5 2 complementary quadratic bends
±0.333333… 3 complementary cubic bends
±0.25 4 complementary fourth-power bends
±1 1 linear

steps=+1, steps=-1, and wrapped linear are mathematically identical without a special case: both signed Power expressions reduce to u when p=1. The signed symmetry therefore meets at ±1 = linear, while 0 remains the deliberately separate exact zero-order-hold construction. Smaller nonzero magnitudes become increasingly step-like.

Relationship to pow: deliberate alias, different control language

Nonzero parameterised Steps does not introduce another interpolation geometry. It deliberately re-uses wrapped signed Power through the reciprocal parameterisation:

steps=N  ==  pow=1/N, wrap:true     for nonzero N when 1/N is finite

So steps=-0.05 is exactly the same reconstruction as pow=-20 with wrap:true; steps=0.5 is exactly wrapped pow=2; and steps=-1 is exactly wrapped pow=-1, which is linear. At extraordinarily small nonzero N where the reciprocal overflows ordinary finite-number representation, FWG follows the corresponding signed infinite-exponent sampled limit.

The duplicate geometry is intentional because the two parameterisations answer different authoring questions. pow=N exposes the curve exponent directly. steps=N treats exact held Steps as the centre of a slew control: 0 is the exact hold, small magnitudes add a little curved movement, and ±1 reaches linear. steps=0 is therefore the one member of the Steps family with no finite pow equivalent.

The feature began as an experiment in reproducing the finite slew and rounded edges associated with classic analogue oscillator waveforms. The reciprocal Steps spelling keeps that use-case readable even though the nonzero curves are mathematically the same wrapped signed-Power curves. Values around ±0.3, for example, produce useful complementary curves that are neither a hard step nor ordinary linear interpolation.

Steps is intrinsically cyclic. Imported wrap:true, wrap:false, wrap:null, or an omitted field all use the same effective cyclic topology, and canonical Steps construction records use "wrap": true.

Exactly 512 authored values remain literal Drawn state and bypass sparse reconstruction, including parameterised Steps.

Why a few values can be musically useful

A mathematical ideal is a reference point, not automatically the preferred synthesizer waveform.

Physical hardware cannot produce abstract mathematical functions with infinite precision or bandwidth. Oscillator topology, component selection and tolerance, calibration, age, temperature, and — depending on design and environment — humidity can affect a real instrument. Digital instruments introduce their own sampling, interpolation, quantisation, filtering, and algorithmic behaviour.

“Distortion” is the technically correct term for departure from an intended or ideal signal, even when the result is desirable. Classic synthesizers are not prized because their nominal sine, triangle, saw, and square waves are mathematically perfect; characteristic departures from those ideals are often part of the instrument's sound.

Drawn makes that territory deliberate and calculable. Being close to a familiar waveform while retaining controllable differences can be exactly the useful result. Change a reconstruction value, add a point, remove a point, change clipping, or keep only part of a Fourier spectrum and the result becomes another waveform to audition rather than a failed version of an ideal.

A sine is a starting point, not one recipe

Several sparse constructions can land on a sine or a very close sine-like waveform for different reasons:

  • [-1,1] with wrapped pow-symmetric=1.7503 gives a two-anchor sine/cosine-like cycle;
  • [0,1,0,-1] with bare cardinal uses four quarter-cycle landmarks and neighbour-aware cubic tangents to make another very close sine-like cycle;
  • the same four landmarks with bare cardinal-limit produce the same near-sine here, because the ordinary Cardinal tangents still fit inside the available rail headroom;
  • [0,1,0,-1] with fourier reconstructs a mathematically exact sine to Float32/numerical precision from those four periodic samples.

Pure sine overlaid with phase-aligned pow-symmetric, Cardinal, and Fourier sparse reconstructions

Once the reference is familiar, the reconstruction family becomes a way to add character rather than a contest to reproduce the ideal. Raising pow-symmetric can increase dwell near the extrema; cardinal-limit can spend the available tangent headroom without ever letting the continuous cubic leave ±1; cardinal-clip can turn stronger neighbour-aware cubic excursions into flatter peaks; changing one Fourier landmark changes the whole periodic spectral reconstruction rather than only one local segment.

Pure sine compared with pow-symmetric, cardinal-clip, and edited Fourier character variations

The four-point sine landmarks also make the three Cardinal treatments easy to compare directly. At the bare default, cardinal-limit is the same near-sine as cardinal because no tangent needs limiting. Push the shared Cardinal control harder and the treatments separate:

Cardinal, cardinal-limit, and cardinal-clip compared on the same four sine landmarks

On this particular [0,1,0,-1] source, cardinal-limit uses all available tangent headroom by about N=0.752204 (raw Cardinal amount 3). Larger positive values through +1 therefore produce the same rail-safe limited curve for this source. Other authored amplitudes can leave more or less tangent headroom, so that saturation point is waveform-dependent rather than a general Cardinal-limit ceiling. The importable cardinal-limit=0.860022 example is here.

These shapes are also useful as modulation contours. Import or construct one in Drawn, use the same Drawn table as a Scanning LFO, then vary LFO Rate and Depth. Slow modulation makes the curvature differences easy to follow; audio-rate use reveals their waveform character. The detailed recipes and importable JSON are collected on Drawn Wave-Shape Recipes.

wrap

For Linear, Power, Power Symmetric, Superellipse, and the Cardinal family, wrap is off unless you turn it on with:

"wrap": true

With wrap off, reconstruction runs from the first authored amplitude to the last. With wrap on, the authored amplitudes become cyclic anchors and the final anchor connects back to the first using the same reconstruction rule; no duplicate closing amplitude is required.

For example:

{
  "data": [-1, 1],
  "resample_mode": "linear",
  "wrap": true
}

constructs a complete triangle: one straight rise and one straight return.

Steps and Fourier turn wrap on themselves. You do not need to specify wrap:true for either mode, and wrap:false does not turn it off.

Haar and Walsh are stage-2 transforms, so wrap does not apply to them.

pow

pow is FWG's signed one-sided power-law family. For normalized segment position t from 0 to 1:

pow=+p  -> t^p
pow=-p  -> 1 - (1-t)^p

where p is any nonzero number. Bare pow means pow=2.

Positive and negative values are complementary one-sided curves. pow=+1 and pow=-1 are mathematically exact linear interpolation.

This family supplies accelerating or decelerating ramps, envelope-like contours, asymmetric waveform slopes, and near-step continuous transitions. The normalized exponential comparison family remains a useful landmark: if E_k(t)=(exp(k·t)-1)/(exp(k)-1), then its exact time-complement is 1-E_k(1-t)=E_-k(t).

pow-symmetric

pow-symmetric applies a piecewise power rule around each segment midpoint. Positive values produce symmetric in-out geometry; negative values produce complementary out-in geometry. Bare pow-symmetric means pow-symmetric=2.

pow-symmetric=±1 is mathematically exact linear interpolation.

With only [-1,1] and wrap:true, changing one value already crosses familiar oscillator territory:

  • pow-symmetric=1 — exact triangle;
  • about 1.7503 — very sine/cosine-like;
  • larger positive values — progressively more soft-square-like.

That continuum is one reason the parameterized family is more useful than a fixed “cosine” alias.

superellipse

For positive n:

superellipse=+n

uses:

1 - (1 - t^n)^(1/n)

and a negative value selects its exact time-complement. The value must be 1 or greater in magnitude: 1, 1.5, 2, and so on, or the negative equivalents. Bare superellipse means superellipse=2.

Important landmarks:

superellipse=+1  == linear
superellipse=-1  == linear
superellipse=+2  == circle-in
superellipse=-2  == circle-out

Those relationships are mathematically exact. Larger magnitudes extend into stronger geometric curvature and near-rectangular trajectories that fitted pow curves do not duplicate closely enough.

cardinal, cardinal-limit, and cardinal-clip

All three modes begin with the same signed neighbour-aware cubic Hermite/Cardinal tangent. Instead of deciding each segment only from its two endpoints, neighbouring authored amplitudes help determine the shared tangent through each point.

The Cardinal value can be any number from −1 through +1. All three Cardinal variants use exactly the same parameter mapping before they differ in overshoot treatment. Internally, FWG maps N to the raw tangent multiplier:

raw_amount = N / (1 - (255/256) * abs(N))
m_i = raw_amount * (y_(i+1) - y_(i-1)) / 2

The mapping puts the useful low/moderate Cardinal action across most of the public ±1 range while retaining the former extreme raw ±256 tangent states at N=±1. Musicians do not need the internal multiplier to use the mode; the JSON parameter itself is the control.

Bare cardinal, bare cardinal-limit, and bare cardinal-clip all mean:

N = 0.621864

That default was chosen for the established four-point near-sine shape; the decimal itself has no special mathematical significance.

A useful landmark is:

{
  "data": [0, 1, 0, -1],
  "resample_mode": "cardinal",
  "wrap": true
}

At the current 512-internal-cycle-sample core, bare cardinal on those four phase landmarks is extremely close to a pure sine: RMS amplitude difference is about 0.00297, with Pearson correlation about 0.999993.

cardinal: preserve the raw trajectory, then fit if necessary

cardinal=N permits the raw cubic to overshoot the normal ±1 rails in its temporary mathematical workspace. Before that result becomes Drawn state, FWG measures the completed sampled peak. A peak above 1 causes one proportional whole-wave attenuation; a quieter reconstruction is never amplified at this stage. DC is scaled by the same factor. Optional final normalise:true is a separate later operation.

cardinal-limit: restrain the trajectory before drawing it

cardinal-limit=N keeps the signed raw Cardinal tangent direction, but limits each shared anchor tangent according to the amplitude headroom available at that authored point. A cubic-Hermite tangent m_i is equivalent to cubic-Bézier control offsets of ±m_i/3; FWG applies:

|m_i| ≤ 3 × (1 − |y_i|)

That bound keeps both Bézier controls owned by the shared C1 anchor tangent inside Drawn's ±1 amplitude rails. The entire cubic segment then remains inside ±1 by the Bézier convex-hull property. No whole-wave attenuation or hard-clipped plateau is required.

Negative values remain meaningful: they retain Cardinal's reverse-pointing curvature wherever the authored amplitude leaves enough headroom. At an authored +1 or -1 point, outward tangent headroom is necessarily zero. cardinal-limit=0 is the exact zero-tangent cubic state. Whenever the raw Cardinal tangents already fit their local headroom, cardinal-limit=N is mathematically the same Cardinal curve, apart from ordinary floating-point evaluation order.

cardinal-clip: preserve the raw trajectory, then clip it

cardinal-clip=N performs the same raw signed Cardinal reconstruction as cardinal=N, then hard-clips values outside [-1,+1] before Drawn admission. This can deliberately create flat rail plateaus.

The three modes therefore answer the same overshoot problem differently:

Mode What happens to an excessive Cardinal excursion?
cardinal Keep the trajectory; proportionally attenuate the completed waveform if its sampled peak exceeds 1.
cardinal-limit Reduce the local shared tangent enough that the continuous cubic stays inside ±1.
cardinal-clip Keep the trajectory; hard-clip the part that crosses ±1.

With [0,1,0,-1], cardinal-limit=0.860022 (approximately the former raw amount 6 example) is therefore neither the proportionally fitted cardinal=0.860022 nor the flat-railed cardinal-clip=0.860022. On irregular or mid-rail authored data, signed negative values can retain much stronger reverse curvature because they have more amplitude headroom before the limiter intervenes.

The exact-512 rule

For ordinary/local construction modes, exactly 512 authored numeric values are already a complete Drawn table, so their geometry is literal rather than re-interpolated.

Fourier/Fourier-clip are the deliberate exception when used as resample_mode: an exact 512-value source remains useful Fourier analysis input, so Fourier analyses it instead of being bypassed.

This makes it possible to export a generated 512-sample waveform, relabel or extend its construction with Fourier selection, and spectrally dissect the existing complete waveform without deleting an arbitrary sample.

Omitted fields versus JSON null

Omission is the normal way to say that an optional pipeline stage is unused.

  • omitted wrap or wrap:null uses the ordinary local default false;
  • omit transform for no stage-2 transform; transform:null and transform:"" are invalid when the field is present;
  • omit normalise (or use normalise:false) for no final normalisation; normalise:null is invalid.

The asymmetry is deliberate. wrap:null is retained as a tolerant topology/default spelling, while a present transform or normalise field is an explicit authoring instruction and must contain a valid value.

Stage 2: transform

transform answers:

Given this complete 512-sample waveform, which basis components should rebuild it?

The v3 collection is:

  • fourier / fourier-clip
  • haar / haar-clip
  • walsh / walsh-clip

Only one optional transform stage is supported. Local construction modes such as linear, steps, pow, or cardinal are not valid transform names. A present malformed or unknown transform fails visibly.

Shared selector grammar

Fourier, Haar, and Walsh use one component-selector language:

Syntax Meaning
N select exactly component N
-N select exactly component N and invert its coefficient/polarity
:B select 0 through B inclusive
A: select A through the highest component available to that transform
A:B select A through B inclusive
comma union of terms

Examples:

fourier=3
fourier=-3
fourier=:8,-3
fourier=3:12,20,-7

haar=:5,-5
haar=6:

walsh=15:
walsh=:80,-37

If a normally selected range also contains a negatively named component, inversion wins for that component. Thus:

haar=:5,-5

selects bands 0 through 5 and reverses band 5's contribution.

Negative numbers are inversion terms, not negative range endpoints. Range endpoints are non-negative.

Selector numbers are whole numbers. N, A, and B refer to a Fourier component, Haar band, or Walsh sequency as appropriate.

A selected component contributes whatever that component contains in the current waveform. If its coefficient is zero, it contributes zero. In direct sparse stage-1 Fourier, a valid selector may also name an order above those physically available from that particular sparse input; that order likewise contributes zero rather than causing an error.

Component 0 and -0

Component 0 is meaningful in every basis:

  • Fourier 0 is DC.
  • Haar 0 is the mean/DC band.
  • Walsh 0 is the constant sequency component.

-0 is therefore valid and selects only component 0 with its coefficient sign inverted.

Fourier

Fourier represents the completed waveform with global sinusoidal harmonic components.

For a 512-sample real Drawn waveform, Fourier has 257 selectable components:

  • 0 — DC
  • 1 through 255 — ordinary harmonic orders
  • 256 — Nyquist

The selector range is therefore 0…256. Values above 256 are invalid.

Sparse stage-1 availability

An N-point real sparse Fourier source physically contains only the unique orders available from that N-point DFT. The selector language still accepts the full 0…256 range.

A syntactically valid requested order that is unavailable in the particular sparse source contributes zero. It is not clamped to a different harmonic and does not make the recipe invalid merely because the source has fewer available orders.

Circular shift behavior

A circular shift of a completed waveform preserves Fourier harmonic magnitudes while rotating harmonic phase. Selecting the same harmonic numbers therefore follows the shifted waveform's phase without redistributing magnitude between harmonic orders.

Sparse Fourier as stage 1 and Fourier as stage 2 are not redundant. Sparse stage-1 Fourier performs the DFT of the authored sparse samples. linear ; fourier, cardinal ; fourier, and similar pipelines first construct a canonical 512-sample waveform and analyse that completed waveform instead.

Haar

Haar is a local dyadic wavelet transform. It represents the waveform with a mean plus progressively finer local differences.

For the fixed 512-sample stage there are ten bands:

  • 0 — mean/DC
  • 1 — coarsest detail
  • 9 — finest detail

Thus haar=:4 keeps the mean and coarser detail while haar=9 selects only the finest detail band.

On smooth material, retaining coarse Haar bands often produces a characteristic block/staircase result. This is not ordinary uniform amplitude quantisation; it comes from Haar's fixed dyadic local averages and differences.

Haar alignment sensitivity

Haar is alignment-sensitive. Its basis has fixed half-, quarter-, eighth-cycle and finer dyadic partitions. Circularly shifting the same completed waveform can move features across those boundaries and redistribute energy between Haar bands.

This differs from Fourier circular shifts, which preserve harmonic magnitudes while rotating harmonic phase.

FWG performs no hidden Haar phase correction. Phase/orientation remains upstream in the completed Drawn waveform; Haar analyses exactly the 512 internal cycle samples it receives.

Why Haar is a transform rather than a resample mode

A sparse Haar resample_mode would require FWG to invent a construction policy for non-dyadic input. The two-stage model keeps that policy explicit: choose Steps, Linear, Cardinal, Fourier, or another stage-1 construction, then apply Haar to the completed waveform.

Walsh-Hadamard

Walsh uses global rectangular ±1 basis functions rather than Fourier sinusoids or Haar local wavelets.

FWG exposes all 512 components in sequency order, numbered 0…511. Sequency N is the basis function with N sign changes between adjacent samples across the 512-point interval; the loop seam is not counted as an additional change.

Examples:

walsh=:15
walsh=15:
walsh=37
walsh=-37
walsh=:80,-37

Why Walsh is a transform rather than a resample mode

For sparse dyadic point counts, direct full Walsh reconstruction naturally collapses toward equal-block held interpretation. For arbitrary point counts it would require another hidden construction policy. Explicit stage-1 construction followed by Walsh is therefore clearer and avoids creating a second implicit resampler.

-clip transform variants

fourier-clip, haar-clip, and walsh-clip use the same component selections as their ordinary counterparts. They differ only when the selected reconstruction exceeds ±1 before Drawn admission.

  • ordinary transform: proportionally scale the complete reconstruction back inside ±1;
  • -clip: hard-clip excursions at the rails.

If no overshoot occurs, ordinary and -clip outputs are expected to be identical. Overshoot can appear because removing or inverting basis components also removes cancellations that existed in the full reconstruction.

Final normalise:true

normalise is independent of transform; it may follow only a stage-1 construction or the complete two-stage pipeline.

FWG applies one uniform scalar gain around zero when the final finite Drawn waveform has a meaningful peak below 1. DC and all amplitude proportions scale together. It is not a bipolar min/max remap.

For example, an all-positive waveform spanning approximately +0.25…+0.5 becomes approximately +0.5…+1.0, not −1…+1.

Peaks at or below the Drawn numerical-dust floor (1e-9) are left unchanged rather than being amplified into full-scale residue. A meaningful value just above that floor can legitimately receive a very large gain.

Normalisation is final-only. There is no hidden upward normalisation between stage 1 and a transform.

One waveform authority and flattening

While a construction pipeline remains pristine, a full schema-13 sidecar may save:

data
resample_mode
wrap          (where applicable)
transform     (where present)
normalise     (when true)

The 512-sample runtime table is derived state.

On the first ordinary Drawn canvas edit, the entire construction pipeline authority is cleared and the current literal 512-sample Float32 table becomes the sole waveform authority.

Standalone Export Drawn always writes that current literal editing surface. It does not preserve active transform/normalise instructions that would run a second time on re-import.

Dense non-wrapped Linear input

FWG retains the ability to reduce a legal non-wrapped Linear source above 512 authored values to the current 512-sample Drawn surface.

If that dense source also uses transform and/or normalise:true, FWG first materialises the stage-1 Linear result to canonical 512-internal-cycle-sample Float32 form and retains those 512 internal cycle samples as the pipeline input authority. Stage 2 does not need the original oversized contour, and ordinary sidecars remain within FWG's own re-importability budget.

Numeric format labels

For current schema-13 numeric data:[...], an optional ordinary numeric-array format label does not decide whether the values are anchors or literal samples. Numeric semantics come from data length, resample_mode, topology, and pipeline fields.

New numeric examples and exports therefore do not need redundant labels such as float32_array_v1 or amplitude_anchors_v1.

Genuinely different non-array encodings, including the built-in sine or historical Base64 representations, remain separate compatibility cases and may still need explicit encoding identity.

JSON numbers and numeric mode values

Numeric values in data use standard JSON number syntax.

Valid JSON numbers:

0.3
-0.3
1
1.0
3e-1

Invalid JSON numbers:

.3
-.3
1.

Numeric construction controls such as steps=0.3 live inside the resample_mode string rather than as standalone JSON numbers. FWG accepts some shorter leading-dot spellings there, but the wiki and shipped examples use 0.3 and -0.3 consistently because they are clearer and match ordinary JSON-number style.

How the curve comparisons were made

The familiar-function table below separates mathematical measurement from synthesis presentation.

For every continuous fitted row, the single-transition comparison uses exactly:

{
  "data": [-1, 1],
  "wrap": false
}

with the row's resample_mode.

The familiar/reference curve and the FWG reconstruction are compared as 512 Float32 amplitude samples at positions t=0/511…511/511. No wrap return, repeated transition, seam-closing segment, or flat interval contributes to Max Δ, RMS Δ, or Pearson correlation.

The square row is the exception because steps describes held states rather than a continuous transition. Its score compares the complete two-state 512-internal-cycle-sample result against an ideal discrete 50% square.

The complete-cycle companion for each continuous row starts from the same two authored amplitudes and changes only topology:

{
  "data": [-1, 1],
  "wrap": true
}

That makes a two-segment round trip: the selected rule travels from -1 to +1, then from +1 back to -1. The complete-cycle plots are for synthesizer intuition; the numerical columns remain the cleaner one-transition measurement.

This is also why a two-point pow-symmetric=1.7503 can make a better sine-like round trip than applying the same local rule to [0,1,0,-1]: the two-anchor version gives each half-cycle one S-shaped transition. Cardinal and Fourier add different interpretations when quarter-cycle landmarks themselves matter.

Correlation is a geometric similarity measure, not a percentage of sound-design functionality. Read it together with max/RMS difference, the full transition overlay, and the complete-cycle result.

Stage-1 familiar-function correspondence and numerical similarity

This section compares stage-1 construction curves. Haar and Walsh are not missing reconstruction families here: they are stage-2 basis transforms, so an interpolation-function correspondence table is the wrong comparison class for them. Fourier appears elsewhere in this reference where it is being used as stage-1 construction.

Every continuous comparison below starts from the same two authored amplitudes [-1,+1]. The Single transition column uses wrap:false; the Complete cycle column uses the same two amplitudes with wrap:true.

The familiar function name is a landmark, not a parser alias. FWG v3 construction equivalent is the actual resample_mode spelling.

Familiar function / wave-shape FWG v3 equivalent Max Δ RMS Δ Correlation r Single transition Complete cycle
Ideal 50% square wave / zero-order hold stepsmathematically exact 0.00000 0.00000 1.000000 Exact square made by two held states · JSON Complete exact two-state square wave · JSON
Linear linearmathematically exact 0.00000 0.00000 1.000000 Linear · JSON Complete-cycle companion for Linear · JSON
Circle-in superellipse=2mathematically exact 0.00000 0.00000 1.000000 Circle-in · JSON Complete-cycle companion for Circle-in · JSON
Circle-out superellipse=-2mathematically exact 0.00000 0.00000 1.000000 Circle-out · JSON Complete-cycle companion for Circle-out · JSON
Cosine-shaped S curve pow-symmetric=1.7503 0.01445 0.00945 0.999923 Cosine-shaped S curve · JSON Complete-cycle companion for Cosine-shaped S curve · JSON
Inverse sine / arcsine (asin) pow-symmetric=0.565 0.01848 0.00963 0.999773 Inverse sine / arcsine (`asin`) · JSON Complete-cycle companion for Inverse sine / arcsine (`asin`) · JSON
Smoothstep (3t² - 2t³) pow-symmetric=1.665 0.01434 0.00983 0.999915 Smoothstep (`3t² - 2t³`) · JSON Complete-cycle companion for Smoothstep (`3t² - 2t³`) · JSON
Hyperbolic tangent (tanh=1) pow-symmetric=1.3297 0.01280 0.00626 0.999963 Hyperbolic tangent (`tanh=1`) · JSON Complete-cycle companion for Hyperbolic tangent (`tanh=1`) · JSON
Hyperbolic tangent (tanh=3) pow-symmetric=3.476 0.01500 0.00757 0.999962 Hyperbolic tangent (`tanh=3`) · JSON Complete-cycle companion for Hyperbolic tangent (`tanh=3`) · JSON
Hyperbolic tangent (tanh=6) pow-symmetric=7.6324 0.03269 0.01041 0.999937 Hyperbolic tangent (`tanh=6`) · JSON Complete-cycle companion for Hyperbolic tangent (`tanh=6`) · JSON
Hyperbolic tangent (tanh=10) pow-symmetric=13.2401 0.04057 0.01063 0.999940 Hyperbolic tangent (`tanh=10`) · JSON Complete-cycle companion for Hyperbolic tangent (`tanh=10`) · JSON
Hyperbolic sine (sinh=1) pow-symmetric=0.8593 0.01223 0.00571 0.999952 Hyperbolic sine (`sinh=1`) · JSON Complete-cycle companion for Hyperbolic sine (`sinh=1`) · JSON
Hyperbolic sine (sinh=3) pow-symmetric=-2.399 0.04691 0.03215 0.997374 Hyperbolic sine (`sinh=3`) · JSON Complete-cycle companion for Hyperbolic sine (`sinh=3`) · JSON
Hyperbolic sine (sinh=6) pow-symmetric=-5.2721 0.02555 0.01609 0.998688 Hyperbolic sine (`sinh=6`) · JSON Complete-cycle companion for Hyperbolic sine (`sinh=6`) · JSON
Hyperbolic sine (sinh=10) pow-symmetric=-9.2605 0.01535 0.00727 0.999565 Hyperbolic sine (`sinh=10`) · JSON Complete-cycle companion for Hyperbolic sine (`sinh=10`) · JSON
Inverse hyperbolic sine (asinh=3) pow-symmetric=-0.4493 0.10823 0.03948 0.998836 Inverse hyperbolic sine (`asinh=3`) · JSON Complete-cycle companion for Inverse hyperbolic sine (`asinh=3`) · JSON
Normalized exponential (k=1) pow=1.395959 0.04713 0.03080 0.999581 Normalized exponential (`k=1`) · JSON Complete-cycle companion for Normalized exponential (`k=1`) · JSON
Normalized exponential (k=3) pow=2.638093 0.06991 0.04843 0.998835 Normalized exponential (`k=3`) · JSON Complete-cycle companion for Normalized exponential (`k=3`) · JSON
Normalized exponential (k=10) pow=9.26173 0.03066 0.01450 0.999657 Normalized exponential (`k=10`) · JSON Complete-cycle companion for Normalized exponential (`k=10`) · JSON
Logarithmic-style curve (log-like, k=1) pow=-1.395959 0.04713 0.03080 0.999581 Exponential time-complement (`k=-1`) · JSON Complete-cycle companion for Logarithmic-style curve (`log`-like, `k=1`) · JSON
Logarithmic-style curve (log-like, k=3) pow=-2.638093 0.06991 0.04843 0.998835 Exponential time-complement (`k=-3`) · JSON Complete-cycle companion for Logarithmic-style curve (`log`-like, `k=3`) · JSON
Logarithmic-style curve (log-like, k=10) pow=-9.26173 0.03066 0.01450 0.999657 Exponential time-complement (`k=-10`) · JSON Complete-cycle companion for Logarithmic-style curve (`log`-like, `k=10`) · JSON

The square and Linear rows are mathematically exact. Circle-in and circle-out are also exact because they are superellipse=±2.

For the fitted rows, the formulas differ. The measurements show how closely the selected FWG rule follows the familiar transition; the round-trip graph shows what that same sparse construction looks like as a complete periodic waveform.

The listening comparisons used sparse constructions in both direct-audio and LFO/modulation roles. Some fitted pairs were indistinguishable; others retained subtle audible differences. A residual difference is not automatically a flaw: near-pure but deliberately different waveforms are often useful synthesis material.

Overlap inside the retained FWG grammar

This is a different question from replacing familiar function names: where can FWG's own retained rules occupy overlapping sound-design territory?

Construction Relationship / territory
linear, pow=±1, pow-symmetric=±1, superellipse=±1 Mathematically exact straight-line reconstruction.
steps with [-1,1] Exact two-state square; values are held states rather than interpolation anchors.
pow-symmetric=1, [-1,1], wrap:true Exact triangle.
pow-symmetric≈1.7503, same two points Very sine/cosine-like round trip.
Larger positive pow-symmetric, same two points Increasingly soft-square-like; change one number to explore the continuum.
bare cardinal (N=0.621864), [0,1,0,-1] Phase-familiar four-cardinal-point near-sine.
cardinal-clip=0.860022, =12, … with the same four points Progressively harder clipped soft-square territory.
fourier, [0,1,0,-1] Exact sine to Float32 precision from four periodic samples.
fourier=:N / fourier=(N+1): Low-order body and complementary higher-order residual from the same authored samples. Negative singletons are now reserved for coefficient inversion.

Three points are also fair game. [0,1,-1] with wrap:true and a steep pow, pow-symmetric, or another curve is not a malformed four-point waveform; it is a different cyclic construction. See Drawn Wave-Shape Recipes for examples.

The practical lesson is not that one family makes another invalid. Overlap is useful because nearby ways of reaching recognisable territory can have different transitions, spectra, overshoot, symmetry, or LFO behaviour.

See Meditations on the 512-Sample Core for the broader distinction between mathematical, perceptual, artistic, and engineering sufficiency.

Mathematical example library

These examples are small, current-schema recipes intended to be copied, edited, and imported with Import Drawn…. Each plot shows the actual FWG v3 512-internal-cycle-sample reconstruction. Click any inline preview to open the full-size PNG.

Where a familiar function is being compared with a fitted v3 equivalent, the image superimposes the two curves: red = familiar/reference curve; blue dashed = the FWG construction. Every comparison plot uses one non-wrapped -1+1 transition with 512 internal cycle samples. There is no wrap return or repeated second segment in the numerical comparison. Very tight pairs may overlap within thumbnail resolution, and the image says so rather than magnifying the residual into a separate engineering plot. Exact identities say mathematically exact.

Filled black dots mark explicit authored values at their reconstruction positions. Hollow black dots mark implicit wrap points. For Steps, each filled marker sits at the beginning of its ordinary held-state interval: bare steps holds that value until the next marker, while nonzero steps=N bends between the same fixed positions. The comparison plots have two filled anchors and no hollow wrap point; basic cyclic examples such as the triangle still show the hollow implicit return point. Vertical guides mark 0.25, 0.5, and 0.75. The visible amplitude rails are exactly +1 and −1.

The familiar names are explanatory landmarks, not hidden parser aliases. The corresponding JSON file contains the FWG v3 construction that can actually be imported.

For complete oscillator/LFO shapes built from the same sparse ideas — including square, triangle, sine-like, soft-square, Cardinal and signed Fourier examples — see Drawn Wave-Shape Recipes.

Start with two numbers

The mathematical feature grew from the broader Drawn idea that useful waveforms do not necessarily need 512 hand-written Float32 values. These three constructions are the simplest demonstration.

Two-point sawtooth

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "linear"
}

Origin example: two integer amplitudes describe one rising ramp; the cycle seam supplies the sawtooth reset.

Two-point sawtooth

Standalone JSON

Two-point square

{
  "data": [
    1,
    -1
  ],
  "resample_mode": "steps",
  "wrap": true
}

Origin example: two integer amplitudes describe two held half-cycle levels.

Two-point square

Standalone JSON

For Steps, the markers identify the beginnings of the two ordinary held-state intervals. Bare steps holds each value exactly; Steps is intrinsically cyclic, so the final state returns to the first and canonical construction uses wrap:true. Parameterised steps=N keeps these same marker positions and bends the interval between them. For nonzero values it is deliberately the reciprocal control spelling of wrapped signed Power (steps=N == pow=1/N with wrap:true where the reciprocal is finite); exact steps=0 is the held-state special case with no finite-Power equivalent.

Two-point triangle

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "linear",
  "wrap": true
}

Two cyclic anchors create a complete triangle through the implicit return segment.

Two-point triangle

Standalone JSON

Exact geometric landmarks

These are not approximations: superellipse=2 and superellipse=-2 are mathematically exact circle-in and circle-out segment geometries.

Circle-in territory

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "superellipse=2"
}

Mathematically exact circle-in segment geometry.

Circle-in territory

Standalone JSON

Circle-out territory

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "superellipse=-2"
}

Mathematically exact circle-out segment geometry.

Circle-out territory

Standalone JSON

pow-symmetric: familiar symmetric territory

The recipes below are close v3 equivalents selected from sparse audio/LFO comparisons. Their familiar names are explanatory landmarks, not accepted resample_mode spellings.

Cosine-like S curve

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=1.7503"
}

Close v3 equivalent for the familiar cosine-shaped transition.

Cosine-like S curve

Standalone JSON

Arcsine-like curve

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=0.565"
}

Close v3 equivalent for inverse sine (arcsine) territory.

Arcsine-like curve

Standalone JSON

Smoothstep-like curve

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=1.665"
}

Close v3 equivalent for standard smoothstep territory.

Smoothstep-like curve

Standalone JSON

Hyperbolic-tangent-like, mild

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=1.3297"
}

FWG v3 equivalent for the normalized tanh=1 reference.

Hyperbolic-tangent-like, mild

Standalone JSON

Hyperbolic-tangent-like

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=3.476"
}

FWG v3 equivalent for the normalized tanh=3 reference.

Hyperbolic-tangent-like

Standalone JSON

Hyperbolic-tangent-like, strong

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=7.6324"
}

FWG v3 equivalent for the normalized tanh=6 reference.

Hyperbolic-tangent-like, strong

Standalone JSON

Hyperbolic-tangent-like, very strong

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=13.2401"
}

FWG v3 equivalent for the normalized tanh=10 reference.

Hyperbolic-tangent-like, very strong

Standalone JSON

Hyperbolic-sine-like, mild

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=0.8593"
}

FWG v3 equivalent for the normalized sinh=1 reference.

Hyperbolic-sine-like, mild

Standalone JSON

Hyperbolic-sine-like

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=-2.399"
}

FWG v3 equivalent for the normalized sinh=3 reference.

Hyperbolic-sine-like

Standalone JSON

Hyperbolic-sine-like, strong

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=-5.2721"
}

FWG v3 equivalent for the normalized sinh=6 reference.

Hyperbolic-sine-like, strong

Standalone JSON

Hyperbolic-sine-like, very strong

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=-9.2605"
}

FWG v3 equivalent for the normalized sinh=10 reference.

Hyperbolic-sine-like, very strong

Standalone JSON

Inverse-hyperbolic-sine-like

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow-symmetric=-0.4493"
}

The normalized reference is asinh(sinh(3)·x)/3 for x in [-1,1]; the red overlay uses that exact definition.

Inverse-hyperbolic-sine-like

Standalone JSON

pow: normalized exponential and log-like time-complement curvature

The positive values cover normalized exponential curvature. Negative values cover the complementary log-like direction, defined as the exact time-complement 1 - E_k(1-t) = E_-k(t) of the same normalized exponential family.

Exponential-like, mild

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow=1.395959"
}

FWG v3 equivalent for the normalized exponential k=1 reference.

Exponential-like, mild

Standalone JSON

Exponential-like

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow=2.638093"
}

FWG v3 equivalent for the normalized exponential k=3 reference.

Exponential-like

Standalone JSON

Exponential-like, strong

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow=9.26173"
}

FWG v3 equivalent for the normalized exponential k=10 reference.

Exponential-like, strong

Standalone JSON

Log-like exponential time-complement, mild

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow=-1.395959"
}

Derived complementary counterpart to the exp=1 fit.

Logarithmic-like, mild

Standalone JSON

Log-like exponential time-complement

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow=-2.638093"
}

Derived complementary counterpart to the exp=3 fit.

Logarithmic-like

Standalone JSON

Log-like exponential time-complement, strong

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "pow=-9.26173"
}

Derived complementary counterpart to the exp=10 fit.

Logarithmic-like, strong

Standalone JSON

Beyond the old circle pair

These examples show why generalized superellipse earns a family rather than two fixed circle functions.

Generalized superellipse

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "superellipse=4"
}

A stronger geometric curve that extends beyond the circle special case.

Generalized superellipse

Standalone JSON

Near-rectangular superellipse

{
  "data": [
    -1,
    1
  ],
  "resample_mode": "superellipse=16"
}

Shows the broader near-rectangular territory that fixed circle-in/out functions could not provide.

Near-rectangular superellipse

Standalone JSON

Editing the recipes

Try changing one thing at a time:

  • change a signed exponent while keeping the amplitudes fixed;
  • add or remove an authored amplitude;
  • toggle wrap;
  • change pow to pow-symmetric or superellipse;
  • use the same Drawn state as directly audible waveform material and as the Drawn LFO for Scanning.

The point is not to recreate a mathematically canonical function at all costs. It is to find a compact construction that is useful for the sound or modulation job you have in mind.

Import diagnostics

When a multi-stage recipe requires fitting, clipping, or final normalisation, import diagnostics retain stage ownership. This distinguishes, for example:

  • Cardinal construction overshoot before stage-1 admission;
  • transform overshoot after component reconstruction;
  • final normalise:true gain.

Diagnostics report what happened; they do not create another DSP path.

Drawn signal boundary and Table Safety

Every admitted/copied/auditioned/LFO/literal-export Drawn table is finite Float32 within ±1.

That signal boundary is separate from Loop Safety and Table Safety. A valid Drawn construction can still produce a completed audible table that downstream Table Safety rejects for structural reasons. Transform legality does not bypass that existing safety layer.

Practical examples

The public 12-file bank demonstrates Steps, Cardinal, sparse Fourier, Fourier/Haar/Walsh stage-2 transforms, coefficient inversion, -clip, final normalisation, and mixed two-stage pipelines. See Drawn Wave-Shape Recipes.

Fractured Wavetable Generator

Start here

🎹 Workspaces

🎹 Build and shape sounds

🎹 Make and keep results

🎹 Scanning and custom trajectories

Help and reference

🔧 Advanced / technical reference

Clone this wiki locally