Code :

var music:Sound=new Sound(new URLRequest("testson.mp3"));
music.play();
var ba:ByteArray = new ByteArray();
addEventListener(Event.ENTER_FRAME, handlerEnterFrame);
var ciblage:uint;
var spectrum:Number;
var ciblage2:uint;
var spectrum2:Number;
function handlerEnterFrame(e:Event):void {
SoundMixer.computeSpectrum(ba,true, 3);
for (var i:uint = 0; i < 256; i++) {
spectrum=ba.readFloat()*100;
ciblage=Math.round(spectrum);
if (ciblage!=0) {
carretest.gotoAndStop(ciblage);
}
}
for (var j:uint = 256; j < 512; i++) {
spectrum2=ba.readFloat()*100;
ciblage2=Math.round(spectrum2);
if (ciblage2!=0) {
carretest2.gotoAndStop(ciblage2);
}
}
}

Fichier source