A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: seperating sound channels

  1. #1
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707

    seperating sound channels

    hi -
    i have an animation on the stage that works with a SoundMixer.computeSpectrum method. It's fine, but i also have a volume controler on my movie that is effecting the animation. It makes sense but i would like to know how i can pull the volume down to zero, lower all the sound, and still get the animation to continue going, despite not hearing things. Is there a way to seperate the same sound channel to do two different things?

  2. #2
    Ө_ө sleepy mod
    Join Date
    Mar 2003
    Location
    Oregon, USA
    Posts
    2,441
    Take a look at the soundMixer class, it will let you control the global audio stream after all the sounds have been composited together.

    EDIT: just re-read that...are you saying that lowering the volume is affecting animation?

  3. #3
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707
    exactly what i am saying. The problem is that the way i am controlling the sound animation and the volume control are both be using the same SoundMixer- The solution i would like to find is allowing the user to lower or mute the volume to 0, but still pass the sound waves to "a" SoundMixer instance to keep the animation going event though you would not hear the music.

    Essentially a seemless transition in sound only if the user clicks mute, and un-mute. The animation would not be effected in either way.

    FWIW (and i always get slapped for not placing entire code classes)-

    Code:
    SOUND VOLUME CODE :
    //MATH FOR THE VOLUME 
    		//----------------------------------------------------->>
    		private function sliderbaseClicked(e:MouseEvent):void
    		{
    			var vw=(this.mouseX+30)*.01;
    			bar.scaleX=vw
    			setVolume(vw)
    		}
    		private function setVolume(num:Number):void
    		{
    			var tr:SoundTransform= SoundMixer.soundTransform;
    			tr.volume=num
    			SoundMixer.soundTransform=tr;
    					
    		}
    Code:
    ANIMATION CODE
    private function dosoundspectrum(e:TimerEvent):void
    	{
    		SoundMixer.computeSpectrum(ba,true)
    		for(var i=bars.length-1;i>=0;i--)
    		{
    			var bm=bars[i];
    			var f=Math.abs(Math.round((ba.readFloat()*_frequency)));
    			setBarY(bm,f);
    			
    		}
    		e.updateAfterEvent();
    	}
    	private function setBarY(bm,f:Number):void
    	{
    			var tgY=-f*8				//calculate target y
    			var curY=bm.y;					//track current y
    			var dy=(tgY-curY)*.5			//find difference and add ease (.2)
    			//bm.y+=dy						//concatonate the calculated to the current position
    			bm.y=tgY
    	}

  4. #4
    Member
    Join Date
    Jun 2000
    Posts
    54
    Hi Mlecho,
    did you ever figure out a solution to this? I've just posted a similar thread, and then noticed yours here
    Ta

  5. #5
    will i ever get it?
    Join Date
    Feb 2004
    Posts
    707
    Actually, no. The client decided they preceded the visual to mute with the music. There mustbe a way to seperate the byte array from the soundmixer class. Let me know if find it!!! Still unresolved

  6. #6
    Member
    Join Date
    Jun 2000
    Posts
    54
    Thanks for the update mlecho.

    Any takers out there on this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center