SPB Git

Repository Public

effects.md 7.1 KB

# DSP and effects

Effects process the sound of a track, a bus or the master. Sonata has 18 of them; each is described with all its parameters in the effect reference.

# The effect chain

effects { } lists the effects of a strip in the order the signal passes through them.

sonata
composition "A Chain" {
    tempo 100bpm
    instrument keys: ElectricPiano {
        chord [D3, A3, F4] duration 1/2
        chord [C3, G3, E4] duration 1/2
        effects {
            eq(low_cut: 80Hz, high_gain: 2dB)
            chorus lush
            delay(time: 250ms, feedback: 0.3, mix: 0.2)
            reverb hall(mix: 0.2)
        }
    }
}

An effect is written kind, optionally a preset, optionally arguments in parentheses:

Form Meaning
chorus the effect with its default settings
chorus lush a preset
reverb hall(mix: 0.2) a preset with some values changed
delay(time: 250ms, feedback: 0.3) default settings with some values changed
bypass chorus lush present in the chain but switched off

Arguments are always named, and checked: time wants a time or a musical duration, feedback a ratio, low_cut a frequency. An unknown preset or parameter is an error with a suggestion:

sonata,error=S2022
composition "Unknown Preset" {
    instrument piano: GrandPiano {
        play C4
        effects {
            reverb hal
        }
    }
}

# Dry and wet

Every effect has a mix from 0 (only the original signal) to 1 (only the processed signal); percentages work too (mix: 30%). Each effect has a sensible default: 1 for an equaliser or a compressor, less for a reverb or a delay.

The dry signal is delayed by exactly the latency of the effect before the two are mixed, so the mix never smears the sound. A bypassed effect keeps its latency for the same reason: switching an effect off never shifts a track in time against the others.

# The effects

Kind What it does Presets
eq low cut, low shelf, three bells, high shelf, high cut air warm clean_lows presence telephone
filter low-pass, high-pass, band-pass or notch, 12 or 24 dB per octave dark resonant_sweep
compressor reduces level above a threshold gentle vocal drums glue
limiter look-ahead ceiling master loud
gate, expander reduce level below a threshold tight soft; subtle
delay stereo or ping-pong echo with filtered feedback slap echo dub
chorus, flanger, phaser modulation lush shimmer; jet through_zero_like; slow_swirl vibe
reverb algorithmic reverberation room chamber hall plate cathedral
convolution convolution with a synthetic room response dark_hall bright_room
distortion, saturation non-linear colour, oversampled crunch fuzz warm; tape hot
bitcrusher fewer bits and a lower sample rate retro destroyed
stereo_width narrows or widens, with mono bass mono wide
tremolo, autopan level and position modulation vintage helicopter; slow_drift

The convolution reverb uses room responses generated by the program itself; no recording is bundled.

# Tempo-synced times

A parameter that is a time also accepts a musical duration, converted at the tempo of the start of the piece:

sonata
composition "Synced Delay" {
    tempo 96bpm
    instrument pluck: SynthPluck {
        for n in [D4, A4, F4, A4] {
            play n duration 1/4
        }
        effects {
            // A dotted-eighth echo, ping-pong between the channels.
            delay(time: note_value(3/16), feedback: 0.4, mode: ping_pong, mix: 0.3)
        }
    }
}

note_value(3/16) makes a duration from a fraction; the constants quarter, eighth and sixteenth are durations too. In 0.1 the conversion uses the tempo at position 0: an effect time does not follow later tempo changes.

A bare number is refused, because the compiler cannot know whether you meant seconds or a fraction of a note:

sonata,error=T3006
composition "No Unit" {
    instrument piano: GrandPiano {
        play C4
        effects {
            delay(time: 0.25)
        }
    }
}

# Dynamics

sonata
composition "Dynamics" {
    tempo 110bpm
    instrument kick: Kick {
        repeat 8 {
            play C2 duration 1/4
        }
        effects {
            compressor(threshold: -18dB, ratio: 4, attack: 10ms, release: 120ms, makeup: 3dB)
            saturation tape(mix: 0.5)
        }
    }
    instrument bass: PickBass {
        gain -4dB
        repeat 4 {
            play E2 duration 3/8
            play E2 duration 1/8 staccato
        }
        effects {
            compressor gentle
            gate soft
        }
    }
}

# Colour

sonata
composition "Colour" {
    tempo 92bpm
    instrument lead: SynthLead {
        gain -10dB
        for n in [E4, G4, B4, D5, B4, G4] {
            play n duration 1/8
        }
        play E4 duration 1/4
        effects {
            distortion crunch(mix: 0.6)
            filter(mode: lowpass, cutoff: 3500Hz, resonance: 2)
            phaser vibe(mix: 0.4)
            stereo_width wide
        }
    }
}

# Space

A reverb placed directly on a track belongs to that track. To put several instruments in the same room, give the room its own bus and send to it; this is described in Mixing.

sonata
composition "Space" {
    tempo 66bpm
    instrument choir: ChoirAahs {
        gain -8dB
        chord [A3, C4, E4] duration 1/1
        effects {
            reverb cathedral(mix: 0.4, predelay: 30ms)
        }
    }
}

# Effects that change over time

Parameters marked automatable in the reference can be drawn as a curve with automate, naming the effect and the parameter. The effect must be declared above the automation.

sonata
composition "A Filter Sweep" {
    tempo 124bpm
    instrument pad: SynthStrings {
        gain -8dB
        chord [D3, A3, D4, F4] duration 4bars
        effects {
            filter(mode: lowpass, cutoff: 300Hz, resonance: 3)
            reverb hall(mix: 0.2)
        }
        automate filter.cutoff {
            0bars: 300Hz
            3bars: 8000Hz exp
            4bars: 600Hz
        }
        automate reverb.mix {
            0bars: 0.1
            4bars: 0.5
        }
    }
}

# What the numbers mean

The effects were measured, not only written: the limiter never lets a sample above its ceiling, the compressor follows its static curve, a delay is exact to the sample, the equaliser has the gain you ask for at its centre frequency, the reverb's measured decay is within 35 % of its decay setting. The Filter Lab of WaveLab shows the amplitude, phase and impulse response of any effect with the parameters you choose.

Known limits of 0.1: the limiter works on sample peaks (inter-sample peaks are measured by the meters, not limited); changing the size of a reverb while it sounds is audible; the space, decay and brightness of the convolution reverb are fixed once it is sounding.

Files main
Menu

Theme