SPA (Synthetic Parametric Audio) is an XML-based format for procedural sound generation. Unlike traditional audio files that store waveform data, SPA files contain instructions for generating sounds algorithmically.
<?xml version="1.0" encoding="UTF-8"?> <spa xmlns="https://spa.audio/ns" version="1.0"> <tone wave="sine" freq="440" dur="1" /> </spa>
Every SPA file starts with an XML declaration and a root <spa> element with namespace and version attributes:
<?xml version="1.0" encoding="UTF-8"?> <spa xmlns="https://spa.audio/ns" version="1.0"> <!-- Sound elements go here --> </spa>
Generates oscillator-based sounds with various waveforms. The fundamental building block for melodic and harmonic content.
wave: Waveform type - sine, square, triangle, saw, pulsefreq: Frequency in Hz (20-20000)dur: Duration in seconds (0.01-60)amp: Amplitude/volume (0-1, default: 1)envelope: ADSR envelope (default: "0,0,1,0")pan: Stereo position (-1 to 1, default: 0)filter: Filter type (lowpass, highpass, bandpass)cutoff: Filter cutoff frequency (20-20000 Hz)resonance: Filter resonance (0.1-20, default: 1)phase: Initial phase offset (0-360 degrees)at: Start time in seconds (for root-level timing)effect: Effect chain (comma-separated IDs)Pure, smooth tone - fundamental frequency only
Hollow, buzzy sound - odd harmonics
Mellow, flute-like - weak harmonics
Bright, rich sound - all harmonics
<tone wave="sine"
freq="440"
dur="1"
amp="0.8"
envelope="0.01,0.1,0.7,0.2"
pan="0.5"
filter="lowpass"
cutoff="2000"
resonance="2" />Generates various types of noise for percussive sounds, textures, and ambient effects.
color: Noise type - white, pink, brown, blue, violet, greydur: Duration in seconds (0.01-60)Equal energy at all frequencies - hiss
Natural sounding - rain, wind
Deep rumble - thunder, ocean
High frequency emphasis - steam
<noise color="pink"
dur="2"
amp="0.3"
envelope="0.5,0,1,0.5"
filter="highpass"
cutoff="500" />Container element for layering multiple sounds that play simultaneously. Groups can be nested for complex hierarchies.
<group amp="0.5"> <tone wave="sine" freq="261.63" dur="1" /> <!-- C --> <tone wave="sine" freq="329.63" dur="1" /> <!-- E --> <tone wave="sine" freq="392" dur="1" /> <!-- G --> </group>
Container for creating timed sequences of sounds. Each child element must have an at attribute specifying when it plays.
tempo: BPM for beat-based timing (20-300, optional)effect: Apply effects to entire sequenceat in secondstempo and use at as beat numbersat attribute<sequence> <tone wave="sine" freq="262" dur="0.25" at="0" /> <!-- C --> <tone wave="sine" freq="294" dur="0.25" at="0.25" /> <!-- D --> <tone wave="sine" freq="330" dur="0.25" at="0.5" /> <!-- E --> <tone wave="sine" freq="349" dur="0.25" at="0.75" /> <!-- F --> <tone wave="sine" freq="392" dur="0.5" at="1" /> <!-- G --> </sequence>