DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: SISKO on December 16, 2012, 05:03:33 PM

Title: Mixing digital sources/signals
Post by: SISKO on December 16, 2012, 05:03:33 PM
Hello, Im starting to write VST plug-ins. The representation range is limited to +-1 float.
I read somewhere (dont remember where) that when summing two input signals, both should be scaled to prevent overflow, that is: y = 1/2*x1 + 1/2*x2

While this makes (preety much) sense to me, I wanted to know if Im understading it well. Is this the way most dsp codes are written? Because of all the examples I have seen, all of them are writen in the form y= x1 + x2
Title: Re: Mixing digital sources/signals
Post by: CynicalMan on December 16, 2012, 11:21:42 PM
The inputs and outputs should be limited to ±1, but internal floats can be any value. So it's perfectly fine to sum together signals with ±1 amplitude as long as you keep the output below ±1.

The y = 1/2*x1 + 1/2*x2 equation is useful for converting stereo to mono, though. It ensures that if the amplitude of a mono input will be the same whether you convert it to mono in your plugin or not.
Title: Re: Mixing digital sources/signals
Post by: SISKO on December 18, 2012, 04:03:15 PM
Excellent! Thank you very!