ByteArray

Hi have an oscilloscope type of thing for my mp3player… and it all works good apart from when the first cycle of the readFloat always originates from 0,0 and in the first piece of data it draws a little vertical line from 0,0 to first piece of data of 256.

How would I solve this ?


var spectrum:ByteArray = new ByteArray();
SoundMixer.computeSpectrum(spectrum);
sp.graphics.clear();
sp.graphics.moveTo(spX,spY+20);
for (var i:int = 0; i < 256; i++)
{
 spc = -20 + spectrum.readFloat() * 40;
 sp.graphics.lineStyle(1, 0x000000);
 sp.graphics.lineTo(i + spX, Math.abs(spc) + spY);
 addChild(sp);
}

Thanks in advance
Steven :eek: