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 the available examples; a somewhat different collection is included with the saugns program. Even more can be found in the extra-scripts git repository. 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.

Contents

N (Noise Generator) examples

See also the simple test signal examples on the usage page.

The N noise generator isn't so musically interesting in itself – but for modulation purposes, N can sometimes be handy as a way to add some plain noise to a parameter. An example can be seen among the R soundscapes.

For adding plain noise, N has a superset of the noise types of R (though somewhat different labels are used for N noise types compared to R modes).

R (Random segments oscillator) examples

The R random segments oscillator was invented for the SAU language, combining the value noise generator and through-zero "FM operator". (R can also be used in a mode which turns it into a plain naive oscillator.) It is easily used for noisy sounds with a rumbly character, or to introduce some pseudo-random variation to timbre, tone, etc. by modulating things with it. It has many modes, and sounds from it can be sharp and noisy or mellow and rumbly, but it can require extra processing to get something in-between those extremes out of R.

Examples below demonstrate some of its features and basic uses. It's often used together with W – the wave oscillator – but not always; in carrier-and-modulator chains, both R and W can play either role (carrier or modulator) in any combination.

Rumbles & blasts using R

Test tone rumble. This is to the R oscillator what a 440 Hz test tone is to the ordinary W oscillator. The base frequency is likewise the default 440 Hz – bright for a rumble, and similar to low-pass filtered white noise.

WAV
Rcos t3
Waveform image

Various other waveform variations are possible, e.g. using Rlin for some added odd harmonics, mv for a less bassy sound, or mg for a more Gaussian amplitude fluctuation pattern. With all the line types and modes, there's many combinations – too many for a full table of them all to be useful (unlike the simpler wave type palette for the W oscillator). However, more are described in a blog article on such noise types (and modulation using them) giving a more technical desription of the R oscillator.

Deep rumble. Using Rcos with a low frequency (here 50 Hz) 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.

MP3
Rcos f50 t15

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.)

MP3
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 a little too dull compared to real cat purring.

MP3
Rcos f50 p[
        Wean r1 a1/2
] a1/3[
        Wsin r1 a0[
                Wspa f1 a1/3
        ]
        Wspa f1 a1/3
] t30

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 oscillator 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.)

MP3
$bpm=240
$strength=100
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.)

MP3
$bpm=480
$strength=100
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.

MP3
$bpm=480
$strength=100
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).

MP3
$bpm=480
$strength=75
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.

MP3
$bpm=600
$strength=125
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.

MP3
$bpm=150*2
$strength=30
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

Soundscapes and pseudo-melodies

Using R can easily create pseudo-melodies and (to a lesser extent) pseudo-rhythms, that is pseudo-random melodies and rhythms which simply keep going and developing until the time runs out. These will have relatively simple patterns and won't stick to the norms of harmonic composition, but can be nice enough as background sound. (Note that the simplest R randomized "synth instruments" trick of using an R carrier with a very low, single-digit Hz frequency, and then modulating it into making a bright synth soundscape, usually results in plenty of infrasonic frequencies remaining in the signal – a rumbly quality may or may not be audible.)

The unusual "ternary smooth random" mode (mt) makes for a more harmonically pure and steady signal than other modes, apart from the fixed cycle mode f. This can make R oscillators usable as more deeply nested modulators, for producing a sharp and crisp sound, when even a small amount of noise in such a role otherwise leads to a more diffuse result, overpowered or at least diluted by noise. The following soundscape is a simple example; here, the Gaussian mode mg is also used for the R carrier instead of the uniform random default, as a simple way to get more loudness fluctuation to the sound.

MP3
$f=10/3
Rcos mg f$f t60 p[
	Wsin r10 a4 p[Wsin r-2.r+2[Rlin mt p0/4 f20*$f]]
]

More harmonically rich line and wave types, like using Rlin and/or modulating with Wtri, can also sometimes result in pleasant sounds.

Use with N. The following script goes a step further, and uses Nwh to noisily stretch out the frequencies of the wave oscillator in the middle of the modulation chain to a larger range; why pick one frequency, or another, when each makes the sound a bit fuller in some way, when you can instead use noise to select all of them? For "real FM" as done here, this colors the sound with brown noise, not white noise, as a result of integration taking place inside the middle oscillator – so the result isn't harsh.

MP3
$seed=2
Rlin f3 t60 p[Wtri r8.r32[Nwh] a2]

Randomized "notes". While the above example has a random mixture of sounds in a range of them, it also stays quite flat in that it seems to stick to the same note. For a better pseudo-random "melody", R can be used instead of N as an inner FM modulator. But while it may seem intuitive to use Rsah to vary the frequency – resulting in squarish jumps between different frequencies – doing so sounds rather stiff. By contrast, Ruwh is a noisy line type (described further below), adding varying amounts of white noise to the squarish steps, which sounds more organic or "fluid" in how frequency varies.

MP3
$seed=0
Rlin f3 t60 p[Wtri r8.r32[Ruwh f1] a2]

This sounds quite soft, and for simple scripts like this, much in the sound will change with tweaks to line and/or wave type selection in carrier or outer modulator, and how they modulate. Here's a different sound, a preudo-random bass melody.

MP3
$seed=1
Rlin f2 t60 p[Wmto r8.r64[Ruwh f1] a2]

Note that the non-quantized random values used to vary the frequency makes it hit notes outside the customary 12-tone scale. Simple scripts for this kind of pseudo-melody always end up microtonal.

Noise-on-noise

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, like pleasant synth sounds, at least without some filtering afterwards. Here's a somewhat melodious one-liner.

MP3
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. Pseudo-melody examples above use it as it's less stiff-sounding than using the pure squarish Rsah to flip between frequencies.

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.)

MP3
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.

MP3
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.

WAV

Sine.

Wsin t3

Odd-harmonic main trio

WAV

Triangle. Mellow – upper harmonics decrease fast.

Wtri t3
WAV

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

Wsrs t3
WAV

Square. Bright – upper harmonics decrease slowly.

Wsqr t3

Even-harmonic main trio

WAV

Evenangle. Mellow – upper harmonics decrease fast.

Wean t3
WAV

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

Wcat t3
WAV

Eventooth. Bright – upper harmonics decrease slowly.

Weto t3

All-harmonic main trio

WAV

Parabola. Mellow – upper harmonics decrease fast.

Wpar t3
WAV

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

Wmto t3
WAV

Sawtooth. Bright – upper harmonics decrease slowly.

Wsaw t3

Other wave types

WAV

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

Whsi t3
WAV

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.