saugns & the SAU language

saugns is an audio generation program. Written in C, it implements the SAU (Scriptable AUdio) language – a simple language for mathematical audio synthesis.

Project and downloads

Browse pages

saugns program

More on command-line usage here.

saugns (the Scriptable AUdio GeNeration System) is a command-line program which reads SAU (Scriptable AUdio) scripts or strings and produces audio. Output can be to system audio, and/or a 16-bit PCM WAV file, an AU file or stream, or raw audio sent to stdout (for interfacing with other applications).

The program is written in C and on the lightweight side, without any dependencies beyond the standard C library and support for system audio on the given platform. While currently smaller than 100 KB when built on my systems, it may grow with the language.

Mainly tested on x86/x86-64 on *BSD and Linux systems, but may generally work on 32-bit and 64-bit little-endian systems for those OSes without the need for changes.

The README file (GitHub view) describes how to build and install it. (Short version: For the 4 major BSDs, `make` is enough to get it built.)

Simple tests

The program built, a 1-second 440 Hz test tone can be produced by simply running:

./saugns -e "Osin"

A more interesting test to run after building is the following, which produces 10 seconds of "engine rumble" using PM:

./saugns -e "Osin f137 t10 p[Osin f10*pi p[Osin r4/3(pi/3)]]"

Or how about three 1-second random PM timbres?

./saugns -e "/seed(time()) Osin p[Osin rrand(); rrand(); rrand()]"

A set of example and test scripts are included, along with a concise SAU language reference, as described in the README file.


saugns is distributed under the terms of the GNU Lesser General Public License (LGPL), version 3 or later. Some smaller parts are however more permissively licensed, and each such file notes which license (e.g. the ISC license) it is provided under.

This website is available under the Creative Commons Attribution-ShareAlike 4.0 License.

SAU language

A more how-to overview is here. A more detail-oriented language reference is in the saugns doc/README.SAU file (GitHub view).

SAU is a simple language for mathematical audio synthesis, without support for the use of pre-recorded samples. While developed with the aim of becoming useful for writing electronic music, the language still has significant limitations, and the audio generated is somewhat retro-ish in its qualities. It is however easy to use for experimenting with sounds.

Currently, the only type of audio generator is the oscillator. A set of wave types are supported, as well as AM/RM, FM, and PM (the "FM" of most commercial synthesizers). An arbitrary number of oscillators can be used.

The long-term goal is for the syntax both to describe complex sounds in a simple way, and, especially, for it to make it simple to write long and intricate sequences of sounds – music – both tersely and in a way easy to mentally map and keep track of. The former may be the easier part; the latter requires greater expressiveness than the language has at present. The road towards something more full-featured is different than that taken by most languages. But the planning is only half-formulated, and ideas are welcome, as long as they allow for something reasonably simple.

Changes between versions

The SAU language sometimes changes between versions of the saugns program. Changes are listed both in the version tags and in a shorter language change log.

Project and plans

The history is briefly described here.

At some point in the future, the bulk of the program could be split off into a C library implementing support for the SAU language. Such a library could be used in e.g. media players to play SAU files, or in retro-ish games to play music or sounds from SAU files.

Some further ideas are listed on the saugns GitHub wiki.

I have a mostly software-related personal website where I touch on related things.


Any of the sites which the project is on can be used: GitHub, Codeberg, or Framagit. Feedback is welcome, and you can also reach me by email (Gmail, joelkpettersson).