superpose
Superposes two sounds, so that they are played simultaneously.
Syntax
-
superpose(s1, s2[, t[, α1[, α2]]])
-
s1
ands2
are sounds -
t
is a non-negative number -
α1
andα2
are real numbers
-
Description
superpose(s1, s2, t, α1, α2)
returns a sound with s1
and s2
superposed. Specifically, it returns a copy of s1
with s2
starting at time t
in s1
. The result runs until both s1
and s2
have ended.
In the result, s1
and s2
are scaled by factors α1
and α2
, respectively, so that a resulting sample is of the form
α1⋅s1(τ) + α2⋅s2(τ − t).
Samples that do not exist in s1
and s2
are treated as 0
.
If omitted, t
defaults to 0
, α1
to .5
, and α2
to .5
.
s1
and s2
must have the same bit depth and sample frequency.
Examples
l ≔ SineTone(100, 0.5, 1); h ≔ SineTone(400, 0.5, 1); superpose(l, h)