Skip to main content

Module mix

Module mix 

Source
Expand description

Adding audio streams together.

Two things decide whether a conference sounds like a conference.

Saturation, not wrapping. Two people talking loudly at once produce sums outside the range of an i16. Wrapping turns the loudest moment of a call — the moment two people interrupt each other — into a full-scale discontinuity, which is heard as a bang. Clipping the sum instead sounds like a loud moment, which is what it is.

N-1, not N. Each participant hears everyone except themselves. Including their own audio sends their voice back to them delayed by the round trip, and delayed sidetone is close to unbearable: it is the effect used deliberately to stop people speaking. Anyone building a mixer discovers this within a minute of trying it, and the reason it is worth writing down is that N-1 costs a mix per participant rather than one for everybody, and it is tempting to do the cheap thing.

Functions§

mix_excluding
Mix everything in sources except the one at exclude.
mix_into
Add source into into, clipping rather than wrapping.
saturating_add
Add two samples, clipping at the ends of the range.