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 parser and player for SAU (Scriptable AUdio) files and text strings. It can also write audio from scripts to WAV files, Au streams, and raw data.

This project is written in C, without dependencies beyond the standard C library plus system audio support on the given platform. (Only systematically tested on x86/x86-64 on *BSD and Linux systems, because that's what I have and run.) Small and fast, the program can also be used on old and underpowered laptops.

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, with randomly strong dynamics-shaping...

./saugns -e "\$seed=time() Wsin f33 p[Rxpe mt1 f5 a33] a0.r1[Rcub f5*2] 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; scripts can usually be thought of as audio files in a terse text format.

While a longer-term aim is to give it greater expressiveness for use in writing electronic music, it is straightforward to use for sounds and soundscapes, with small scripts able to produce complex sounds. The language intentionally has a restricted form, and is not Turing complete, each script having a duration which can be calculated without truly running it.

Audio generation can use the following types of audio generators and ways of configuring them:

The language is a work in progress. Long-term goals include for its features to make it simple to write longer, more intricate sequences of sounds – such as music. As for the instructions, generator types, etc. available, the road towards something more full-featured focuses on building a small collection of flexible things, rather than a large one of many mostly alike.

Presently, the main lack in the language features is that reusing sounds and change sequences requires a lot of copying of script text with changes to that which is copied. But if such tedium is tolerated, it is fully possible to write music. Some key features in popular music-making software, such as processing to add echo and reverb, is however missing, which limits the resulting sound.

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 and issues 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.