### From The MPEG-4 Structured Audio Book by John Lazzaro and John Wawrzynek.

# Part II: The SAOL Language

## Introduction

MPEG-4 Structured Audio (MP4-SA) is an ISO/IEC standard (edited by Eric Scheirer) that specifies sound not as audio data, but as a computer program that generates audio when run. For an introduction to MP4-SA see this short example or read the introductory tutorial presented in Part I of the book.

In Part II of the book, we focus on the SAOL language.

In the first chapter we describe the atomic units of SAOL expressions. We cover the lexical rules for numbers and names, and the declaration of signal variables and instr parameters. We describe the standard names and the global parameters.

In the second chapter we descibe SAOL arithmetic and logical expressions and the statements for assignment, conditionals, and looping.

In the third chapter we descibe the core opcodes for general-purpose computation, and introduce rate and width rules for core opcodes.

In the fourth chapter we introduce the SAOL wavetable type, that is specialized for holding sample data. We introduce the set of core opcodes that directly manipulate wavetables, as well as the set of wavetable generators for initializing wavetables.

In the fifth chapter we cover language features that relate to audio buses in SAOL. We describe the send, route, and sequence commands that create buses and effects instrs, and explain the rules of determining execution order of instr instances. We also describe the SAOL statements for writing to buses, and bus-specific standard names and global parameters.

Next:Part II/1: Numbers and Variables

## Part II: Table of Contents

#### 1. Numbers and Variables

- Numbers and Names. Syntax for atoms.
- Instr Parameters. Instr preamble declarations.
- Instr Variables. Scalar and array declarations.
- Global Variables. Declaration and initialization.
- Standard Names. Read-only system variables.
- Global Parameters. To alter SAOL defaults.

#### 2. Expressions and Statements

- Arithmetic. Basic expression evaluation.
- Arrays. Expressions and width.
- Logic. Boolean and relational operations.
- Assignment. Changing signal variables.
- If and If-Else. Conditional logic.
- While Statement. Iteration.

#### 3. Simple Core Opcodes

- Core Opcode Semantics. Rate and width rules.
- Transcendentals. Trig, log, power functions.
- Quantization. Rounding functions.
- Random Numbers. Also binary sequences.
- Loudness. dB conversions.
- Pitch and Tempo. Musical notation conversions.

#### 4. Wavetables

- Declarations. Declaring tables and tablemaps.
- Periodic Waveforms. Additive and subtractive synthesis.
- Envelope Waveforms. Piece-wise table generators.
- Sound Files. Reading audio files into tables.
- Table Playback. Core opcodes for table readout.

#### 5. Buses and Execution Order

- Output Statement. The output width of an instr.
- Effects Instruments. Instances that process audio input.
- Send and Route Statements. Connecting instruments.
- Execution Order. Rules and overrides.
- System Buses. input_bus and output_bus.
- `outbus` and `spatialize`. Alternative output.

Copyright 1999 John Lazzaro and John Wawrzynek.