SAU language overview

An overview of how to use the SAU language provided by the saugns program. For how to use saugns command-line options to do various things with scripts, instead see the usage page. Syntax changes, feature additions, and other tweaks to the language between versions are listed on the changes page.

The below is meant to strike a balance between simple explanation, the big picture, and a reference for details of the language features. The examples page gathers examples with rendered audio files, which may be pointed to in the text. A concise language reference which mainly describes and lists details can be found in the README.SAU file.

Contents

Nature of the language

SAU (Scriptable AUdio) is a simple and non-Turing-complete language for mathematical audio synthesis, without support for the use of pre-recorded samples.

The next main section on generating audio goes right into using features for producing audio. The one after that, on values and expressions, provides more details about language constructs and their use.

The core idea of the language is that of time-ordered steps for configuring audio generation: add an oscillator, then later, change a parameter and extend play duration, etc. A script is basically a list of such timed instructions. Language constructs also offer more flexible arrangement of steps to take than a bare flat list of instructions and forward time movement.

The syntax is a bit terse and unusual. It uses one-character keywords with or without an argument, followed by zero or more parameters with arguments. Each main keyword provides an action, either at run time (like a function call in other languages), or at parse time (like a global script setting).

The keywords W and R are type names for signal generators, and are used to add instances of wave oscillators, and rumbly noise oscillators, respectively. Such objects can be connected for modulation. Together with the timing logic and parameters, these are the core features of the language.

Generating audio

To generate a single pure tone in the SAU language:

Wsin f440 p0 a1.0 t1

In this case, frequency is set to 440 Hz, phase to 0% of the wave cycle, and amplitude to 1.0 (0dB, no gain change). The time duration will be 1 second. Default values can also be used, by leaving out one or more of the parts after Wsin; the above values match those in a script consisting only of Wsin, but more generally default values are context-sensitive (especially handling of time lengths).

The W above is the name of the wave oscillator type, and written to add an instance of it – immediately followed by a wave type name, in this case sin, or none to use sin as the default (though there's more; see the wave type table). Such an oscillator is also called an "FM operator" in FM synth terminology, especially when it's a sine wave oscillator (though other kinds of audio generators can also be put to the same kinds of use).

Numbers used above are simple examples of numerical expressions. Positive numbers are the simplest to write. Fancier things are also possible, including randomized values. Phase values are treated specially to be simple to write. There's also a syntax for writing frequency values as notes.

When a script has several top-level or carrier audio generators playing at the same time, the overall amplitude for everything is scaled down throughout the script by the maximum number of audio generators playing at once. This can be disabled, using a manual adjustment in its place. (Global amplitude scaling only affects carriers, not modulators. If it applied to modulators too, it would have altered timbre.)

Using modulation

Audio generators (of which there's also more types) can be used in a nested way, to apply modulation of some type. The most central modulation type in SAU is arguably PM – commonly called "FM synthesis" in commercial synthesizers (though there's also "real" FM, more on that further below). As in this example.

MP3
// Generate 10 seconds of "engine rumble"
Wsin f137 t10 p[
	Wsin f32 p[
		Wsin f42
	]
]

The oscillators with frequency 32 Hz and 42 Hz are listed beneath the main one as modulators, linked in a chain which ends at the carrier (with frequency 137 Hz), and play for the same time (10 seconds) – the default time for a modulator is auto-fit, to the carrier time used, but a shorter time can also be used. (The p is for phase, and PM means adding modulator amplitudes to the phase.) Above, the amplitudes are all left at the default 1.0; those of modulators determine what is often called the modulation index or "depth" of modulation. (For PM, a modulator's output of ± 1.0 is scaled to ± 50% of a cycle, or ± π in radians.) The first line is just a comment.

For a modulator of any type, frequency can also be set relative to the carrier using the r (relative frequency) parameter instead of the usual f (frequency) parameter – and the default for a modulator is r1, the multiplier 1.0, keeping in tune with the frequency setting of the carrier. Whichever option (f or r) was most recently used to set the frequency will be used to get it. More specifically, a value set to r will be multiplied by the frequency of the closest carrier in the chain for the modulator. For example, a modulator with r4/3 will maintain a frequency 4/3 times the frequency of its carrier, i.e. a 4:3 modulator:carrier frequency ratio. Changing the f42 in the PM example above to that gives a somewhat different sound.

Frequency and amplitude can also be given dynamic values using modulator outputs. This includes "real FM", amplitude modulation (AM), and ring modulation (RM).

Sweeping parameters like amplitude or frequency is a little like using modulation features, except that the source of the change is not a generator object, but simply a one-off timed trajectory. Modulation can also become more interesting when that's done to parameters altering the result, changing what a modulator does over time.

Finally, the result of PM and of other types of modulation may differ – sometimes not audibly, sometimes very audibly – on changing the phase for a carrier or a modulator (with a number after a p), as it affects how the waveforms produced by the two line up and in turn interact through the type of modulation.

General pointers on FM and PM

Actual FM and PM are a little different, the first applied to the frequency parameter (f or r), the second applied to the phase parameter (p). They produce strongly related but not identical results, and can both be useful. Here's some more on their nature and use in general.

FM and PM are most commonly used with sine wave oscillators, but can also use different waveshapes – in any case building richer sounds and frequency spectrums from simpler ones. Adjusting the strength of the modulation plays a role analogous to that of adjusting a filter in subtractive synthesis (where instead the starting point is a rich frequency spectrum which is reduced). More mellow waveforms can be used more flexibly for modulation without creating an overly harsh or noisy result. Extreme settings are allowed, including making frequency go between positive and negative (called through-zero behavior; negative frequency means the waveform changes backwards) or having the phase jump around in basically any way (noisy as that can be). An audio generator which can be used for FM or PM is called an "FM operator" on many synths; here the full-fledged ones include both W and R.

When using sine wave oscillators (Wsin), FM and PM behave similarly – until more levels of carrier-modulator linkages are used. FM and PM then produce different waveshapes unless the input is different to match the difference between FM and PM. If the modulator uses a different waveform than sine or cosine, then this is also the case with just a pair of oscillators. Using PM, a triangle wave modulator has the kind of effect which a square wave modulator has with FM. To understand this, it helps to think of how the phase and frequency are related...

If a square wave FM modulator is used, then as a result frequency is either lower (phase moving slower) or higher (phase moving quicker). With a triangle wave PM modulator, when it rises, the phase of the carrier keeps getting pushed ahead more than usual at a steady pace until the peak of the triangle is reached, and then when the triangle falls, the carrier phase is instead held back – with the same result as if jumping between two frequencies, as there ends up being two speeds of movement for the phase. (By contrast, a square wave PM modulator would cause the carrier waveshape to jump back and forth between different phase positions, i.e. parts of the waveform. And a triangle wave FM modulator sweeps the frequency linearly up and down over and over again, instead of making it jump up and down all at once.)

With FM, it becomes important whether or not a signal has any DC offset – because the average value of the modulator will change the average frequency of the carrier, up if positive, down if negative. And when chaining several levels of carrier-modulator oscillators, the result is almost always an assymetric waveshape which usually has DC offset. So using FM in a more elaborate way can make the general pitch of a sound drift around. This is not the case with PM – and that's why PM is so often favored – because DC in the modulator is then merely the same thing as adding some value to the phase, rather than to the frequency.

Mathematically, adding something to the frequency is like adding the integrated version of the signal to the phase. This also matters when noise is injected through modulation – white noise turns into the more bassy red noise, a.k.a. brown noise, if added through FM, but remains white noise when added through PM. That's because integration of a signal tilts the frequency spectrum 6 dB per octave in the bassy direction, which is the difference between those noise colors, and phase is integrated in relation to the frequency.

Signal flow in the W oscillator and similar

FM/PM (angle modulation) is added to frequency and/or phase.

Frequency -> Integrator -> Phase -> Waveform lookup

Phase self-modulation (a.k.a. "feedback FM")

There's another type of PM which involves a feedback loop, prior amplitudes shifting the phase resulting in the current amplitude. This results in a different frequency spectrum than does ordinary PM, and the two have been combined since the early 1980s in "FM synthesizers" as made by Yamaha. However, the commonly used name for phase self-modulation is "feedback FM" since that's what Yamaha labeled it. (A similar feedback mechanism truly affecting frequency instead – not currently provided in SAU – would give a different result, and has been labeled "loopback FM" in implementations.)

Self-PM sawtooth-ifies the waveform and adds sawtooth-like harmonics. A positive multiplier for the feedback makes it contract the rising part of the wave while expanding the falling part of it, while negative multipliers do the converse. In either case the result is a sawtooth-ish wave, whether falling (positive multiplier) or rising (negative multiplier). However, there's a limit to how sharp the sawtooth can get, and how strong a feedback intensity can be used, before noise and chaos results. When the feedback intensity is great, ringing appears in the waveform, and eventually it becomes noisy; still more and it sounds glitchy, and still more and it transforms into white noise eventually.

The p.a phase amplitude feedback parameter controls self-PM. For a sine wave as the underlying waveform, a value of ± 2⁄3 is close to a maximum for a bright yet clean sound, while ± 1.0 gives some audible sample-rate dependent ringing; values can be greater as well. Compared to classic synthesizers, 0.5 corresponds to level 5 in Yamaha's chips. Filtering differs, so 1.0 sounds cleaner than the Yamaha level 6 it otherwise corresponds to. A value of 1.0 also corresponds to π radians (meaning ± π feedback amplitude internally), if you look at the mathematics of this kind of synthesis. (If you want to match other values of Yamaha's 1–7 scale, just multiply by 2 to go up and divide by 2 to go down, repeatedly. But you may need an extra 1.5–2.0 factor boost if you truly want a similarly noisy sound to result for high levels.)

Traditional uses are simple, like setting a fixed low to moderate value (often a small fraction) for an oscillator. When used together with ordinary PM, usually it's the innermost PM modulators that have some level of feedback set, not the PM carriers; this can sometimes work as a substitute for a longer chain of nested PM modulators, as when producing a sawtooth-ish result. Other waveforms than sawtooths, e.g. squarish and others as results from a carrier-modulator ratio, gain a sharper waveform and brighter spectrum as well using self-modulation for the modulator.

Not only sine waves can have self-modulation applied to them; all the wave types possible using the W and R oscillators can – but the result may end up looking more like a deformed sawtooth, and strong ripples and noise may happen at lower feedback levels than with sine waves (this is more so the stronger the harmonics of the underlying waveform used).

Dynamic levels. Both sweeping of the p.a value and assigning separate modulators within a list for the parameter (p.a[...]) can be done, as two ways of dynamically varying the level of self-PM. Modulators used in this way to vary self-PM intensity have their outputs summed and then used in combination with the parameter value set. That is, if a value of 1/2 is set to the parameter, and a modulator which also has an amplitude in a range of ± 1/2 is used, then the intensity will vary from 0–1.

WAV
Wsin p.a1/2[Wsin p-1/4 f1 a1/2] t3

To change the intensity of self-PM as its own kind of modulation of a modulation is more similar to tweaking the filter of a subtractive synthesizer's sawtooth oscillator. (Otherwise, changing the intensity of ordinary PM gives a result analogous to that, but less similar-sounding.)

Amplitude/ring modulation and FM

Amplitude (a) and frequency (f) (and relative frequency r) parameters all support modulation of the parameter values in the same ways, by adding modulator outputs to a value as described here, and/or by mapping modulator outputs to a range with two boundaries. For amplitude, whether the result is called amplitude modulation (AM), or ring modulation (RM), depends on how carrier and modulator amplitude are set up relative to one another. For frequency modulation, the result is however always the "real FM" related to yet distinct from PM, whenever modulation happens.

The options for adding modulator outputs basically work the same as the main option for PM described above. After a parameter name and optionally other value(s), within [] a list of modulators can be added; their output amplitudes are simply used added to the parameter value. For example, here's a softer square-wave like beep made using ring modulation with two different wave types (it ends up having a base frequency of 220 Hz, half the default of 440 Hz).

MP3
Whsi a0[Wsin r1/2]

With the carrier amplitude setting at 0, amplitude fully depends on the modulator output, becoming the mathematical product of the two. This is called ring modulation. With a non-zero carrier amplitude setting, the result of adding the modulator output to it is instead amplitude modulation of some depth.

For FM, usually frequencies are set to something non-zero, but sometimes a frequency value of 0 can be interesting. Then the only thing "driving" the carrier, so that it produces a non-constant result, is the modulator(s) – forwards when frequency becomes positive, backwards when it becomes negative. With FM, unlike PM (which can be used to a similar effect), a much larger amplitude may however be needed to have enough impact on the carrier. Numerical expressions make it easy to e.g. try out small-ish powers of 10 as the amplitude of a modulator. Below a simplistic imitation of an electric guitar sound (sounding almost like a siren) is made this way, with the help of some value sweeps. (The last sweep removes the click when the sound ends.)

MP3
Wsin f0[
	Wsin p1/3 f44[g440*pi llog] a10^met(3) t2
	; f[g44]
] t4; a[g0] t0.01

When there's a list with several modulators in it, it may be convenient to set a multiplier for all of their amplitudes. This can be done using the S a option for amplitude, inside the [] list at its beginning; doing so only affects the current list level and scope, except when the above type of amplitude or ring modulation is used – otherwise further nested sublists are untouched by the amplitude setting, for the sake of e.g. preserving timbre when using it to adjust volume.

Note that modulator lists for the f and r options are shared and identical.

Using the separate channel mixing parameter c, a stereo effect panning-AM is also available. (It does not allow ring modulation for both channels at once, and its center-balance value of 0.0 makes for classic AM in opposed, complementary patterns for the left and right channels.)

Modulation with value range

There's an alternative way to do amplitude/ring (a) and frequency (f or r) modulation – using a second value and a list of modulators assigned for the parameter under the subname .r (as in a.r, f.r, and r.r). The output of those modulators is then mapped to a range between the main and the second values for the parameter. This way to modulate can also be combined with the other which just adds the modulator outputs, described above.

For example, an expression like f250.r(250 * 2)[...] sets up the use of some modulators (within the []) to move frequency between 250 Hz and 500 Hz. The whole expression, name and subname and values, cannot contain any whitespace outside of parentheses and brackets. The second value defaults to 0.0 if left out, and is only used for this kind of modulation; it can also be swept like the main value, by using the same syntax in the place for the number.

If several modulators are used, the handling is a bit different from other ways to modulate, with the modulator outputs multiplied rather than added to one another, after being shifted to a positive value range. Each modulator first produces a result in the range of 0.0 to 1.0, which is then multiplied by its amplitude (defaulting to 1.0); however, if a negative amplitude multiplier is used, it will be used as a positive value after switching the top and bottom of the 0.0 to 1.0 range.

When several modulator outputs are multiplied together, this adds a bias towards the lower end of the range – the signal from the modulators ends up with broader valleys and narrower peaks. 0.0 will be mapped to the main parameter value, and 1.0 to the second (.r) value. Of course, changing amplitude multipliers for the modulators can change the range, effectively moving the second value.

A simple LFO FM example, where frequency is varied between 250 Hz and 500 Hz using a 0.1 Hz sine wave.

Wsin f250.r500[Wsin f0.1] t10

A simple AM example, where amplitude is varied between 1/4 and full, using a half-rectified sine wave with 1/5 of the carrier's frequency.

Wsin f200 a1/4.r4/4[Whsi r1/5] t5

To use this for classic 100% modulation depth AM, one of the bounds should instead be 0.0 (like the default for the second value is); while for classic RM, the two bounds should instead have the same magnitude, but with the opposite sign.

If this type of modulation is used, it is done first; the other one from which the modulator outputs are simply added, if also used, will be applied afterwards.

Frequency-amplified PM

Not to be confused with phase self-modulation a.k.a. "feedback FM", which uses the parameter p.a rather than p.f.

There's two different ways to connect a PM (phase modulation) input to a carrier, normal PM (p[...]) as described above, and the similarly-used frequency-amplified PM (p.f[...]) which multiplies modulator amplitudes by the carrier frequency (scaled down so that 632.45... Hz, the geometric mean of the 20–20000 Hz human hearing range, makes level "normal"). The best PM type to use depends on the intended sound as the carrier pitch varies. Both modulator types can be linked to a carrier, so the choice can be made per modulator. Both modulator lists can be set either at once (p[...].f[...]), or independently (p[...] p.f[...]).

Changing the frequency of a carrier changes how fast its phase moves independently of any PM. When the PM signal also remains the same while frequency is changed, this changes the proportion of the two sources of phase movement for the carrier. For example, this affects how a vibrato effect from PM will sound as the carrier plays at different pitches; at higher pitch, e.g. twice the frequency, the PM has only half the impact relative to it. Frequency-amplified PM makes a constant "impact" by multiplying the carrier frequency into the PM signal.

However, when modulator frequency is set relative (r) to a carrier as a multiplier for its frequency, it's normal PM that sounds more equal in intensity as the carrier pitch varies, not frequency-amplified. A change in frequency, just like a change in amplitude, will change how much energy (in terms of physics) there is to a signal; to change both the same amount will change signal energy by the squared amount. With both combined higher-pitched sounds become more intense along with the modulator signal.

When comparing normal and frequency-amplified PM, keep in mind that changes in modulator amplitude can counter-intuitively affect the color of the sound, just like changes in the phase offsets for carrier relative to modulator can. To ease comparing and "tuning" sounds, the named constant mf can be used for the 632.45... Hz number when setting parameter values. For example, if a carrier has a frequency of 100 Hz, then setting the f-PM modulator amplitude with a(mf/100) brings the same result as for a normal PM modulator with a1.0. Such a setting can be used for all generators in a modulator list at once, by using the S a option at the beginning of it.

Signal generator types

For generator types which use random number generation, like N and R, each new instance created in a script will be given a different default starting point or seed for producing random numbers. The default seed is based on the $seed magic variable and a random number sequence derived from it. For each instance, the seed can be overriden by setting the s seed parameter, which accepts a number which is used modulo 1.0 as a percentage of the state space.

The seed sequence is deterministic unless changed to be based on system time, as can be done using the time() mathematical function.

When $seed is set, it also seeds the rand() function. Using rand(), and adding instances of seedable types like R, however involve two separate random number sequences derived from $seed, which do not affect the other.

A – Amplitude generator

Amplitude generator A generates sweepable amplitude offsets, i.e. DC offsets. For convenience the amplitude a parameter, otherwise set as a separate parameter after the type name, has its values read right after A (e.g. A1.0 is the same as A a1.0). The current value is output as an offset.

It can also be used for mixing, as A0[...] produces the sum of the AM modulators and nothing else. Likewise, modulation with value range can be used to multiply AM inputs. Instances allow greater mixing flexibility inside modulator lists of either type, belonging to any object.

Shares the basic amplitude a, channel mixing c, and time t parameters with all generators.

N – Noise generator

Noise types for N
NoiseDescription
wh Uniform white noise.
gw Gaussian white noise, soft-saturated.
bw Binary white noise.
tw Ternary smooth white noise. Every other sample is zero.
re Red/brown noise based on uniform white noise.
vi Violet noise based on uniform white noise.
bv Binary violet noise. Differentiated tw noise.

The noise generator N is the simpler and less musical relative of the R oscillator. It is most useful for adding one or another variety of white noise. It can also add a few more colors of noise – including bassier noises which R doesn't have mode flags for. It has no frequency or phase parameters – it just produces a signal at the sample rate, the default noise being plain uniform white noise.

Plain noise can sometimes be interesting to add as a modulator. Note that there's a difference between FM and PM – adding white noise to an f input will lead to less-harsh red/brown noise coloring the sound, because frequency is integrated in order to produce phase in an oscillator. Adding violet noise to f, on the other hand, will lead to a white noise coloration for the same reason.

Note that non-white noise has a sample-rate dependent sound, when generated at maximum rate as with this generator. For consistent noise at a per-sound rate of your choice, other means are needed. A violet noise that always peaks at a frequency of your choice can use the R oscillator with mode mv, and the chosen frequency set to f.

Most options of this generator may be more interesting for producing test signals than anything musical.

Special N parameters

A noise type optionally follows the N, with wh used as the default if none. A lowercase n can be used to change the noise type later, e.g. Nwh t1; nre.

R – Rumble/random line segments oscillator

Line types for sweeps and for R
LineDescription
cos Half cosine (S-curve) trajectory over time.
lin Linear trajectory over time.
sah Sample and hold until time (then jump to goal).
exp Steep exp(x)-1-like increase or decrease.
log Steep log(x+1)-like increase or decrease.
xpe Exponential envelope shape (saturate or decay).
lge Logarithmic envelope shape (saturate or decay).
sqe Square polynomial envelope (saturate or decay).
cub Cubic polynomial segment (-1 to +1) trajectory.
Spiky ends, the opposite of a sinuous shape.
smo Smoothstep (degree 5). A sinuous curve adding
mild odd harmonics like a soft-clipped cos.
Traditionally used for Perlin noise.
ncl Noise camel line; softer, two noise bulges.
nhl Noise hump line; harder, one broad noise bulge.
uwh Uniform random white noise in start–goal range.

The rumble oscillator (a.k.a. random line segments oscillator) R can produce several kinds of audio value noise as well as 1D Perlin noise. While the parameters are mostly like those of a normal oscillator – e.g. almost everything written after Wsin can also be written after Rcos – the resulting frequency spectrums are very different, and various amplitude fluctuation patterns can be created. It can be used by itself or, typically, combined with wave oscillators in order to produce more complex sounds and soundscapes.

Invented for this language, the underlying design of R adds several independent ways to vary what's done and the result; it's a fairly flexible building block which can be made to do a lot. By default, however, it uses uniform white noise as an underlying function, sampled at a limited frequency (two values per "cycle", e.g. 880 per second at 440 Hz), the pseudo-random values connected by the sinuous cos S-curve line type.

When white noise is used, then unless the frequency set is extremely high (e.g. the maximum, half the sample rate), the spectrum which results actually begins to roll off gently before the frequency used, reaching close to the peak level at half the base frequency, and before that extending backwards flatly across fractions of the frequency all the way down to 0 Hz. In other words, white noise modes make this a rumble oscillator – though the low-frequency content has its energy diluted more when higher frequencies are used, as the intensity is spread across a larger frequency range.

The violet noise modes allow producing less bassy signals, the frequency parameter then also controlling the point below which frequencies are reduced in the spectrum. Contrasting with any noise mode is the fixed cycle mode mf, which additionally allows using an R instance like a naive oscillator, where the line type selected determines a resulting wave type – but a mix of that and white noise (or violet noise if mfv is used) can also be set by tweaking the shaping level.

1D Perlin noise is a different way to use the values from the underlying noise function, sounding a little like violet noise except more gentle, and placing the loudest frequency exactly at the base frequency. It morphs the line type and waveform in a way that sounds relatively similar, but looks different. (As a result, it also aligns the phase with a sine wave instead of with a cosine wave as the R modes otherwise do.) This can be combined with any other options, combining gracefully with different randomness functions and with violet noise modes for even more thin noise. (The zig-zag flip option z however gives a different result, producing a squarish shape instead.)

There's various ways to make sounds using R. It can be used at an audible frequency, or for LFO variation of other sounds, or a low-frequency R oscillator can be modulated into producing brighter sounds by another generator. (The last use-pattern makes the sounds rise and fall in the manner of pseudo-random pseudo-melodies.) There's some example scripts available to look at and listen to.

Special R parameters

A line type optionally follows the R, with cos used as the default if none. A lowercase l can be used to change the line type later, e.g. Rcos t1; llin.

The nature of the randomness can be tweaked with the mode parameter m, changing how the pair of values connected by lines each cycle are arrived at. A mode string for m can have a letter (to select a noise function), a digit (a 0-9 shaping level), and/or extra flag letters, in any order. The default level is 9; roughly, each level above 0 halves what remains of the unshaped underlying randomness. The functions are...

u
Uniform random (default). Ignores the level setting.
g
Gaussian random, soft-saturated approximation. On average ~6 dB quieter. Ignores the level setting.
b
Binary random. Extreme levels, more repetitive runs.
t
Ternary smooth random. Never repeats twice in a row; cycles above or below zero, randomly flips polarity.
f
Fixed cycle. Plain naive oscillator at the top level; below it, mixed with randomness at reduced amplitude.
a
Additive recurrence low-discrepancy a.k.a. quasirandom sequence. Ignores level digit. Uses subparameter .a.

In addition to the function and level, these flags can be set.

h
Half-shape waveform. Use with lin for a decreasing sawtooth instead of a triangle wave; similarly changes the shape for all line types and randomness modes.
p
Perlin noise mode. This reshapes the waveform so it returns to 0 at each cycle boundary. This removes the lowest frequencies, and shifts the peak of the frequency spectrum to the base frequency. Can be combined with any noise function and other mode flags, including violet noise modes for extra-thin noise. Transforms binary noise into a smoother noise. The amplitude may drop for ternary smooth random mode t.
s
Square, then restore sign, of the start/goal values. Turns uniform value variation into uniform energy variation; somewhat quieter, and more tremulant. Doesn't affect b, t, nor f with level 9. Distorts v violet noise toward white, as if mixed.
v
Violet rather than white noise version of the function if available; for u, b, and f, missing for g, t, and a. Like high-pass filtering the lower end of the noise, 6 dB per octave.
z
Zig-zag flip. Swap ends of each half-cycle, adding an inharmonic waveform jaggedness unless using h, or f level 9; more difference from these adds larger sharp steps. Always flips the waveform top and bottom.

There also exists these subparameters used for specific modes:

.a
Multiplier constant used for additive recurrence mode, defaulting to "met(1)" (see mathematical functions). Only the fractional value part is significant and used. Note that values like 0.0 and 1.0 result in silence (or DC offset); using irrational numbers gives good results and random ones often work.
For example, to use the silver ratio instead, ma.amet(2).

More sawtooth-like waveforms (including a naive sawtooth from line lin) are possible by adding the flag h (half-shape) to the mode – it switches each wave cycle from using two lines (down or up) each the same horizontal length, to using just one (down or flat) followed by a vertical jump. While the waveform looks as expected, using this option can reduce the purity of randomness (and also makes violet random modes 6 dB bassier); this is mainly provided for LFO and for naive oscillator uses where that doesn't matter.

In place of mode h, it's possible to instead distort the waveform less "perfectly", towards a rounded sawtooth shape rather than a naive ideal sawtooth shape, using self-PM a.k.a. "feedback FM". This also allows gradual and modulated morphing of the waveform. This affects all waveforms, including even squarish and noise line types, in what sounds like a more or less sawtooth-ish direction. (The exception is that if it sounds like bright noise already, then it will remain so. Also, self-modulating very hard will produce "glitches" and noise, eventually drowning out harmonic sound.)

The zig-zag flip flag z for the mode is another jagged waveshape distortion option, with a result depending on the other options – more randomness means a more jagged waveshape, and with a thin and bright inharmonic result. For example, with line type lin, it causes a chaotic mixture between triangle, randomly directed sawtooth, and square-like shapes, with the default randomness mode. It can also combine with mode mb to produce a wave which randomly switches between segments of binary noise and the selected line oscillation after half-cycles, or mode mt for random square steps and a constant line oscillation reaching zero in-between them. Zig-zag mode may be most interesting for creating LFO patterns.

W – Wave oscillator

Wave types for W
WaveDescription
sin Sine. For cosine, set phase p to 1/4.
tri Triangle. Mellow odd-harmonics wave. Opposite of ean relative to par.
srs Square root of sine. (Mirrored for the negative half.) Medium-bright odd-harmonics wave. Opposite of cat relative to mto.
sqr Square. Bright odd-harmonics wave. Opposite of eto relative to saw.
ean Evenangle. Mellow even-harmonics wave. Opposite of tri relative to par. To begin at 0.0 amplitude, set phase p to 6/93.
cat Catear. Medium-bright even-harmonics wave. Opposite of srs relative to mto. To begin at 0.0 amplitude, set phase p to 1/16.
eto Eventooth. Bright even-harmonics wave. Opposite of sqr relative to saw.
par Parabola. (x^2, steep part up.) Mellow all-harmonics wave. Between tri and ean. To begin at 0.0 amplitude, set phase p to 9/87.
mto Mellowtooth. (Half-rectified srs, amplitude doubled.) Medium-bright all-harmonics wave. Between srs and cat. To begin at 0.0 amplitude, set phase p to 1/25.
saw Sawtooth. Bright all-harmonics wave. Decreasing slope; use negative amplitude or frequency (but not both) for increasing slope. Between sqr and eto.
hsi Half-rectified sine. (Amplitude doubled.) Like a somewhat louder ean, harmonics decreasing as fast. To begin at 0.0 amplitude, set phase p to 1/12.
spa Sine parabola. (First half, amplitude doubled.) Slightly cleaner than par. Mainly useful for modulation. To begin at 0.0 amplitude, set phase p to -1/12.

The wave oscillator W is the oldest and most-used signal generator – a pretty plain and flexible oscillator of the kind often used for FM synthesis – especially with the sine wave type, typically inserted by writing Wsin (or just W) in a script.

Beyond sin, 3 × 3 complementary wave types are provided, in terms of:

  1. The added harmonics – odd, even, or all.
  2. More mellow vs. bright – whether the higher harmonics are weaker or stronger.

Additionally, there's 2 more wave types listed after these main 10; the ones at the end don't fit as neatly into the main groups, but have their uses as well. You can listen to all the wave types on the examples wave type subpage.

Producing a (weakly) anti-aliased signal, including for FM and PM, amplitude can be a little lower for frequencies close to half the sample rate.

More interesting uses of W usually involve using modulation. Usually, modulation either brings a slow, periodic variation to a sound – or when faster, creates "brighter" or more intense sounds from "mellower" or less intense ones; the waveforms available allow for a lot of simple combinations. Many complex and more dynamic sounds can also be created by combining more wave oscillators. Phase self-modulation a.k.a. "feedback FM" is also possible.

Wave oscillators can also be combined with other kinds of generators, in order to produce a larger variety of results. This can be done not only to produce a richer sound, but also sometimes to constrain it; ring modulation by a sine wave can for example be used to brighten the rumbly noise produced by the R oscillator, and reduce the lowest-frequency content, in place of using a frequency filter (currently not a feature) to a somewhat similar end.

Special W parameters

A wave type optionally follows the W, with sin used as the default if none. A lowercase w can be used to change the wave type later, e.g. Wsin t1; wtri.

Timing

Unless the time position is changed, things in a script all have the same time placement, i.e. they begin or take effect at the same time. So playing several things at the same time is easy – just write one thing after the next – while there's several ways to arrange them differently than that.

A /number, with "number" a time in seconds, adds a delay to everything after; it's the global forward-shift option, added between two parts of a script. The time separator | is related and adjusts the delay added to everything after so it exactly matches the duration, or play time, remaining for things before it. (When both of these options are used together, the order of use is important.)

To generate two tones, separated in time, and also insert an extra 2.5 seconds of silence in-between them:

Wsin f440 t2
| /2.5
Wsin f220 t2

While those two timing modifiers apply to everything which follows after in a script, there's other options which only apply more locally, described below.

Modulator time handling

Modulators are linked to carriers, and limited to only running when carriers do. By default, if no time duration is set for a modulator, it will not be further limited – it will run when a carrier using it runs. This removes the need to match time lengths set for carriers and modulators in scripts when the modulator should be used all the time.

Each modulator can also have its own time duration in seconds, however, set the same way as for a carrier, and then will run for the shortest of the time lengths. (If the carrier time expires first, this will "suspend" the modulator, unless and until the carrier time is set to a new non-zero length.) The special "implicit" time, which is the default for modulators, can also be set manually as the non-number value i (implicit time) for modulators (but not for carriers).

The non-number value d can also be used to set the default time which would have been set for a carrier.

Compound steps for an object

The numberless ; sub-step separator splits and extends the duration of a step for some object into two parts, one placed directly after the other. Parameter changes written after it will take place just after the time duration of the preceding part, and the following part will in turn have a new time duration. It can be used any number of times in a row, timing only changing locally within the compound step built this way.

It's often the simplest way of arranging a series of timed changes for an object. The following example plays four tones in sequence, each for 1.5 seconds:

Wsin t1.5 f100; f200; f300; f400

Here all four time durations are 1.5 seconds, for 6 seconds in total, because the default time for the 2nd part is copied from the 1st, and that of the 3rd is copied from the 2nd, etc. That's the rule, though there is an exception for modulators; modulators generally have an automatically fit time length by default (also possible to set with the special time value i, implicit time), and this is by default the case for the last (but only the last) sub-step when ; is used, so that using it does not unexpectedly shorten the total default time for the modulator.

Silent gaps can also be inserted within a compound step, adding to the duration, using the ;number gapshift syntax described more generally in the next section. A ;number written just after a ; adds a local time delay "number" of seconds long inside the compound step, analogous to using the more global | and /number-syntaxes together. For example, to add a 0.5 second silent gap between each change of tone in the current example:

Wsin t1.5 f100;;0.5 f200;;0.5 f300;;0.5 f400

Gapshifts & silent time padding

The gapshift ;number-syntax looks somewhat like the more global /number-syntax, similarly allowing time in seconds to be entered as a delay time – but only for the current step for some object. It behaves much like the compound step numberless ; and is another way to split a step and forward-shift the later part in time. The main use is to move a (sub-)step forward and leave a silent gap at the old position, but it can also extend the duration without leaving a silent gap.

Using ;number always resets time for the new part each use if a new t value is not provided. Unlike on the use of /number, a long shift doesn't simply move past a short time expired; if it moves past sound to silence, the silence may also be followed by sound with a new play time added.

It's possible to use only ;number in place of the numberless ;, but it may be more messy. For example, with two oscillators inserted at the same time, for the first of them. Time should be explicitly set before the ;1 is used, thereafter play time for the first oscillator will extend, rather than move; it will play for 3 seconds rather than 2, with the time reset to the previous value, 2 seconds, after 1 second.

Wsin f440 t2 ;1 f220
Wsin f110

Note that the setting of a time value explicitly for the first oscillator above, before the ;1, is important; otherwise the peculiar behavior is to insert a pause or "rest" by making default time 0 before the ;number while after it, the old default time is copied if a new time isn't set there. Changing the order to ;1 t2, the first 1 second will be blank for the first oscillator, and it will only play the last 2 seconds with 220 Hz (never with 440 Hz). Another example, where a tone plays after 1 second (for the usual default time) follows:

Wsin ;1 f880

Here nothing is missing and the delay is intended. Such use of silent time padding may mainly be interesting inside nested lists (to make another modulator start to play after a delay, say) when used by itself.

There's also another way to control the behavior of moving vs. extending, to disable or adjust the proportion of silent padding. When several ;number are used in series – with no numberless ; or other timing modifier in-between – then only the first can zero the time before it. So, for example, ;0 ;1 will never move more than 0 seconds, then will extend by 1 second.

Combined with nesting

The flow of time and the nesting of scopes are like two dimensions in which things are arranged – which corresponds to how the text in a script looks. When objects are placed inside of lists for nesting, as when adding modulators, the same time placement is used for the contents of the list as for where the list is assigned. In turn, inside of a list, a step written for an object can have sub-steps (using ; and/or ;number as described above), making for timing offsets which then apply for further lists assigned there in particular within the list.

Currently, the global timing /number and | syntax is not allowed inside of modulator lists, only at the top scope (where they are also the most useful). A way to use them at the level of a subscope block may be added in the future, as an alternative to using only the compound step syntax (which only applies to the current individual object and that which is nested below).

Here's an example of both timing and nesting which builds up a richer and richer noise, using PM, second by second.

Wsin f400 t1; p[
	Wsin ;0 r(3/4) ;1 p[Wsin f500 a1/5; a1/4; a1/3; a1/2; a1/1]
	Wsin ;2 r(3/5)
	Wsin ;4 r(3/6) ;1 p[Wsin f300 a1/5; a1/4; a1/3; a1/2; a1/1]
	Wsin ;6 r(3/7)
	Wsin ;8 r(3/8) ;1 p[Wsin f100 a1/5; a1/4; a1/3; a1/2; a1/1]
] t10; f800 t4

A timed series of changes for an object can, of course, also include smoothly swept values. Here is a modification of the PM "engine rumble" example which produces something differently-sounding, morphing over time as the innermost oscillator has its frequency ratio swept towards a series of new values – along with a little silent gap in the middle.

MP3
Wsin f137 t11 p[
	Wsin f32 p[
		Wsin r50*1.0 r[g50*0.1]; r[g50*0.2]; r[g50*0.25] t2.0
		; t1.5; t0.0; ;1.0 r[g50*0.75 t1] t2; r[g50*0.0] t0.5
		; r[g50*2.0] t2.0
	]
]

Channel mixing and panning

SAU supports stereo audio, but audio generators pass mono signals between one another. Objects which are not used as modulators, whose output is mixed into the final output, have an extra channel mixing parameter c which defaults to centered mixing (0.0), and can be changed to pan sounds, with -1.0 as hard left and 1.0 as hard right. The shorthand constants L for hard left, C for center, and R for hard right can alternatively be used in expressions for this particular parameter.

For example, to play a tone starting at the left and moving linearly to the right over 3 seconds using a value sweep:

Wsin f440 cL[gR t3] t3

The inner t3 above is actually optional, since the outer sets its default to that.

Modulators can also be added within c[], like within other modulator lists. The resulting panning-AM works like a variant of amplitude modulation that affects stereo placement – the effect disappears if the signal is later downmixed to mono. The sum of modulator amplitudes is added to the channel mixing used.

It's possible to pan harder than hard left and hard right; going "too far" in either direction simply amplifies what's added to that channel while giving what's added to the other a negative amplitude.

If several sounds are to be panned in the same way, for the main number it's possible to set an initial c value for all of them, by using the S c option for channel mixing prior to adding the sound generators. For example, writing S cL before adding some top-level audio generators will make c default to L for all of them.

Values and expressions

An assignment consists of a name followed by a value – without any symbol in-between for one-letter type or parameter names. It is a kind of expression, which contains a value subexpression for the value, or a series of value subexpressions if the value consists of several types of values which are provided together in one go.

For most parameters, a single number is a value; see numerical expressions below for expressions that produce a value and can be used in the role of a number value. There are also various other types of value:

Comments are text which is ignored, treated the same way as whitespace is; several comment styles are supported.

Modulator lists

The various modulation options have the modulator list in common. Within [], written after the name of a parameter that supports it, signal generators can be included for use with that parameter. For example, for PM the phase parameter p is assigned a list as in p[...]. It works the same for other parameters such as a (for AM/RM) and f (for FM), and subparameters such as a.r, etc.

Assigning a list to a parameter will append the new list to any old one, expanding it rather than replacing the old items. Thus p[] changes nothing. To clear old items when setting a list, add - before the [, as in p-[] (which removes all PM modulators).

Lists can be assigned together with other values (numbers) for various parameters. For the whole assignment expression beginning with the parameter name, whitespace can only be placed inside list brackets (or inside parentheses for any numerical expressions).

Value sweep for a parameter can use the same list as one which contains modulators; the modulators simply need to be listed after any sweep subparameters (see section) which head the list.

It's also possible to write multiple lists directly after one another when setting to a parameter (with or without the one leading -). These lists will be joined into one, meaning that [X][Y] for some contents "X" and "Y" is the same as [X Y]. This also allows placing sweep subparameters in a later list.

Numerical expressions

Each number can be written with or without a decimal point. If a decimal point is used, a leading 0 can be left out, as in .25. After a decimal point, at least one digit must always be written.

Operator precedence
SymbolsDescription
1 ^ To the power of (right-associative)
2 * / % Multiplication, division, remainder
3 + - Addition, subtraction (not as sign)

Number signs and arithmetic operation symbols can be used in infix expressions, together with numbers and named constants, variables, and functions. The rules are fairly simple and conventional, including precedence as in the table shown. Nested parentheses can be used freely. Parentheses also allow shorthand multiplication (leaving out a * between two parts), e.g. 2(3) and (2)3 both give 6.

Unless a numerical expression is written within parentheses, it cannot contain any whitespace, as it ends the expression. For example, -1 is fine, but - 1 is a dangling minus followed by a dangling number 1, if not inside parentheses as (- 1). The ability to write any expression, sans whitespace, without any surrounding parentheses is for convenience. For example, writing rational numbers with a division, e.g. 1/2, is often useful in scripts and this keeps it short.

Some parameters support named constants only available under those parameter names, as with frequencies as notes; unlike other constant names, they use capital letters, with or without anything more to go along with them.

Mathematical functions and constants

A set of mathematical functions are supported in expressions for all parameters, whether or not surrounding parentheses are used. Writing name(value) gives the result of applying the function name to the value. A few functions give a value without being provided any, like rand(), which returns a new pseudo-random value from 0.0 to 1.0 each time it is called. Listed here are also constants which can be used in any expression, unlike those with upper-case names specific to some types of expressions.

abs(x)
Absolute value of x.
arbf(x)
Additive recurrence base frequency. Returns a multiplier from -1 to +1 for how much the pitch will change for an R instance when x is set as the value for R ma.a. May be negative, corresponding to direction in a sawtooth-like wave which rises rather than falls; negative frequencies are supported.
arhf(x)
Additive recurrence higher frequency. Returns a multiplier from -2 to -1 or +1 to +2, locating the first frequency above the unshifted base frequency, with a value which mirrors arbf(x) around ± 1.0 with the same sign. (This upper frequency can be important for perception of brightness or even pitch for some sounds.)
cos(x)
Cosine of x.
exp(x)
Base-e exponential value of x.
log(x)
Natural logarithmic value of x.
met(x)
Metallic value, e.g. met(1) gives the golden ratio. Positive integers give the series of metallic ratios. Other values are also allowed: fractional, 0 giving 1 and negative (gives how much the positive value would be increased, approaching zero further from zero). Note that met(-x) is also equal to (1/met(x)).
mf
632.45... Geometric mean of 20 and 20000. Middle frequency in Hz of nominal human hearing range.
pi
3.1415...
rand()
Pseudo-random number in range 0-1. The PRNG is seeded using the magic variable, $seed. The value sequence from a series of calls restarts each new script.
rint(x)
Round value x to the nearest integer. Halfway cases are rounded to the nearest even integer.
sin(x)
Sine of x.
sgn(x)
The sign of x as ± 1 or 0. (The sign bit is also preserved for 0.)
sqrt(x)
Square root of x.
time()
Get a system timestamp number changed each second. It can be used for seeding in a randomized script. (Note that the exact value is platform-dependent.) If disabled (deterministic mode), instead gives 0.

A musically interesting function for frequency ratios and some other uses is met(x), which produces the metallic means/ratios/constants (the Wikipedia article has the formula used); for example, the golden ratio value of 1.618... is the result of met(1). For FM and PM, more irrational numbers creates more complex frequency spectrums, and a PM modulator oscillator can have its r parameter set with e.g. rmet(1). This is also used for additive recurrence oscillators (R with mode ma), the default multiplier using the golden ratio.

Frequency values as notes

When writing values for a frequency parameter, names for notes can be entered in place of raw numbers for frequency in Hz. (This goes both for a main value and sweep subparameter values.) Note names are treated as constants, replaced with their values when used, the values depending on the current settings under S fS f.n for A4 tuning frequency (default 440 Hz), S f.s for which tuning system to use, and S f.k for key selection (which mainly changes default or relative octave selection).

By default, notes use the 24-tone equal temperament or equal divisions of the octave (24-EDO) system, a superset of 12-EDO. There are also three justly intoned systems (Pythagorean JI, classic 5-limit JI, SAU 7-limit JI), in all of which each of the 7 notes have a natural, 3 flat, and 3 sharp variations, all of them unique.

Each note is written with a C, D, E, F, G, A, or B. As a first optional suffix, a b or f (flat) or s (sharp) can be added – or a quartertone alternative: d (half-flat), z (half-sharp), v (flat-and-a-half), or k (sharp-and-a-half). There's also w (double-flat) and x (double-sharp). The flats and sharps differ for EDO and the three JI systems – making a smaller difference in the JI systems than for EDO, except for the Pythagorean JI which very slighly exaggerates it instead.

An octave number (0–10) can then be added, e.g. A5 matches twice the tuning frequency, Ad5 a little below that. With no number, the octave for the note will be relative to the key setting (S f.k), and by default 4–5, so that the note for the selected key is also the lowest using the low default octave. To access more octaves from a relative position, add arithmetic (e.g. for A, A*2 is raised an octave and A/2 is lowered an octave).

Another means of microtonal variation is a subnote prefix for "inner octave" placement, optionally added at the very beginning: c, d, e, f, g, a, or b. (It can be combined with any other options.) The result is moving the tone, part of the distance from the diatonic note used to that above it. I.e., cC is the same as only C, but dC moves up one subnote step towards D, eC another step, and so on. (What about eCs? It likewise moves two subnote steps from Cs towards Ds, as the s is applied in addition.) If the diatonic part of the key selected is not C, this small letter scale rotates with it. In just intonation, the frequency increases apply rational fractions.

With the default EDO system and A4 tuning, note frequencies match the most common in conventional scientific pitch notation. The notation when including octave numbers is an ASCII variation on that (no subscripts for octaves, b instead of ♭, and s instead of ♯), with extensions. To reach octaves beyond 0–10 (C 16.4 Hz to 16.7 kHz), either combine the note with arithmetic, or do that to the tuning frequency instead (e.g. make it 220 or 880 Hz) to shift all octaves.

Cycle position values (phase & seed)

Phase parameter p values are treated in a special way, used modulo 1.0 so that there's no difference between 0.1, 1.1, and -0.9, for example – all of those values representing 10% of a wave cycle. Angles are often written as simple fractions, e.g. using p1/4 to turn sine into cosine. The unit used is the percentage of a wave cycle, intended to be more concise than values in radians, which require a multiplier of 2*pi for the same result, and nearly always include pi. (Note however that this unit differs from that of modulator amplitudes used for phase (a inside p[...] etc.) – where 1.0 corresponds to only pi in radians, as the range ± 1.0 is mapped to a full wave cycle.)

Seed parameter s values work the same way modulo 1.0, but here the resulting percentage is that of the state space (which wraps around analogously to phase in a wave).

The named constant G can also be used for the golden angle as cycle percentage in expressions for these parameters. For example, G*2 provides the 2nd leaf-around-a-stem angle, with any number n in place of the 2 providing the nth.

Numerical variables

Following $name=, an expression can be written which will have its value stored in the variable name. The name is a case-sensitive string of alphanumeric characters and/or underscores. To use the value in a later numerical expression, write $name; the leading $ sets variables apart from other numerical names. Unlike other symbols which take a numerical argument, whitespace is allowed both before and after the = (but parentheses are still needed to use whitespace within the numerical expression).

After a variable has been made to hold a number, it can be used in a new expression assigning it a new value based on the old, for example $name=$name*2. The value from such a reference on the right-hand side of the = is always the previous value.

Numerical expressions for some named parameters can use context-sensitive constants; to allow such when assigning a variable, one of the below parameter namespace names can be added after the =. Between it and any number or mathematical name after must be whitespace and/or a mathematical symbol, to keep names apart. For example, $freq=f A4 has the frequency value of the note A4.

c
Channel mixing values
f
Frequencies as notes
p
Cycle position values (phase)
s
Cycle position values (seed)

Non-overriding assignments

Scripts can receive named values via command-line arguments setting numerical variables. The passing of such values can be treated as either optional or requried by a script, and fallback values can be included in the script.

To only assign to a variable if it didn't hold a number, add a ? as in $name?=. Writing the first assignment of a variable in such a way will silently allow choosing whether or not to override the value via command-line argument. Doing this near the top of a script is recommended for optionally passed values.

If passing a value is meant to be required, then this can be treated as either a hard or a soft requirement. For a hard requirement, $?name will warn and stop the script from running after parsing if the value wasn't set. For a soft requirement, the syntax can be combined with an assignment as in $?name= for a combination of providing a fallback value, and warning if the value wasn't set beforehand; the script will still run after the warning, if not stopped by something else.

Any of these three approaches allow clean handling of missing arguments. By contrast, not using any of them and relying on a value being passed will, when it's not passed, result in other warnings or errors in the script when it tries to use undefined variables later on.

Magic variables

Magic variables
NameDescription
$seed Set to reset the rand() value sequence; defaults to 0 if no value was passed to the script. Does not hold a number when checked unless a value was passed or set, allowing non-overriding assignments, like $seed?=1. Keeps the last value set; $seed=$seed later resets. (Every bit counts; different expressions for the same number, with e.g. rounding may give different seeds.)

Built-in magic variables exist that perform a procedure when set, beyond holding a value. Like other variables, the initial values can be changed by passing options to a script to assign variables.

These special variables are related to those mathematical functions that are stateful, and in the case of $seed and rand() and time(), they're meant to be used together.

Labels for objects

The declaration of an object can be prefixed by 'name  to label the object name. Each name written is a case-sensitive string with alphanumeric characters and/or underscores, as with variables in general. Once labeled, the object can be referred back to by writing @name at any later point in the script; adding such a reference to the object does not automatically set a new time duration for it. (A new time value is set if any changes made to parameters include explicitly setting t (time), or if a step-splitting timing modifier is used.)

Note that a @name reference placed in a nesting scope different from the original (i.e. outside a list, or in a new list, etc.) does not move the object into the new nesting scope. It will not be added to, nor removed from, any list by being referenced anywhere. The time scope is however new and of the reference.

For example, the modulator used in this PM example is labeled name, and is then accessed using its label in order to change its frequency relative to the carrier at one-second intervals:

Wsin f500 t5 p[
	'name Wsin r1/1
]

/1
@name r1/2
/1
@name r1/3
/1
@name r1/4
/1
@name r1/5

Here the timing would also change for anything written afterwards (in a longer script) with every /1. The timing section describes more means of placing changes in time. The numberless ;-separator is often a neater alternative to label referencing, but can also be combined with it. (Here it uses the t value of each preceding part to only locally delay the sub-step which follows it.)

/1
@name r1/2 t1
; r1/3 t1
; r1/4 t1
; r1/5

In some cases, it's shorter and simpler to use the numbered form of the ;-separator, called a gapshift. Like the first example, this skips the use of t to set how long to wait between parts. Each /1 is replaced by a ;1 for a continuing @name reference. A gapshift combines with such references without making the first part silent, because the initial use of @name never automatically sets a new time duration, unlike later sub-steps, and unlike freshly added objects.

/1
@name r1/2 ;1 r1/3 ;1 r1/4 ;1 r1/5

Script options for default values and more

The capital letter S can be used to access and change options for default values which apply in part of the script, and more. Some settings can only be accessed through this option. Apart from that, this can be handy as a way to change a series of new values for e.g. oscillators; the same lowercase names are used after the S to access settings as would be used for the oscillator.

For example, to use a default f frequency value of 100 Hz for new oscillator-like sound generators, then S f100 would make that apply afterwards. Or to downscale the amplitudes for a series of audio generators (more below on that), S a1/16 could for example be used.

Changes made in this way apply in the current [] list scope, and also in lists nested more deeply – but not outside of the current list if it was done in a list. The amplitude setting is however special in that it has independent multipliers at each level of lists used for modulators, so that volume control does not inadvertently affect timbre and more by changing modulator amplitudes (with the exception of AM/RM modulators, which are adjusted in order for them to have the expected impact on the carrier amplitude).

a
Multiplier for amplitude a values after, in the current scope of [] nesting. Starts at 1.0. The multiplier also applies to a.r values, and to the multiplier in any deeper main a[] modulator list. It does not apply to other nested lists for modulators; their multipliers apply unchanged.
.m
Script-wide gain mix control (multiplier). If used, this disables automatic down-scaling of amplitude by the number of voices (carrier audio generators simultaneously producing signals), for manual control instead. Can only be set in the outermost scope.
c
Default channel mixing c value. Starts at 0.0, i.e. C (center). Useful as a main way of setting the parameter value.
f
Default frequency f value, in Hz. Starts at 440.
.k
Key selection for f values using note syntax, default C4. Mainly changes the default and relative octave. Can be C, D, E, F, G, A, or B, with or without one of b or f (flat), s (sharp), d (half-flat), z (half-sharp), v (flat-and-a-half), or k (sharp-and-a-half), w (double-flat), or x (double-sharp) – and/or an octave number (0–10) to move the default from a 4–5 range to one of the number to the number plus one.
.n
A4 tuning frequency in Hz for f values using note syntax. Starts at 440. For example, use S f.n432 for 432 Hz.
.s
Tuning system, either e (24-EDO, default), p (Pythagorean JI), c (classic 5-limit JI), or j (SAU 7-limit JI).
r
Default relative frequency r value, a modulator:carrier ratio. Starts at 1 (1/1, a "1:1" ratio).
t
Default short definite time t value, in seconds. Default times may be longer (and occasionally shorter) depending on the context. Starts at 1.0.

Value sweeps

To sweep a parameter which supports value sweep subparameters towards a goal value – the ordinary value being the start for a trajectory – following the ordinary value or by itself, a set of value sweep subparameters can be given values at the start of a [] list. (Any modulators added in a modulator list go after if the same list is used for both.)

Currently this is supported for amplitude, frequency, and channel mixing parameters. A main parameter (like a for amplitude) can be assigned to several times in a row, so sweep subparameters can be set all at the same time or separately; writing a0 a[g1] a[t1] or a0[g1 t1] gives the same result. It's also possible to set the ordinary value inside the [] instead, by using the name v for it to treat it as another sweep subparameter.

For example, the following tone begins at 20 Hz and rises exponentially to 20000 Hz, over 10 seconds:

Wsin f[v20 g20000 lexp] t10 a0.25

Here, l is a subparameter which changes the line shape (the default being lin, the linear shape). Note that the line shapes are not the same as any well-known mathematical functions with the same names. Each fills in points between the beginning (ordinary number) and the end value (g) in some way.

The sweep subparameters are as follows. The default values often allow two or three of them to be left out.

g
Goal (go-to) value, assigned to the parameter after time. This value has no default and must be provided. If changed again before the full time, the current point reached on the previous trajectory will be used to change the start value.
l
Line fill shape (default lin, or the previous shape if any). The exp and log shapes use ear-tuned polynomial approximations with definite beginnings and ends, designed to sound natural for frequency sweeping, and symmetric one to the other. The xpe shape increases like log and decreases like exp, much like a capacitor charges and discharges, natural-sounding for an envelope; and lge increases like exp and decreases like log. For a less-steep alternative to xpe, sqe can be used. The cos shape sounds similar to lin for a sweep, except it has a smoothly curved start and stop, and a steeper middle.
t
Time to reach goal (default is the external t duration, or the remaining previous time, if any, for this parameter). If longer than the active time for the object which has the swept parameter, the trajectory will be left unfinished.
v
Start (state) value, the ordinary parameter value. It can alternatively be set here after a v, if not set before the enclosing [].

Comment syntax

Several comment styles exist: