ActionScript 3.0 :: SoundChannels, Soundtransform And Volume Question(s)

Feb 2, 2012

Trying to reduce frame overhead in my game, im trying to figure out how to speed it up.These are some 'simple' questions if you know your way around sounds and channels so i'm hoping you'll read on and perhaps give me some insights.
 
I'm noticing that playing soundclips sometimes make it stutter so im looking for the best way to use sounds and channels.The main question is below: how costly is a soundtranform.volume and is it persistent on a channel?secondairy; does it matter howmany soundclips i drop into the same channel?What i noticed: The channel.soundtransform.volume only works after playing the sound. Q: How costly is a channel.soundtransform.volume?&; Will it stay this volume on the next sound that plays? or do i have to reset it each time?
 
Also: playing a lot of sounds in 1 channel isnt a good idea.So i created a channel for each gameobject that could produce sound.On each sound play i calculate distance from main player and set volume accordingly.

1: I could just pre create like 10 channels set the volume from 0.1 to 1.0 accordingly then play each sound in the specific range channel This way i wouldnt have to do soundtransforms on the fly.If however every sound producing object would be at the same distance it would clutter 1 channel with a lot of clips to play at the same time.
 
2: I could pre create 10 channels as a queue. On every play i would pick the next free channel, looping & wrapping through them as i go.
Here however i will have to set the soundtransform volume again on each play according to distance.

View 5 Replies


Similar Posts:


ActionScript 3.0 :: SoundTransform Volume Performance Bug?

Jun 22, 2009

I have this code, and it works perfectly fine for the most part:

soundTrans.volume = 0.1

What this does, it plays the Sound at about 10% of its total volume.But about 1 out of 10 times, there seems to be a bug, that causes it to play 100% of its volume for like a split second then it goes down to the 10%.Like if the soundTransform is applied after the sound has already started playing, and the Player just sometimes cant synchronize it perfectly? I tried to play around with trying to set the soundTrans BEFORE starting the channel, like:

soundChannel.SoundTransform = soundTrans;

but to no effect, it seems the player Applies the soundTransform always just when the Sound starts playing.(or actually just a bit after)This is especially annoying if you are trying to Fade in a music slowly maybe over the course of 5 seconds, and then it starts with a big BANG, and then it goes down, then it fades in, ruining the whole effect.

View 1 Replies

Flash :: Videochat Netstream SoundTransform Not Working For Volume Control?

Jan 3, 2012

I have a video chat application where there can be 6 participants. What I would like to do is give the option to each publisher to control their own stream's volume. The code I have looks like this.

[global]
private var volumeTransform:SoundTransform;
[In the init method where ]
outgoingStream = new NetStream( nc );

[Code]....

A possible solution can be this : Calibrate the slider and set the microphone gain, a gain of zero effectively is mute and a gain of 100 is full volume.

View 1 Replies

ActionScript 3.0 :: Flash - Do SoundChannels Cleanup After Themselves

Sep 13, 2010

If I call the play() function of a Sound, which returns a SoundChannel object, will the SoundChannel still linger around after the sound clip is finished playing and eat up resources? Or will Flash's garbage collection scoop it up?

View 2 Replies

ActionScript 3.0 :: Sync Multiple SoundChannels And Animation?

Oct 26, 2009

I'm trying to synchronize 5 mp3 (128kbs 44hz stereo), each one in a different SoundChannel, and some animation. I've red a lot about the variable delay of the soundChannel, and how the "position" property return where the soundchannel should be, and not where it actually is. But I didn't find any real solution to these issues.

For the moment what i'm doing :

- load the 5 mp3 in their soundChannel

- start the soundChannels

- put a timer to check the first soundChannel position to change the animation

I've tryed to solve the delay between the soundchannels by resynchronizing them after a few seconds to the first soundchannel position, but it's only getting worse.

I'm using Flash CS4 / AS3 but I can easily go back to AS2 if needed. And I can embed the mp3 in the swf or using any other audio format.

View 5 Replies

ActionScript 3.0 :: SoundTransform Of A Steaming .FLV?

Mar 31, 2010

So I followed a tutorial and got my video player working perfectly, then hit a wall when trying to replace the volume slider with volume up and down buttons.

attached is the current working video player, I didn't bother uploading the .XML and the .FLV files, but I will if you're interested.

Here is the code which handles the SoundTransform object, but I can't figure what to apply to my EventListener on the Volume Up and Down buttons.

[Code].....

View 6 Replies

ActionScript 3.0 :: Attaching SoundTransform To A Movieclip

Feb 3, 2012

I am trying to create a button to switch the sound in an embedded movieclip (mc_1) on and off. I believe should be able to use something like

[Code]...

View 6 Replies

ActionScript 3.0 :: Pause Stream SoundTransform / Channel

Nov 6, 2009

I am really close I can feel it. I am doing something stupid I know. I have a file where one button simply controls stop and play of a looping audio stream. (by overlapping the buttons and making them visible or invisible depending on buttonClick) I have it where it does work for stop/start but I really need to to Play/Resume.

[Code]....

View 2 Replies

ActionScript 3.0 :: Simple Volume Slider That Controls The Master Volume Of The Entire Swf?

Oct 6, 2009

does anyone have an example of a simple volume slider that controls the master volume of the entire swf?

View 1 Replies

ActionScript 3.0 :: SoundTransform Object Giving A Null Reference?

Jul 15, 2009

Somehow my class is giving me the following error, after I added a SoundTransform object.What am I missing  The issue is somewhere with the

private var soundTrans:SoundTransform;
soundTrans = new SoundTransform();
Why would that be happening?

[code].....

View 5 Replies

Flash :: Volume Slider - Volume Doesn't Change Until Mouse Over?

Nov 21, 2009

I've created a small music player with a sliding volume control. I'm having trouble with the volume. Though it does control volume properly, if I set the initial volume to less than 100%, the volume always starts at 100% until I move my mouse over the player. At that point, the volume changes to whatever the initial volume is set to.Is this a flash bug, or am I missing something? Here is the affected code (code for other buttons/functions omitted for brevity):

var song_initvolume:Number = 100;
slider_1._x = groove_1._x + song_initvolume;
playSong(0,song_play);[code]....

I'd like to be able to set the volume at say 50%, but the above mentioned behavior happens each time.

View 2 Replies

Flash :: Reverse Sound Volume Math For Volume Slider?

Feb 1, 2010

I'm building a video player and am kinda stuck at the volume slider part. It's a YouTube style vertical slider, meaning if the slider is in the top position volume should be 100% and if the slider is dragged to the bottom position sound should be 0. Currently it's doing the opposite of what I want :(

Dragging the slider down will make the sound louder, while dragging up lowers it.

Here is my code below dealing with the volume slider.

[Code]....

The (-4) is an offset value so when you drag it all the way to turn it off, it's 0 and not 4. I need to reverse this somehow, so the traces above will swap... going down will make userVolume = 4 and going up will make it 30.

View 4 Replies

ActionScript 3.0 :: 046: Type Was Not Found Or Was Not A Compile - Time Constant: SoundTransform

Feb 18, 2010

I am having trouble with my flash program. im trying to make a media player but the tutorial that i am using told me to enter SoundTransfor into the action scripts but when i run the program all i get is an error... 1046: Type was not found or was not a compile-time constant: SoundTransform.

View 1 Replies

ActionScript 3.0 :: Flash SoundTransform: Stereo Play Sound From Left To Right Not Working

Sep 6, 2011

i'm trying to play a sound from left to right using actionscript3. i have putted in the first keyframe the code. what i have wrote is:

Code:
var soundClip:Sound;
var channel:SoundChannel = new SoundChannel();
var trans:SoundTransform = new SoundTransform();

[Code]...

View 1 Replies

ActionScript 3.0 :: SoundChannels Will Not Stop Sounds When Stop() Is Called

Sep 10, 2011

On a recent project I am working on, I created an event-based sound engine. Different components within Flex will be registered, and then the controller will listen to events and handle the information correctly. So, it just takes a custom SoundEvent or ChannelEvent to alter one of the channels, or play a sound.
 
I can not quite figure out what is wrong with my code, and I am finding myself snow-blind to the issue at hand. At first, I was going to rewrite it but I figured it would be better to learn from my mistake. Also, I realize that this is not correct for streaming sounds, but I am working off a local sound library until I get it up and running smoothly.
 
Here is the code for the SoundEvent:

package code.events
{
import flash.events.Event;
public class SoundEvent extends Event

[code]....

View 3 Replies

Actionscript 3 :: Volume Controls - Volume On Or Off Through The Games?

Apr 12, 2012

I've got a serious of games which in turn load off a main main swf.I have mute and unmute buttons on the main menu and the same buttons in each game.When I unload/load a game I want the volume to stay as it is so they player doesn't have to keep turning the volume off. AudioOff is the button shown when the volume is off and AudioOn is the button shown when the volume is on.The code I've got now keeps the volume on or off through the games but the buttons aren't showing up correct with this code..

if (SoundVolume.volume == 1)
{
AudioOn.visible = false;[code].....

View 2 Replies

ActionScript 2.0 :: Volume Slides But No Volume Change?

Sep 10, 2011

I converted the slider bar and slider button to buttons. Then, I made the slider button into a movie clip.

Here is the code I placed while slider button was a button:

Code:
on (press) {
startDrag(this, false, left, top, right, bottom);
}

[Code]....

It seems right to me but I don't know. The movie button slides down the slider bar but it just doesn't affect the volume. Going to try to attach my FLA to offer better insight. Just tried to upload it and no matter if it's FLA or zipped FLA, it says it failed.

View 1 Replies

Actionscript 3 :: SoundTransform Is Muting The Sound But Sound Still Plays

Apr 6, 2010

I am using the following code, in the last line when I play the sound I can still hear it even when I have transformed it to 0.

[Code]...

View 1 Replies

ActionScript 3.0 :: Set The Volume To Something Like 5/10?

Jul 31, 2009

i have a Audio button that I have set up and it is all working finebut I would like to set the volume to something like 5/10.and I thought I had is set up right but it does not seem to work.can anyone see what I am doing wrong(note - I get no errors but also no sound control)I should also mention that I don't need the user to control it other than just
on and off.

Code:
var loadSnd:URLRequest = new URLRequest("ax Mr .l..mp3");
var thisSnd:Sound = new Sound();

[code]......

View 0 Replies

ActionScript 3.0 :: Possible To Cap Volume?

Oct 24, 2009

I have a tower defense game that I am working on and I'm in the process of adding sounds. Each tower plays its own fire sound when it fires. However When I have 5+ towers of the same type firing at the same time the volume gets louder.

Here is my game as is, the sounds are only in testing stage right now and I am aware that they can get annoying with the current set up.[URL]..

Most noticeably are the air towers. if you feel like listening play my game and first place 1 Air (blue) tower on screen. When the first air wave starts (lvl 4) hear the one tower firing alone and then during this stage add a 2nd tower and the volume almost, if not, doubles.

View 2 Replies

ActionScript 2.0 :: Getting More Than One Volume Control?

Jan 13, 2009

using action script2 flash cs3, and i need more than one volume slider/control and each control needs to be assigned to one sound, atm i have more than one volume slider but they all control the same sound!

View 1 Replies

ActionScript 2.0 :: CS3 Set Volume Slider To 50%?

May 11, 2009

I'm a designer that inherited a project with a volume slider. I'm not that good with actionscript yet and haven't been able to figure out the code. The volume and slider starts at 100%, and I need it to start at 50%. Can you tell me how to set both the volume and slider at 50%? I'm sure it is a simple solution but I can't figure it out. I tried a few things but have not been able to get it to work correctly in both the volume level and start position for the sliderHere's the code on the 2nd frame of the mc:

Code:
stop();
var NiVol:Sound = new Sound(_root.Container);

[code].....

View 4 Replies

ActionScript 3.0 :: Pan/Volume Based On X,Y?

Sep 16, 2009

Trying to get the children of lighterBoard to pan to different channels based on their Y coordinate.(children on the left side of the screen play left channel, children in the middle play both, right side, right channel etc.)

volume works on X for the lighterBoard.

Having trouble with Pan and getting it to look at the children.

}
function playVol01() {
trace("Swoosh Sounded");
Vol01Channel=Vol01Sound.play();

[Code].....

View 1 Replies

Use EBS Volume From Stock FMS Image On EC2?

Jul 21, 2011

I'd like some changes to the config to be persisient though.

I've created an AMI (built using the stock CenOS 5.5 and FMS 4.02 AMI's Kernel ID and RAM disk ID) but when I launch it says the "AMI and kernel are incompatible" or similar.

View 6 Replies

ActionScript 2.0 :: Why Isn't Volume Changing

Oct 11, 2008

Why isn't my volume changing? the volume amount is correct, but the volume doesn't change to that amount.[code]

View 4 Replies

ActionScript 2.0 :: Two Buttons To Set Volume

Jan 14, 2009

My site is nearly ready, but I still want to add two buttons: one to set the volume to a normal value; another one to set the volume to 0 (like a mute button). I don't have a background music, I just want these two buttons to make effect on several other buttons with "click" sounds attached.

I have my buttons ready, and tried using this code for the "no sound" button:

ActionScript Code:
on (release) {
set.volume(0);
}

[Code].....

View 3 Replies

ActionScript 3.0 :: ComputeSpectrum If Volume Is 0?

Jul 31, 2009

I'm building a media player with a sound visualizer using computeSpectrum(). When I adjust the volume, there is no longer any data for the visualizer. Does anyone know a way to adjust the volume of audio, but still access audio data using computeSpectrum() as if the sound were still audible?

View 3 Replies

ActionScript 2.0 :: Keep All Sounds At The Same Volume?

Aug 30, 2011

On a movieclip I have a sound that plays whenever the movieclip is dragged over the right object. It works but the problem is that it lowers the volume of the background music (which I don't want). I think that if it were possible to change the type of sound using ActionScript to an Event sound it would work.Here is the code:

ActionScript Code:
unlocking = new Sound(this);
unlocking.attachSound("unlock");
unlocking.start();

View 5 Replies

ActionScript 2.0 :: FMX: Boosting Volume Above 100

Feb 20, 2003

I know how to make a slider that controls the volume from 100 to 0. But is there a way to boost the volume in Flash?

I want the movie to open with the volume slider at 50% (visually) but the volume level (audibly) to be 100%. Then lowering the slider to 0% will cut the audible volume to 0 but raising the slider to 100% will boost the volume audible to 200%.

View 6 Replies

ActionScript 2.0 :: Why Can't I Do Volume Sliders

Dec 15, 2004

I've been trying to create a volume slider for about two hours now and it just doesn't work. I followed Ilyas' slider tute and Kirupa's volume control tute both to the letter and now no sound loads, the slider doesn't control anything and it sticks to the mouse when you let go i.e. it still drags left and right across the slider after you release the mouse button.I can't show you my code unfortunately as I just got really angry and wiped it.Could someone please either show me exactly how to load a sound and control it's volume in one tute (Kirupa uses a different method from the "load sounds using AS" tute to load his sound in the volume tute but he doesn't explain it. I don't want his source .fla+mp3.) or make me a .fla that loads a sound called "music" (linkage name) and controls it's volume.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved