The SAU language & saugns program

saugns is an audio generation program. Written in C, it implements the SAU (Scriptable AUdio) language – a simple language for mathematical audio synthesis. SAU could also be called an audio programming language, or a music programming language, these being old and commonly used terms for something rather general.

Project and downloads

Browse pages

saugns program

More on command-line usage here.

saugns (the Scriptable AUdio GeNeration System) is a command-line player for SAU (Scriptable AUdio) files and text strings. It can also parse and simply check scripts, and it can write audio from them to a few formats: 16-bit PCM WAV file, AU file or stream, or raw audio sent to stdout (for interfacing with other applications).

The program is written in C, without dependencies beyond the standard C library plus system audio support on the given platform. While currently at most around 100 KB when built on my systems, it may grow with the language.

Only systematically 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 describes how to build and install it. (If you're running one of the 4 major BSD systems, `make` should be enough to get it built.)

Simple tests

After building the program, a 1-second 440 Hz test tone can be produced by simply running:

./saugns -e "Wsin"

A more interesting test to run after building may be the following, for 10 seconds of "engine rumble" using PM (it should sound like this):

./saugns -e "Wsin f137 t10 p[Wsin f10*pi p[Wsin r(4/3)(pi/3)]]"

Or for 30 seconds of random chirp drum drumming...

./saugns -e "/seed(time()) Wsin f200/3 p[Rxpe mt1 f5 a200/3] t30"

Further examples and test scripts come with the program, along with a concise SAU language reference, as described in the README file. (There's also a selection of examples with rendered audio available on the examples page.)

Licensing

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 – except for CC0 public domain example scripts and rendered audio.

SAU language

See the main broad language overview; for some specific uses, there's also more how-to examples. A more detail-focused language reference is in the README.SAU file.

SAU is a simple language for mathematical audio synthesis, deliberately without support for the use of pre-recorded samples. While developed with the aim of becoming useful for writing electronic music, it is currently mainly suitable for sounds and soundscapes. The language has significant technical limitations; by design not Turing complete, scripts all have calculable durations. Higher-level constructs for use and repetition of definitions are lacking, but more such functionality (possibly unusual in eventual form) is planned.

Currently, audio generation is supported through the use of the W (Wave oscillator, several wave types) and R (Random segments generator, several line types) object types – and modulation (AM/RM & FM) making use of them. An arbitrary number of generators 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.

Some ideas for future development are mentioned on the project wiki on Codeberg. Among them, a shorter list includes:

Contact

Any of the sites which the project is on can be used (the main ones being Codeberg and Framagit). Feedback is welcome, and you can also reach me by email (I'm "joelkp" at tuta.io, and "joelkpettersson" at Gmail.com).

I also have a personal website where I touch on related and other things.