SPB Git

Repository Public

mixing.md 6.3 KB

# Mixing

A composition is mixed through strips: one per track, one per bus, and the master.

# Track settings

sonata
composition "Track Settings" {
    tempo 100bpm
    instrument piano: GrandPiano {
        gain -6dB        // fader, in decibels
        pan -0.3         // -1 is left, 0 centre, 1 right
        chord [C3, G3, E4] duration 1/1
    }
    instrument flute: Flute {
        gain -9dB
        pan 0.4
        play G5 duration 1/1
    }
    instrument bass: FingerBass {
        mute             // silent, but still part of the piece
        play C2 duration 1/1
    }
}
  • gain goes from −120 dB to +24 dB; 0 dB leaves the level unchanged.
  • pan uses a constant-power law: a centred signal is 3 dB lower in each channel than a signal panned fully to one side, so loudness stays even as a sound moves.
  • mute silences a strip, its sends included. solo silences every track that is not soloed.

# Buses and sends

A bus is a strip that receives the signal of other strips. Two uses:

  • A group. output drums sends a track to the bus instead of the master, so one compressor and one fader control the whole kit.
  • A shared effect. send hall -8dB sends a copy of the track to the bus as well as its normal output; the bus holds a reverb at 100 % wet.
sonata
composition "Buses" {
    tempo 104bpm

    bus drums {
        gain -2dB
        effects {
            compressor drums
        }
    }

    bus hall {
        gain -8dB
        effects {
            reverb hall(mix: 100%)
        }
    }

    instrument kick: Kick {
        output drums
        repeat 4 {
            play C2 duration 1/4
        }
    }

    instrument snare: Snare {
        output drums
        send hall -12dB
        repeat 2 {
            rest 1/4
            play D2 duration 1/4
        }
    }

    instrument keys: ElectricPiano {
        gain -8dB
        send hall -6dB
        chord [A2, E3, C4, G4] duration 1/1
    }
}

send BUS GAIN takes the signal after the track's fader, so turning the track down turns its reverb down too. send BUS GAIN pre takes it before the fader. Buses can send to other buses and choose their own output; routing in a circle is an error (G5001).

When paths of different latency meet — a track with a look-ahead limiter and one without — the compiler adds exactly the delay needed so that everything arrives aligned.

# Automation

automate TARGET { } draws a curve for a parameter: a list of position: value points.

Target What moves
gain, pan the strip's fader and position
instrument.PARAM a parameter of the track's instrument
EFFECT.PARAM a parameter of an effect declared above (reverb.mix, delay.feedback)
sonata
composition "Automation" {
    tempo 120bpm
    instrument pad: SynthPad {
        gain -10dB
        automate gain {
            0bars: -40dB
            2bars: -10dB exp
            4bars: -10dB
        }
        automate pan {
            0bars: -0.8
            4bars: 0.8
        }
        chord [D3, A3, F4, C5] duration 4bars
        effects {
            delay(time: note_value(1/4), feedback: 0.2, mix: 0.2)
        }
        automate delay.feedback {
            0bars: 0.2
            4bars: 0.7
        }
    }
}
  • Positions are durations counted from the cursor at the place of the statement. Written at the top of a track they are positions in the piece.
  • Each point can name the shape of the segment that ends at it: linear (the default), exp (even to the ear for levels and frequencies) or step (hold the previous value, then jump).
  • Values use the unit and the range of the parameter.
  • Only parameters marked automatable in the reference can be automated (T3014 otherwise).
  • The statement does not move the cursor.

The second effect of the same kind in a chain is addressed as delay[1].feedback.

# The master

sonata
composition "Master" {
    instrument piano: GrandPiano {
        chord [C2, C3, G3, E4] duration 1/1 velocity 1
    }
    master {
        sample_rate 48000Hz
        gain -2dB
        peak_limit -1dB
        effects {
            eq(low_cut: 30Hz)
            compressor glue
        }
    }
}
  • sample_rate is the rate of the project: 44 100, 48 000, 88 200, 96 000, 176 400 or 192 000 Hz (48 000 when left out). A render can choose another rate.
  • peak_limit is the ceiling of a safety limiter at the very end of the chain, −1 dBFS when left out. It is there so that a mistake never becomes a dangerously loud sound.
  • peak_limit off removes the limiter, for measurements and for exports that must be exactly what the code produces:
sonata
composition "No Limiter" {
    instrument tone: FluteOrgan {
        gain -12dB
        play A4 duration 1/1
    }
    master {
        peak_limit off
    }
}

Nothing is normalised implicitly. A render has the level the code and the mixer give it, unless you ask for normalisation when exporting (Exports).

# Levels and loudness

The mixer's meters show, for every strip, the peak (the largest sample) and the RMS level over 300 ms. The master panel adds loudness measured on what was actually played, according to ITU-R BS.1770-4:

Reading Meaning
Momentary loudness over the last 400 ms
Short-term loudness over the last 3 s
Integrated loudness since playback started (gated)
True peak the highest peak between samples, in dBTP

The loudness meter is validated against the standard's reference: a 1 kHz stereo sine at −23 dBFS reads −23.0 LUFS within 0.1. sonata render prints the peak, true peak and integrated loudness of every file it writes.

A practical habit: keep peaks of single tracks around −12 dBFS and let the master land between −20 and −14 LUFS; the limiter then has nothing to do.

# The order of things

For each sample rate the compiler builds the mixing graph:

  • a track: instrument → effects → fader and pan → its output; sends leave before the fader (pre) or after it;
  • a bus: the sum of what it receives → effects → fader and pan → its output;
  • the master: the sum → effects → fader → limiter → output.

The Compiler space (Compiler) draws this graph with the latency of every node.

Files main
Menu

Theme