saugns & SAU language

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

saugns program

Further command-line usage examples/instructions can be found 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.

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 100KB once built, it may grow with the language.

saugns is distributed under the terms of the GNU Lesser General Public License (LGPL), version 3 or later.

Supported platforms include x86 and x86-64, running DragonFly, FreeBSD, Linux, NetBSD, or OpenBSD.

Building requires a C99 compiler toolchain and running `make` (GNU or BSD). On Linux systems, the ALSA library (libasound2) needs to be installed. On the 4 major BSDs, the base systems have everything needed.

A quick test after building is the following, which should beep a sine wave for 1 second:

./saugns -e "Osin"

Or, for something more interesting, the following produces 10 seconds of "engine rumble" using PM:

./saugns -e "Osin f137 t10 p+[Osin f32 p+[Osin f42]]"

A set of example and test scripts are also included, under examples/. (These are copied to a share/examples/saugns/ directory with `make install`.)

Basic usage information can also be found in the accompanying saugns(1) man page (installed with `make install`, typically ran as `sudo make install`).

SAU language

A brief overview of the syntax is available here. A compact language reference is included in the saugns doc/README.SAU file (GitHub view).

SAU is a simple language for mathematical sound 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 retro-ish in its qualities. It is however easy to use for experimenting with sounds.

A collection of basic wave types are supported, as well as AM, FM, and PM (the "FM" of most commercial synthesizers). An arbitrary number of oscillators can be used.

Compared to older and more well-known audio synthesis languages, SAU is simpler (and less developed/full-featured) and more focused on FM/PM. There are differences in basic ideas concerning the language, which will be reflected in further development.

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.

Project and plans

The history of the project 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.