SAU examples with rendered audio

Example scripts for the SAU language, and audio files rendered from them using the saugns program. For short files that produce wave or noise types, etc., these are uncompressed WAV files so that the signal can be accurately viewed in an audio editor. For longer and other kinds of examples, MP3 files are provided; the uncompressed originals can be retrieved by re-rendering audio from the scripts.

These are not all available examples; more scripts are included with the saugns program. Rather, this page gives how-to pointers for designing sounds using main SAU features, beyond what's on the main language page. It also showcases some sounds for all visitors.

If you want to hear more of a script which here has a shorter duration, often it's possible to just copy it, adjust the t-number part(s) – for example, if it says t30, make it t10*60 for 10 minutes – and then re-render the audio. (Some scripts have no timed substeps, other scripts have timed parameter value changes or sweeps; the sound of tweaking t-values may differ depending on where and how they're used.) You can also try out tweaking scripts to add, change, or remove sweeps, and the use of LFOs, in addition to simpler parameter changes.


R (Random Segments) examples

Scripts demonstrating features and basic uses of R – the random segments generator. These examples often show it used together with W – the wave oscillator – but not always.

Using R can easily create pseudo-rhythms and pseudo-melodies, or pseudo-random rhythms or melodies which simply keep going and developing until the time runs out. But these will have relatively simple patterns.

Rumbles & blasts using R


Using Rcos with a low frequency – like 50 Hz (i.e. Rcos f50) – creates a deep rumble, suitable as an ambient sound (and similar to some differently-sourced rumbles in ambient tracks). Note that to hear this, you'll need speakers or headphones that can reproduce low frequencies.

There's however also other ways to make rumble, like using a Wsin carrier and then using Rcos as an FM modulator. Some variations on that theme – simply tweaking the parameter values – can make for thunder-like, explosion-like, and other sounds.

Explosion. Here's a "large explosion" blast which also includes a nice exponential fade-out at the end. A detail for the fade-out part (though its absence would have been hidden quite well by the fade-out) is that the pitch of the main modulator is frozen at the same time as the fade-out sweep begins. (The pitch is determined by the sub-modulator 'p', and its frequency is set to 0 Hz, freezing its output.)

Wsin f-500.r+500[
        Rcos r1.r10[
                'p Wsin p3/4 f1/5
] t5 /5 a{g0 lexp} t1.5 @p f0

Cat purr. A very different kind of richer rumble – imitating cat purring – is also possible with Rcos as a carrier, but a little more intricate. This uses a combination of AM (to shape the amplitude envelope, and brighten the sound), and a little PM (to make a somewhat richer sound). However, it sounds more like a cat which an ear or microphone is held close to, rather than a cat listened to at a distance; that "rumbliness" is a stubborn quality.

Rcos f50 p[
        Wsin r1 a1/2
] a0[
        Wsin r1 a1/3
        Wsin f1
] t20

Drumming using R

See the larger R drum collection for more.

There's several ways to use R instances for drumming, but the main possibilities come from using it for modulation. In particular, using an Rxpe PM modulator to make a carrier "beat" like a drum is a key ingredient in a range of simple recipes; apart from that modulator, the sound greatly depends on the choice of carrier. A more polished sound also usually depends on adding modulation of the amplitude to the carrier – for example using another R instance.

Looking first at the Rxpe PM modulator, intensity and pace of drumming can be constant or be psuedo-randomly varied, by tweaking its mode, frequecy, and amplitude. For a fixed-pace drumbeat, fixed cycle mode mf or ternary smooth mode mt can be used – otherwise it will be pseudo-random drumming, which can be given a variety of simple patterns (varying the brightness or intensity, the timing, or both). More variations are also possible by using several PM modulators with different settings for the same drum.

Technically, these drum sounds contain two different types of drum beat events which sound the same or similar. The PM modulator may rise (sharply at first), or it may fall (sharply at first) – and both will brighten the carrier's sound in the same way. If a W wave oscillator is used as the carrier, with its frequency set to 0 Hz, it will sound the same – but with an R generator as the carrier, it will normally sound a bit different, because R is pseudo-periodic and each part of its signal makes for a somewhat different drum hit.

For a start, here's a simple drum script with named variables for quantities like bpm and for "strength" (intensity and brightness) of the drum sound. The carrier has a very low frequency, rather than a frequency of 0 Hz – this helps vary the sound a little over time, instead of making it alternate between the exact same back-and-forth beats all the time. Otherwise, the f$bpm/(60*2) could be moved in to the modulator, with f0 added to the carrier. (A somewhat higher carrier frequency can also be used to produce a background hum or bassy noise which alternates with the drumbeats. For example, reusing the 'strength' variable, as in f$strength.)

Rlin f$bpm/120 p[
        Rxpe mf a$strength*(120/$bpm)
] t30

It's a start, but without more it sounds a little rough in several ways. The subjective audio quality can be improved, among possibly other and much larger changes, by tweaking the carrier. Even then, without also adding amplitude modulation, such drum sounds have flat peak amplitude, the sense of intensity change coming from frequency change only – which usually sounds too soft or flat to be musically nice.

Randomized, no amplitude-shaping

Below is a randomized version, with a little rumble in-between beats. Switching the R modulator to its default uniform random function mode, on average drumbeats seem to come less often – because beat intensity is sometimes too low to sound like a beat. Going beyond compensating for that, the 'bpm' numbers are doubled below, the bpm always reflecting the maximum rate (disregarding any missing beats, which also vary between the randomness modes which can be used).

With this randomization, there's little gaps between the drum "hits" that stand out, adding to a weak or empty sound – but as one way to change that, below these gaps are filled using a background bassy noise, by setting a higher frequency for the carrier derived from the "strength" variable. (The modulator now has its frequency set directly, instead of implicitly based on that of the carrier.)

Rlin mt f$strength/2 p[
	Rxpe f$bpm/120 a$strength*(240/$bpm)
] t30

This version also sounds less grainy; this is improved by using the ternary smooth random (mt) mode for the R carrier. Otherwise this randomized version would sound more, rather than less, rough.

Here's a sine-wave based chirp drum variation – too rudimentary a drum for use in a trance track, but thanks to the random pattern, not boring.

Wsin f$strength/3 p[
        Rxpe mv f$bpm/120 a$strength*(240/$bpm)
] t30

Here the modulator also uses the basic violet random mode (by adding mv) – a somewhat smoother drumming pattern (reducing occasional "gaps" from very-low intensity hits) based on violet noise, compared to the default uniform random mode (which is based on white noise). The underlying randomness used determines the pattern. (Differences are even larger between the binary, ternary smooth, and uniform variations of white noise random as underlying noise.)

For a richer and messier, yet fairly gentle sound, here's a variation which uses a half-rectified sine (Whsi) for the carrier, and makes the modulator follow a random pattern based on Gaussian white noise (mg).

Whsi f$strength/2 p1/12[
        Rxpe mg f$bpm/120 a$strength*(240/$bpm)
] t30

Finally – for now – let's go for one of the most intense and noisy drum sounds R can offer through a simple script. The line type sah produces a squarish wave, and both the tempo and the strength have been cranked up; the carrier again uses mt to keep the sound reasonably clear (as opposed to more distorted and crackly). The modulator uses the violet binary mode mvb, and so shifts rapidly and chaotically between two paces (half and full) while keeping each beat equally strong.

Rsah mt f$strength*(2/7) p[
	Rxpe mvb f$bpm/120 a$strength*(240/$bpm)
] t30

Different and more numerous variations to the carrier can sound decent when also shaping the amplitude, as in the below.

Non-random, with amplitude-shaping

With amplitude shaping, simple drum sounds without randomization begin to sound good to listen to. The various wave types available for the W oscillator then make for interesting variations. These sounds are more intense and use lower "strength" values to compensate, compared to those above. There's also less of a background rumble, as the amplitude shaping consists in sucking down the level in some way to create peaks.

Using Rsqe or Rcub for an amplitude modulator can work well, and, as done below, it can make for a "ducking" sound similar to that from compression, for pairs of strong and weak beats – the second sub-beat fading in from a low amplitude – like in some prominent 1990s techno and trance. Note that with these strong–weak beat pairs, the pace sounds like half the bpm technically used.

With such strong–weak beat pairs, it's often nice to vary the frequency used for each beat in the pair. This can be done by adding another inner modulator for the PM modulator that does the "beating", to vary its amplitude. (The p1/2 phase offset of the new inner modulator, if changed, moves the frequency top and bottom within each beat-pair.)

Furthermore, additional variation to color and brightness can be created using an extra LFO to tweak the carrier frequency value. A sawtooth LFO gives a straightforward effect that often sounds nice, though other wave types can create different effects.

Here's a script using the medium-bright square root of sine wave type for the carrier. This script is good for a start in experimenting with simple drum patterns – the carrier wave type can simply be changed and it'll sound pretty good for other types, too.

Wsrs f0[
        Wsaw f$bpm/240 a$strength*2
] p[
        Rxpe mf f$bpm/120 a$strength*(240/$bpm)/2.r$strength*(240/$bpm)[
                Rcos mf p1/2
] a1/8.r1[
        Rcub mf f$bpm/120
] t30


There's a simple way to produce more intricate, very bright and noisy sounds. While the usual line types result in a less bright spectrum above the f or r frequency used for an R instance, there is also a special noise line type – uwh (uniform white noise) – which fills the half-cycles with noise. The result also depends a lot on the R mode selection, which determines the differences in amplitude and DC offset between each noise chunk generated – the default mode gives such variation, others lessen or alter it in various ways.

Modulation is key to making the resulting sounds more intricate – but adding one wave oscillator is enough to produce a variety of noise-scapes, be they static, morphing, or with some pseudo-melody (in large part depending on the carrier frequency). Such sounds with the uwh line are much brighter than similar sounds made using normal line types for the R carrier – but generally too rough-sounding for many musical uses, e.g. "normal" techno sounds, at least without some filtering afterwards. Here's a somewhat melodious one-liner.

Ruwh t60 f2 p[Whsi f30 p1/12 a2]

Switching the modulator to the saw wave type, and reducing the carrier frequency to a fraction would produce something else, sounding a bit more like low-fi electronics acting up.

Noise from Ruwh can also be used to modulate another signal – and if FM rather than PM is used, the result is more mild.

Noisy sound effects, softer and harder

Apart from the full-on noise line type uwh, there's also two milder line-with-noise line types, which sound like the lin line type combined with a less intense white noise. This lesser noise is also limited in its bassiness, as it fades in and out over the line length.

The middling noise line type is nhl – "noise hump" line – which adds a noise that grows in intensity towards the middle of the line. The mildest variation is ncl – the "noise camel" line, named after the two softer noise bulges it has – which also sounds a little smoother and less bassy.

Here's a script using each of the 3 types for 5 seconds, from softer to harder – making a lot of little "blasts" which sound like something that may fit a 90s-style video game. (Some other related sound effects result if the modulator amplitude is changed, e.g. doubled.)

Rncl t15 f20 p[Wspa f30 a2] /5 lnhl /5 luwh

Other sounds using R

Metallic babbling

Using a wave oscillator to modulate an R carrier can produce a variety of audio textures – including vaguely sci-fi "metallic babble" or chattering. This example uses a triangle wave modulator (Wtri) – the frequency of the carrier, and in turn also the modulator, swept from a grim-sounding lower end to a more comical higher end.

Rcos ms f100{g300 lcos} p[
        Wtri r1/3 a12.5
] t15

Here the R mode ms produces deeper amplitude fluctuation, which sounds a little more "babbly".

W (Wave Oscillator) examples

The oldest core feature is W – the wave oscillator – which can be put to a great many uses through modulation. This section focuses on W alone, while other kinds of examples often show it combined with something else (as it's such a basic ingredient).

Wave type palette

Each instance of W can use any one wave type in the built-in set – available to listen to below, these waveforms are also described in the wave type table on the language page. This built-in set is meant to make the most useful static waveforms easy to reach for. Of course, further types of waves can be made by combining several W instances, adding waves of different type, frequency, phase, polarity, etc. – or modulating them.

The WAV files for the types have been produced with an extra-high sample rate and downsampled; this makes particularly the saw wave cleaner, but the difference with simpler rendering is otherwise difficult to hear.



Wsin t3

Odd-harmonic main trio


Triangle. Mellow – upper harmonics decrease fast.

Wtri t3

Square root of sine. Medium-bright – upper harmonics decrease moderately fast.

Wsrs t3

Square. Bright – upper harmonics decrease slowly.

Wsqr t3

Even-harmonic main trio


Evenangle. Mellow – upper harmonics decrease fast.

Wean t3

Catear. Medium-bright – upper harmonics decrease moderately fast.

Wcat t3

Eventooth. Bright – upper harmonics decrease slowly.

Weto t3

All-harmonic main trio


Parabola. Mellow – upper harmonics decrease fast.

Wpar t3

Mellowtooth. Medium-bright – upper harmonics decrease moderately fast.

Wmto t3

Sawtooth. Bright – upper harmonics decrease slowly.

Wsaw t3

Other wave types


Half-rectified sine. Mellow (louder harmonics) – upper harmonics decrease fast.

Whsi t3

Sine parabola. Mellow (quieter harmonics) – upper harmonics decrease fast.

Wspa t3

Licensing of examples

CC0 To the extent possible under law, Joel K. Pettersson has waived all copyright and related or neighboring rights to the example SAU scripts and rendered audio files provided on this page. This work is published from: Sweden.

To try to make that really clear, a script on this page appears as follows (assuming your web browser makes it stand out in any way)...

/* Script contents go here. */

Also, it would be interesting to hear if you make good use of this stuff in some work – and feel free to point people here, though it's not required.