Add Signals
Sum, average, and weight multiple audio signals with precise alignment, gain staging, polarity control, and safe normalization.
What this does
Select two or more Sound objects and combine them into a single output via sum, average, or weighted mixing. The script aligns lengths, manages sample-rate differences (with optional resample), applies per-signal gain/polarity, and prevents clipping via peak normalization or headroom trims.
- Any channel count: Works on mono or multi-channel; channels are summed positionally.
- Alignment: Match by start, end, or explicit offset. Optionally stretch shorter items with silence.
- Gain staging: Per-input gain in dB or linear, plus polarity invert and DC removal.
- Safety: Normalize, automatic headroom, or hard-limit (optional).
sum_N (or custom) is created.Quick start
- Select two or more Sound objects in Praat.
- Run script… →
Add signals.praat. - Choose mix_mode (Sum, Average, Weighted).
- Enter optional gains_db and invert_mask (e.g.,
0,-6,0and0,1,0). - Select align_by and pad_mode (trim/pad with silence).
- Enable normalize to target peak (e.g., 0.99). Press OK.
Inputs & Alignment
| Option | Values | Description |
|---|---|---|
| align_by | start | end | offset | Align start times, right-align by end, or apply offsets per input (s). |
| offsets_s | CSV seconds | Used when align_by=offset. Positive delays a signal. |
| pad_mode | pad | trim | Pad shorter sounds with silence to match longest, or trim all to shortest. |
| resample_if_needed | yes/no | If sample rates differ, resample to the first (or highest) rate. |
Mix Modes
➕ Sum
Direct arithmetic addition of all inputs (after gains). Best when gains are pre-managed.
⚖️ Average
Sum divided by number of inputs; preserves overall loudness across varying counts.
🧮 Weighted
Apply per-input weights (normalized internally) for precise balances.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| mix_mode | option | Average | Sum | Average | Weighted |
| weights | CSV (linear) | "" | Per-input weights; auto-normalized when set |
| gains_db | CSV (dB) | "" | Per-input pre-sum gain; blank ⇒ 0 dB |
| invert_mask | CSV (0/1) | "" | Invert polarity per input (1 = invert) |
| remove_dc | boolean | yes | High-pass or mean-subtract each input before mixing |
| align_by | option | start | start | end | offset |
| offsets_s | CSV (s) | "" | Only used for offset alignment |
| pad_mode | option | pad | pad | trim |
| resample_if_needed | boolean | yes | Match sample rates automatically |
| normalize | boolean | yes | Peak-normalize output to norm_target |
| norm_target | real | 0.99 | Peak target |
| auto_headroom_db | real (dB) | 0 | Apply global negative gain pre-sum (e.g., -6 dB) |
| limit_hard | boolean | no | Simple hard limiter after normalization |
| report | boolean | no | Print effective gains, offsets, and headroom |
Presets
🎙️ Dual-mic blend
weights=0.6,0.4; gains_db=0,-3; align_by=offset; offsets_s=0,0.001
🎹 Layered pads
mix_mode=Average; gains_db=-6,-6,-6; pad_mode=pad; normalize=yes
🥁 Parallel buss
mix_mode=Weighted; weights=0.7,0.3; gains_db=0,0; invert_mask=0,0; limit_hard=yes
Tips & Pitfalls
- Clipping: Many coherent signals will sum > 0 dBFS; use auto headroom and/or normalization.
- Phase: If summing near-coincident mics, small delays can cause comb filtering. Adjust offsets_s.
- DC & noise: Remove DC per input; normalize after summing, not before.
- Channel consistency: For multi-channel objects, ensure the same channel count across inputs or use positional mapping.
Math
Sum / Average / Weighted
Sum: y(t) = Σ s_i g_i x_i(t)
Average: y(t) = (1/M) Σ s_i g_i x_i(t)
Weighted: y(t) = (1/Σ w_i) Σ w_i s_i g_i x_i(t)