Problems with Sound clicking

[SIZE=5][COLOR=Black]I am having issues with the following code. The audio keeps clicking with each change in the frequency. Can anyone give me a way to stop the clicking?[/COLOR][/SIZE]


//variables for sound section follows

import flash.events.TimerEvent;
import flash.utils.Timer;

var AMP_MULTIPLIER:Number = .25; //amplitude
var leftfreq:Number = 110; //main frequency

var SAMPLING_RATE:int = 44100;
var TWO_PI:Number = 2*Math.PI;
var TWO_PI_OVER_SR:Number = TWO_PI/SAMPLING_RATE;
var leftsound:Sound = new Sound();
var rightsound:Sound = new Sound();
var isitleft:Boolean = true;

var trans1:SoundTransform = new SoundTransform(.6,-1);
var trans2:SoundTransform = new SoundTransform(.6,1);

//variables for light flash follow

var StartingHTZ:Number = 14; //starting frequency in HTZ
var rightfreq:Number = leftfreq - StartingHTZ;
var EndingHTZ:Number = 5.5; //ending frequency in HTZ
var TotalTime:Number = 300 //total time in seconds of sequence displaying flash
var subflashrate:Number = 50; //number of flashes between eyes
var increment:Number = (((1000/EndingHTZ/2) - (1000/StartingHTZ/2))/TotalTime);
var milliseconds:Number = (1000/StartingHTZ/2);
var curcnt:Number = 300;
var counter:int = 0;
var counter2:int = 0;
var seconds:Number = 0;

var soundchange:Number = (((leftfreq - rightfreq) - EndingHTZ)/TotalTime); //left freq always needs to be higher than right freq for this to work

var duration:Timer = new Timer(1000,TotalTime);
var flash1:Timer = new Timer(milliseconds,1);
var maintimer:Timer = new Timer(1000);

//flashing light section

function adjustflashrate(event:TimerEvent):void
{
if (isitleft == true)
{
leftfreq = leftfreq - soundchange;
isitleft = false;
}
else
{
rightfreq = rightfreq + soundchange;
isitleft = true;
trace((leftfreq - rightfreq) + " is the HTZ, " + soundchange + " is the change");
}
milliseconds = milliseconds + increment;
flash1.delay = milliseconds;
}

function flasher(event:TimerEvent):void
{
counter2 = counter2 + 1;
if (counter == 0)
{
this.light.alpha = 100;
counter = counter + 1;
}
else
{
this.light.alpha = 0;
counter = 0;
}
flash1.start();
}

//sound section

function sineWave1(event:SampleDataEvent):void {
var sample:Number
for (var i:int=0; i<8192; i++) {
sample = Math.sin((i+event.position) * TWO_PI_OVER_SR * leftfreq);
event.data.writeFloat(sample * AMP_MULTIPLIER);
event.data.writeFloat(sample * AMP_MULTIPLIER);
}
}

function sineWave2(event:SampleDataEvent):void {
var sample:Number
for (var i:int=0; i<8192; i++) {
sample = Math.sin((i+event.position) * TWO_PI_OVER_SR * rightfreq);
event.data.writeFloat(sample * AMP_MULTIPLIER);
event.data.writeFloat(sample * AMP_MULTIPLIER);
}
}

leftsound.addEventListener(SampleDataEvent.SAMPLE_DATA, sineWave1);
rightsound.addEventListener(SampleDataEvent.SAMPLE_DATA, sineWave2);
flash1.addEventListener(TimerEvent.TIMER_COMPLETE, flasher);
duration.addEventListener(TimerEvent.TIMER,adjustflashrate);

flash1.start();
leftsound.play(0, 1, trans1);
rightsound.play(0,1,trans2);