Sum mono audio sources into one stereo soundtrack, sample-accurately and
deterministically.
Each cue reads its source from offsetSeconds at rate source samples per
output sample (two-tap linear interpolation), starting at output sample
round(seconds * sampleRate) and lasting round(durationSeconds * sampleRate) samples (the rest of the source by default). It is shaped by
symmetric linear edge fades of fadeSeconds (at most half the cue) and
placed by equal-power pan, left cos((pan + 1) pi / 4) and right
sin((pan + 1) pi / 4), times its gain and the master gain. Samples past
the soundtrack's end are dropped. The sum is clipping-safe by refusal: a
nonfinite sample or a peak above 1 throws instead of limiting, so a mix
never ships silently distorted. Cost is linear in audible cue samples and
the output length.
Sum mono audio sources into one stereo soundtrack, sample-accurately and deterministically.
Each cue reads its source from
offsetSecondsatratesource samples per output sample (two-tap linear interpolation), starting at output sampleround(seconds * sampleRate)and lastinground(durationSeconds * sampleRate)samples (the rest of the source by default). It is shaped by symmetric linear edge fades offadeSeconds(at most half the cue) and placed by equal-power pan, leftcos((pan + 1) pi / 4)and rightsin((pan + 1) pi / 4), times its gain and the master gain. Samples past the soundtrack's end are dropped. The sum is clipping-safe by refusal: a nonfinite sample or a peak above 1 throws instead of limiting, so a mix never ships silently distorted. Cost is linear in audible cue samples and the output length.