# How do I change the volume of an mp3

**URL:** <https://forum.kirupa.com/t/how-do-i-change-the-volume-of-an-mp3/238819>\
**Category:** flash\
**Created:** [September 15, 2007, 6:40pm UTC](https://forum.kirupa.com/t/how-do-i-change-the-volume-of-an-mp3/238819 "2007-09-15T18:40:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [September 15, 2007, 6:40pm UTC](https://forum.kirupa.com/t/how-do-i-change-the-volume-of-an-mp3/238819/1 "2007-09-15T18:40:25Z")

</div>

I know it has something to do with soundTransform, but I’ve been trying to get it working for a few hours now and no luck. Here is my code to start the song. If you cant tell by byte array I am making a spectrum analyzer.

EDIT: I actually have another question. I have two of the same movie clips, playing 2 different songs and what I thought would happen is they would each have their own spectrum, but turns out they sharing the same sound channel. I tried changing each names of the sound channel but didnt work. Here is my code for clip 1:

```auto

//BALL1
var s:Sound = new Sound();
var sc:SoundChannel;
var ba:ByteArray = new ByteArray();
var array:Array;

s.load(new URLRequest("mix2.mp3"));
sc = s.play(0,1000);

this.addEventListener(Event.ENTER_FRAME, spectrum);

var a:Number = 0;

function spectrum(event:Event) {
    a = 0;
    graphics.clear();
    SoundMixer.computeSpectrum(ba,true,0);
    for (var i=0; i < 256; i=i+8) {
        a = ba.readFloat();
        var num:Number = a*360;
        graphics.lineStyle(num/15,0xccff33|(num << 8),5);
        graphics.drawCircle(0,0,i);
        }
}

```

and clip2:

```auto

//ball2
var s2:Sound = new Sound();
var sc2:SoundChannel;
var ba2:ByteArray = new ByteArray();
var array:Array;

s2.load(new URLRequest("mix.mp3"));
sc2 = s2.play(0,1000);

this.addEventListener(Event.ENTER_FRAME, spectrum);

var a:Number = 0;

function spectrum(event:Event) {
    a = 0;
    graphics.clear();
    SoundMixer.computeSpectrum(ba2,true,0);
    for (var i=0; i < 256; i=i+8) {
        a = ba2.readFloat();
        var num:Number = a*360;
        graphics.lineStyle(num/15,0x00ccff|(num << 8),5);
        graphics.drawCircle(0,0,i);
        }
}

```

you can see what im talking about at  
[http://ostari.com/ronnie/spectrum/leespec.swf](http://ostari.com/ronnie/spectrum/leespec.swf)

thanks a lot!
