public double[] applyNoiseToVoice(double[] voice, double[] noise, int db)
{
double[] tab = new double[voice.Length];
normalize(noise);
double reductionFactor = Math.Pow(10.0, -db / 20.0);
int index_in_noise = 0;
for (int i = 0; i < voice.Length; ++i)
{
tab[i] = (voice[i] + (noise[index_in_noise] * reductionFactor)) / 2.0;
index_in_noise++;
if (index_in_noise > noise.Length - 1)
index_in_noise = 0;
}
return normalize(tab);
}