If you’re referring to the ‘Mix (Add)’ mode, then Renoise doesn’t do anything special. It simply adds both signals together: c = a + b
It will definitely clip if signals a and b are loud enough.
If you’re referring to the ‘Modulate (Multiply)’ mode, then it’s nothing special here, either. It’s simply: c = a * b
If you want to add two signals together and ensure that they never clip, then you’ll need to analyse things first to find the peak amplitude, then calculate the correct scaling factor based on this.
For example:
-- find peak level
local peak_level = 0.0
for n = 1, sample_size, 1
local level = math.abs(sample_a[n] + sample_b[n])
if level > peak_level then
peak_level = level
end
end
-- check for clipping
if peak_level > 1.0 then
-- mix and scale to avoid clipping
local scaling = 1.0 / peak_level
for n = 1, sample_size, 1
sample_c[n] = (sample_a[n] + sample_b[n]) * scaling
end
else
-- mix without scaling
for n = 1, sample_size, 1
sample_c[n] = sample_a[n] + sample_b[n]
end
end