void normalNoise (Point& point, Float64 sigma) { point.x = gaussianRand (point.x, sigma); point.y = gaussianRand (point.y, sigma); point.z = gaussianRand (point.z, sigma); }
void ActiveSoundSource::realisticSetSound(unsigned channel, double signal) { double variance = 1; //double gaussian; if (channel < noOfChannels) { /* pitch[channel] = signal; for (int i=1; i<=2; i++) { gaussian = exp(-(i*i)/(2*variance*variance)); if (channel != 0 && (channel != 1 || i != 2)) pitch[channel-i] = gaussian*signal; if (channel+i < noOfChannels) pitch[channel+i] = gaussian*signal; } */ int c = (int)channel + round(gaussianRand(0, variance)); if (c < 0) c = 0; if (c >= noOfChannels) c = noOfChannels-1; channel = c; pitch[channel] = signal; } }