# SoundMixer.computeSpectrum with movieclips confusion

**URL:** <https://forum.kirupa.com/t/soundmixer-computespectrum-with-movieclips-confusion/252543>\
**Category:** Uncategorized\
**Created:** [February 21, 2008, 3:30am UTC](https://forum.kirupa.com/t/soundmixer-computespectrum-with-movieclips-confusion/252543 "2008-02-21T03:30:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tivaelydoc](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@tivaelydoc](https://forum.kirupa.com/u/tivaelydoc)\
**Post date:** [February 21, 2008, 3:30am UTC](https://forum.kirupa.com/t/soundmixer-computespectrum-with-movieclips-confusion/252543/1 "2008-02-21T03:30:55Z")

</div>

I have an 8 frame MC named symbol and I’m trying to get it to visualize when a song is playing. So I got this code and I’m new to AS3, but I get the basic gist of what’s happening. But how I do I get it to play my movie clip? Do I have to drag in onto the stage or what?

```php
var requested:URLRequest = new URLRequest("http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3");
var s:Sound = new Sound();
s.addEventListener(Event.COMPLETE, completeHandler);
s.load(requested);
var song:SoundChannel=new SoundChannel();
s.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
var ba:ByteArray = new ByteArray();

var gr:Sprite = new Sprite();
gr.x = 20;
gr.y = 200;
addChild(gr);

var time:Timer = new Timer(50);
time.addEventListener(TimerEvent.TIMER, timerHandler);
time.start();

function completeHandler(event:Event):void {
    song=event.target.play();
}

function soundCompleteHandler(event:Event):void {
    time.stop();
}

var numOfFrames:int=52;
function timerHandler(event:TimerEvent):void {
    SoundMixer.computeSpectrum(ba, false);
    var i:int;

    var w:uint = 15;

var p:int=0

    for (i=0; i<512; i+=w) {
        var t:Number = ba.readFloat();
p+=t
    }
    symbol.gotoAndStop(Math.abs(Math.ceil((p)*8)/256))
}

```

This is my fla:

[http://tivaelydoc.110mb.com/explosion.fla](http://tivaelydoc.110mb.com/explosion.fla)
