Actionscript 3 :: Working With Multiple Sounds & Channels
Nov 17, 2011
Are there any audio management libraries for ActionScript 3? The more tailored they are for game development the better.I'm finding it hard to understand and work with multiple channels, which is making a lot of my audio sound screwy and cancel each other out, etc. I've been working on an RPG that can at a given time have quite a number of sounds playing such as environmental noise (like opening doors, thunder, rain, etc), walking enemies, inventory sounds (for events like dropping an item into your inventory), passive spell-casting sounds, voice clips, weapon swinging etc. Alternatively, if there are any good resources that explain how to use multiple sound channels strategically.
View 1 Replies
Similar Posts:
Jul 14, 2009
is it possible to have multiple SoundChannels? And have a volume control control multiple volumes?
i have a site that uses .flv's with sound all throughout. Volume control is attached to a sound transform that affects the stream. I also added a piece of code to this function that creates a new soundtransformation object, adds it to a soundfactory object i have in a private var and adjusts that volume by 40% of the .flv's volume. This seems like it should work - but doesn't so i am wondering two things. a) can i have multiple sound channels (in this case the stream and the channel i made for bkg music) b) if i can why do my sound transformations not get implemented on this music track. I also tried to explcitly set the music volume to 0.4 via a sound transform right after i load it - which does not work either.
heres the code
ActionScript Code:
trace("current vol is :" + currentVolume + " And 40% of that is: " + (currentVolume * 0.4));
var st:SoundTransform = new SoundTransform(currentVolume, 0);
stream.soundTransform = st;
[Code].....
View 1 Replies
Mar 10, 2009
Here's the setup:
-I have a music score that will be streamed in via actionscript
-I also have multiple short sounds (SFX) in multiple nested MCs
-these SFX sounds are customized using the ide edit interface, so it would be a pain to use actionscript to play each sound
What I need: To have 1 mute button for the music, and 1 mute button for the SFX, both on the root timeline.[code]...
View 7 Replies
Jan 19, 2003
Iam searching vor solution so adjust different volumes for multiple sounds. That means:
Sound1 Volume 100
Sound2 Volume 20
I have tried that with the following script:
DayNature = new Sound();
DayNature.attachSound("Day_Nature01");
DayNature.setVolume(100);
[Code].....
View 4 Replies
Aug 5, 2010
I am making a slide show, for every image i want sound on it. For example if it the "Tiger" in the image, it says "Tiger". I have all the voice in .wav format.
Right now my slide show is xml based and in as3, i have made another attribute for voice.
Let me know how i can play different sounds for different images.
View 5 Replies
Sep 3, 2010
Working on a project with multiple sounds (all contained in different MCs) played by different key board events. Most of it works, but when I try to use simultaneous 2 button combinations to call upon a different sound, all 3 sounds play at once. The 3 sounds are as follows: the sound associated with the first button, the sound associated with the second button, and the sound associated with the 2 button combo. I've made several different true/false statements to override different events and states, but they don't affect the playing of the MCs. I've also tried using attachSound but I don't like the results I'm getting from that either.
How can I stop the first 2 sounds from being played, so only the 3rd sound can be heard?
View 2 Replies
Nov 11, 2005
im am using this script in my current movie to attach sound using acttion script it also has a stop/start button but i need to now how to add multiple sounds in this way.
[Code]...
View 2 Replies
Jun 11, 2009
In my app, scenes on the stage play based on user interaction, and are accompanied by sound clips that are loaded through a soundLoader class (see below). I can play the correct track from the model, but I can't figure out how to correctly write a loadTracks function that will proload all of the track options for a given scene, and then play the correct one based on what the user clicks without a pause. How would I preload and store those sounds in a way that I can use them when needed?
Code:
package mvc
{
import flash.display.*;
import flash.media.*;
import flash.events.*;
[code]....
View 2 Replies
Oct 12, 2010
i took inspiration from the tutorial for the mp3 player (some code will surely look familiar to some of you) to build up a music player that plays songs from a defined array, and made it fully working. Somehow proud of it, i consider myself intermediate in ASing Now, the problem is that then i load this music player into a main.swf there's no sound."hey you surely forgot to add _lockroot". Ehm, no. Actually i did several tries with it. This is why i'm here
Architecture:
- one Main Movieclip (mainmovie.swf);
- one Music player (musicplayer.swf);
Music player is loaded into Main Movieclip through a loadMovie call; absolute path to target would be _root.mp3cont (in Main Movieclip obviously); the loadMovie call happens on the AS layer in the _root of Main Movieclip; about the Music player:
- there's a movieclip on the main timeline that acts as container. Name is "sound_clips";
- the music player is INSIDE the mc "sound_clips";
- music player works with attachSound;
This is the code on the AS layer:
Code: Select allimport gs.*;
import gs.easing.*;
OverwriteManager.init
[code]....
1. I tried to insert Code: Select allthis._lockroot = true; on the FIRST FRAME of the Music player root, that has, as said before, a movieclip named "sound_clips" that contains actually the music player (AS + slider AS); - Didn't work.
2. I tried to insert Code: Select allmp3cont._lockroot = true; on the FIRST FRAME of the Main Movieclip root, where i have mp3cont as container mc for that swf that is load through a loadMovie("musicplayer.swf", "mp3cont"); call. Didn't work either.
3. I created a new file (a blank .fla) with just the loadMovie call and the mp3cont._lockroot = true; (obviously on separated layers) method to see if it actually worked. Didn't work.
4. I removed the container in the music player and put all the stuff on the _root, so the code for both the attachSound and the volume slider are on _root. Placed a big phat this._lockroot = true; but didn't work. Also didn't work with the following ones (the music player IS STILL working):
- this.s._lockroot = true; (put AFTER after the definition of the sound object obviously, as s is not yet defined)
- this._parent._lockroot = true;
5. Without the above mentioned container i tried placing it in the swf that actually loads it, and even tried MovieClipLoader and loadMovie. This is the last attempt:
Code: Select allthis.createEmptyMovieClip("sound", this.getNextHighestDepth());
sound._lockroot = true;
sound.loadMovie("musicplayer.swf");
View 3 Replies
Apr 27, 2009
m using Flash 8. And I'm trying to adjust two sounds files using action script. First I set a sound file to 100, then I tried to set another file to 25 but when that happens, it also sets the first sound file to 25.
How do I adjust the second sound file so that the first one doesn't get changed as well.
By the way, here's the action script I was using for both sound files:
Sound File 1
background = new Sound();
background.attachSound("Kingdom Hearts Theme");
background.setVolume(100);
[Code].....
View 2 Replies
May 14, 2009
I have 10 sound files in an array.I am wanting to preload all of them and update a counter once each one loads sucessfully.So when song 2 for instance finishes loading then the counter would be at 2,then 3,etc....I think maybe I need to use a while loop to hook each sound into a load event?
View 1 Replies
Sep 6, 2010
Inspired by Andre michelle, I`m building a tone matrix in AS3.I managed to create the matrix and generate the different sounds. They don´t sound that good, but I´m getting there One big problem I have is when more than one dot is set to play, it sounds just horrible. I googled a lot and found the additive synthesis method but don´t have a clue how to apply it to as3.anybody out there knows how to play multiple sounds together? any hint?
View 2 Replies
Apr 10, 2003
I need a little advice. I've got a set of swfs that are all part of one training, and within these movies are a few sound effects attached to button instances. I want the user to be able to click a button to turn the sound on or off at any time during the training.
My first idea was to create a variable called wantSound, which each sound instance checks before deciding to play. This is working perfectly. There's a toggle switch on the main timeline that sets sound to on or off, and when a sound is supposed to play, it checks to see if wantSound=true, and plays, or if it is false, it does not.
This works fine on each individual .swf, but when a new .swf loads in, the sound defaults back to true, and the user has to turn it off again. I imagine this could be fixed by loading each movie into different levels instead of loading them into level0 or root, but as this is not how I originally created the file, that will take a lot of work to handle aligning the loaded movies and parking them (making sure none of the buttons are active on the level below). I'm lazy, what can I say? :-)
I've been looking around at similar questions, and found a decent tutorial on Macromedia's site about using javascript to pass a variable from flash to HTML. I went through that, and managed to get Flash to send my wantSound variable to HTML with no problem. Check here for the tutorial.
The only problem is that in macromedia's example for sending data from HTML back to Flash, they use a text field for getting the variable. I just want to take the variable sent from Flash to HTML and send it back to Flash when requested (at the beginning of the next SWF.)
View 1 Replies
Dec 17, 2005
I have set this:
Code:
mp3_1 = new Sound();
mp3_1.loadSound("1.mp3", true);
mp3_2 = new Sound();
mp3_2.loadSound("2.mp3", true);
[Code]...
View 2 Replies
Jan 22, 2009
I have figured out how to play a sound with AS3, but i cannt figure out how to use multiple sounds. to play a single mp3, i am using this:
Code:
//number that is redefined when the pause button is hit
var pausePoint:Number = 0.00;
//a true or false value that is used to check whether the sound is currently playing
[Code]....
but what I need to do is have 4 different mp3's, each with its own stop & play button, so the user can play any file they want. These are voice over reels, not music, so each needs its own set of buttons.
View 1 Replies
Mar 2, 2010
Okay, so I'm using
Code:
exampleSound = new Sound(this);
exampleSound.attachSound("exampleLinkageName");
[code].......
View 5 Replies
Jan 16, 2012
i seem to be posting a lot at the moment but i am trying to get my Flash Skills up to date, hope im not annoying anyone too much. Basically i have a small project where pressing a button will trigger a sound, So when i click 'Button1' it plays the sound assigned to 'Button1', I have done this like the following.
[Code]...
Eventually i am going to have 20 different sounds, i know i need to probably assign each sound to its own individual sound channel. i tried manipulating the for statement to say something like var [i]Channel = new SoundChannel; in the hope that it would assign a number next to the SoundChannel thus making it unique,
View 5 Replies
Dec 9, 2009
I need to realize a multiple-track player. The user can upload multiple tracks and mix (play them together). My problem is to allow the user to define an exact start position of each track to allow a synchronization between them, something like this:
Track 1: start at [x] sec.
Track 2: start at [y] sec.
play/stop
where the user can set the x and y. I've tried to realize it with AS2 (using netstream and setInterval) and AS3 (using netstream or sound and timer). Only if I set the same x and y both tracks are playing simultaneously.
View 1 Replies
Mar 1, 2011
So im recreating my ear training program with more effective coding so i can add on to it. original i did.
//88 C8
var mp3Req88:URLRequest = new URLRequest("88.mp3");
var mp3_88:Sound = new Sound();
mp3_88.load(mp3Req88);
I basically got 88 sound files (each note of the piano) doing this code 88 times for each sound. with mathamatical equations made my ear training program.
Is there a simpler way to import these sounds in a loop of some sort so i dont have to do this 88x for the piano and however many times for the other instruments i will be including?
thus var i have tried things along the lines of below with failure
var i:int;
for (i = 0; i < 5; i++)
{
var pianoMP3Req+i:URLRequest=new URLRequest("piano/"i+"mp3");
[Code].....
View 1 Replies
Feb 4, 2012
I am trying to create a Flash application(more like a game) where a user can add sounds to a timeline and then play the resulting "song". That is not really hard to do, and the resulting track can be saved and played within my app, but the problem is that I would like to export the created track as a .wav(or .mp3). I know that recording from a microphone with MicRecorder is possible and then the record can be exported with WaveEncoder, but I didn't find a way to create a custom sound stream from multiple sounds and than export it.
View 3 Replies
Mar 23, 2005
I am getting ready to publish my site, but I realized I hadn't yet added sound to my site so I created an external .swf that would load into my main site when the button it corresponded to was clicked. In this .swf which I called basically Sound Selection, the user could select sever sound samples from a menu like option. Now here is what I dont understand:Well I completely understand the "create a sound bar tutorial" in the advanced section under flash mx tutorials. But you can only load in one sound into sound1.swf and I would like the user to select from the list/menu I have created and be able to load those sounds into some sort of sound slot, somewhere, which play and stop would correspond to *like in the tutorial*.
I have tried a few methods but I think there is a conflict between the two externally loaded .swfs. And I have also tried to create a way which will load the subsequent song when the song playing has finished, Almost as if it were a stream. But I am not really worried about this atm. I am moreover curious to find out how to accomplish the primary.
View 1 Replies
Aug 18, 2010
I have two buttons on a single frame that each play seperate sounds when clicked though actionscript is throwing up this error and I have no idea how to fix it.
1151: A conflict exists with definition snd in namespace internal.
1021: Duplicate function definition.
Warning: 3596: Duplicate variable definition.
[Code].....
View 2 Replies
Mar 23, 2005
I am getting ready to publish my site, but I realized I hadn't yet added sound to my site so I created an external .swf that would load into my main site when the button it corresponded to was clicked. In this .swf which I called basically Sound Selection, the user could select sever sound samples from a menu like option. Now here is what I dont understand:
Well I completely understand the "create a sound bar tutorial" in the advanced section under flash mx tutorials. But you can only load in one sound into sound1.swf and I would like the user to select from the list/menu I have created and be able to load those sounds into some sort of sound slot, somewhere, which play and stop would correspond to *like in the tutorial*. I have tried a few methods but I think there is a conflict between the two externally loaded .swfs. And I have also tried to create a way which will load the subsequent song when the song playing has finished, Almost as if it were a stream. But I am not really worried about this atm. I am moreover curious to find out how to accomplish the primary.
View 1 Replies
Dec 9, 2009
I need to realize something like a multiple track player. The users can upload multiple tracks and start to play them together. My problem is to allow the user to define a start position of each track to allow a synchronization between them, something like this:
Track 1: start at [x] sec.
Track 2: start at [y] sec.
play/stop
where the user can input the x and y. I've tried with AS2 (using netstream and SetIntervall) and AS3 (using netstream or sound and timer). If I set the same x and y both tracks are playing simultaneously. But not if the x and y are different.
View 4 Replies
Sep 7, 2010
Inspired by Andre michelle, I`m building a tone matrix in AS3. I managed to create the matrix and generate the different sounds. They don�t sound that good, but I�m getting there One big problem I have is when more than one dot is set to play, it sounds just horrible. I googled a lot and found the additive synthesis method but don�t have a clue how to apply it to as3.
View 2 Replies
Apr 8, 2004
Ok say for example I have a sound of a bell chime. I want to play this sound independent of the mainstage and have it key off local system time. So naturally I want to have my sound loop twice at 2am/pm and eleven times at 11am/pm etc.
View 3 Replies
Apr 8, 2004
Ok say for example I have a sound of a bell chime. I want to play this sound independent of the mainstage and have it key off local system time. So naturally I want to have my sound loop twice at 2am/pm and eleven times at 11am/pm etc.
View 3 Replies
May 24, 2011
I am currently working on an assignment that requires me to add sound to a mobile game. This is fairly straightforward in many ways but I wondered if there was any way that I could add multiple sounds to a single movie clip or action?
What I really want to do is to have say three or four different sounds for the sound of a spaceship exploding in the game to create variety and stop the gamer getting bored of the same sound every time they hit a spaceship.
View 9 Replies
Sep 20, 2002
I've created a small application that links various Sound Clips to corresponding Sound variables, and the individual start and stop commands work fine. However, when I try altering the volume, the controls affect all the sounds in the movie. I'd like to refrain from creating separate SWF files to represent each sound, but I will if I have to.
View 1 Replies
Apr 16, 2010
I followed the mp3player tutorial (part 3) from [URL] and got it working fine. Only problem is that the setVolume I'm trying to use with my music is affecting all my other sounds - button sounds and background sound. I'm aware of the createEmptyMovieClip/attachSound approach and got it working on my other sounds. But Lee's tutorial-mp3player is using a slight different technique, and so my normal approach doesn't quite work.
[Code]....
View 7 Replies