ActionScript 3.0 :: SoundChannel And SoundMixer?
Sep 2, 2010when do we use SoundChannel and SoundMixer?
View 3 Replieswhen do we use SoundChannel and SoundMixer?
View 3 RepliesI just finished a simple music player... For testing purposes. I upload it in the following address:http:[url]....with 10 music songs that I had recorded from radio stations(added the last 2 twice for testing).The problem is that when a song has totally loaded, stop action taken needs about 1 second to be applied!I.e. When I press "STOP", the sound continue to play for 1 sec before stop. When I push "pause" it takes one second for the music to stop!
However when using resume (second time pause) the sound starts instantly! Thus I guess there is an issue with stop()function of the SoundChannel object that I am using to stop the sound. Also notice that when unpause the music, it continue ~one second before the last sound - which means that I saved the soundChannel.position number (and also call soundChannel.stop()) in correct time, but it didn't stop immediately - bug!?
This only happens when the application runs through a browser(plugin v. 10) - programmed in CS3.
PS1. Notice that ,this also happens when I change Volume too. Thus because Stop and Volume are parts of SoundChannel, I guess there might be a bug with SoundChannel in online plugins..... :/
PS2. Notice that ,this also happens when I close the browser (firefox). Even if browser is closed the music continue for 1 sec the same way as when pressing stop!.. Thus I guess it's flash bug!...
Using the example found in the class documentation, you'll notice the bass frequencies are crammed on the low end too much, and the higher frequencies will sometimes register even in the bytearray.position = 0 float. Is this a problem with the design of the computeSpectrum class? Because I can take the same file, put it in another spectrum analyzer and see the bass and treble spread more evenly.[URL]
View 4 RepliesI'd like to record live to a server the audio produced by some kind of drum machine made in flash, is it possible with FMS to record audio which is NOT from a Microphone object but from flash' SoundMixer?
View 1 RepliesI connect to the sound of youtube website, how can I bond SoundMixer.computeSpectrum
[Code]...
I use the AS3.0 stated below to control a simple Flash play/stop button to play/stop a mp3 on a webpage. Since I am using about 15 of those players on one page and a lot of visitors are to lazy or unaware to press 'stop' before clicking 'play' on a next player, a 'stopallsounds' would be great: so, whenever a play-button is clicked all the 'earlier' sounds will stop playing.
So, the buttons seem to work fine but the line "SoundMixer.stopAll();" in the playfunction paragraph is not doing what i want it to do; other/earlier sounds just keep playing.
[Code]...
I been trying to find this but no luck so far. Is it possible to get different soundmixer values for two different sounds that are playing at the same time?
At the moment it seems to me that the soundmixer takes the combined sound output for analysis, which si not what I need.
For the past couple of weeks I've been wracking my brains over SoundMixer.computeSpectrum(), arguably the coolest method in ActionScript 3. It's the one that spits out the last 256 (or so) audio samples that hit the speakers, with the option of viewing that data in the time domain (waveform) or the frequency domain (Fourier transform). It's great for visualizing music, but its major drawback is that it only operates on global, playing audio, which means you cannot visualize different channels or preprocess the visualization.
Sound.extract(), a new method in Flash Player 10, gives you a Sound object's entire waveform at any time you want; I've managed to line up the waveform in Sound.extract() perfectly with the waveform in SoundMixer.computeSpectrum(), so they are literally neck-in-neck. In this SWF I'm drawing two lines- a blue line, which uses data from SoundMixer.computeSpectrum(), and a red line, which uses data from
[Code]...
Using AS3 here - [URL]. I've got lots of externally loaded videos on this site most of which are XML driven. The "SoundMixer.stopAll();" works as it should, basically. I include it on each destination frame. If you click the "Jump Creative" entry point a video is set to auto-load and play. Now try clicking away on News while the video is loading. If the user clicks away while the video is loading, the audio will kick in after navigating away and after it has loaded.
View 12 RepliesI managed to run my youtube api and SoundMixer.computeSpectrum.SoundMixer.computeSpectrum are online, positionBar, player.getDuration (), player.getCurrentTime () does not work.Everything is running on localhost.I do not know is the security issue,
View 4 Repliesi'm wondering if there's a way to record live audio from flash' SoundMixer (NOT from the microphone).
View 1 RepliesI'm trying to use the code below to show a graphical representation of the sound from externally loaded FLVs, as they play.The code I have is below, can I change this to listen for whatever sounds Flash is playing at the moment and computeSpectrum from tha
Code:
var url:String = "song.mp3";
var request:URLRequest = new URLRequest(url);
[code]......
I need to mute the sound in my flash movie via html (flashVars parameter).My code in timeline is:[code]
View 6 RepliesI am trying to load multiple movies into a single swf. the problem is when I load another swf holding the movie... it keeps playing the sound from that movie even when I change to another one. what I have
ActionScript Code:
import flash.display.SimpleButton;
import flash.display.DisplayObject;
[code]......
I've currently got a flash site written in AS3, into which i'm loading an AS2 SWF that plays audio.The AS2 SWF is loaded into a container movieclip at Frame 10, when a specific navigation button is pressed, the playhead advances to this frame, and calls the SWF. When the user navigates away from this frame, SoundMixer.stopAll(); is called to kill the audio from the loaded AS2 SWF.
This works fine inside of Flash however, when deployed to the browser, the audio playing in the loaded AS2 SWF carries on playing.I've tried loading a new blank SWF in it's place to kill the audio, as well as a blank SWF with stopAll(), all of these solutions work within the Flash IDE (CS4) however the audio always persists in the browser.
Code:
var swfLoader:Loader = new Loader();
holderMC.addChild(swfLoader);
var bgURL:URLRequest = new URLRequest("ytPlayer.swf");
[code]....
am building eLearning courses using a Flash-based AS 3.0 course playerI use SoundMixer.stopAll to stop sounds when progressing through the course, pressing buttons etc also call SWFs made in Captivate into my courses. These SWFs have audio in them. But when I progress through these slides (by clicking a next button), the sound from the captivate made slides overlaps (keeps playing). SoundMixer.stopAll does not seem to work for captivate SWFs
View 1 RepliesI'm loading and progressively streaming an F4V Video using pure actionscript code (No playback component used) and after the video begins streaming I place a MUTE button on the stage that when clicked executes the SoundMixer.stopAll(); instruction.
When the movie completes playing I use the following code to monitor the NetStream state changes and place a NEXT button on the stage when the video finishes.
When the video completes there is a NetStream event.info.code issued - "NetStream.Play.Stop"
[Code]...
I'm running two flash items on one page, both have sound, and the AS3 swf uses computeSpectrum
I'm getting the following error message:
SecurityError: Error #2121: Security sandbox violation:
SoundMixer.computeSpectrum:
http://dev1.kbrcomm.com/OLA/soundSpectrum_rev2.swf
cannot access
http://dev1.kbrcomm.com/OLA/ICE_intro_rev9.swf.
[Code]...
I wondered if there is a way to find out from the soundChannel the url of the sound it is currently playing. once I found out its url, i can than use its name to call something else.Or anyway to find out the sound that is playing on a soundChannel.I will know which channel to look into, but different sound will be loaded into this soundChannel.If this is not possible, i thinking along the line of overloading SoundChannel play method so that is fires an event when the sondchannel plays and also find out the name of the sound file it is currently playing.
View 2 RepliesI am trying to build a simple player inside my swf file. The code is a bit messy but it seems to work.I´m using a soundChannel for Playback..I´m trying to figure out how to have the player play the next song once the previous one has reached its end.Do I add some sort of EventListener to the soundChannel?[code]...
View 7 Repliesi have a little flash-player with a playlist and so, it plays normally a vlc-mp3-stream but has an extended prelisten-function (wich plays the mp3's directly via http, secured with a password)i've got an array with 2 Sound()-objects (for preloading purposes), the code looks like this :
Code:
playStream = url=="";
if (playStream) {
SoundObjects[SN].load(new URLRequest("http://" + URL + ":8001/MIRstream.mp3?" + Math.random()), sloader);
} else {
[code]....
this works for the vlc stream (which is not continuos), but not for the mp3s on the http-server in my opinion, this doesn't makes sense..except, maybe the recent CSRF-hardcore-paranoia [URL]
PS: i use AS3 with flex_sdk_3.2.0.3794 and flashdevelop (i activated flash10-support, but it still works in fp9)
I am trying to develop a sound visualizer and i have developed OO solution but the problem is I get this error:
SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: widget5.swf cannot access . This may be worked around by calling Security.allowDomain.
at flash.media::SoundMixer$/computeSpectrum()
at widget5/onEnterFrame()
Also if I press continue I get other error
Error: Error #2030: End of file was encountered.
at flash.utils::ByteArray/readFloat()
at widget5/onEnterFrame()
The soundChannel only plays once.Im guessing this has to do with using a class?[code]...
View 5 RepliesI'm having some problems with a script.I developed the app on a mac. It's intended to be both on mac and windows and also air and swf (I save data or not depending if it's installed or not).I've tested it on mac and several pc (winXP) but on win 2003 server and win 2008 server I get an error. Also on a winXP without flash player installed (through the projector) breaks at the same point.The problem is on the red line. It does always work right, sound loads, plays and when it finishes the event is called (in this case it loops). In other cases when sound completes the event should load a screen or so but, as I get an 'Error #1009: Cannot access a property or method of a null object reference' so the movie stops.I need all sounds to be inside flash so I put them in library and set their classes as com.escacs.sound.* (there are many sounds) I can't understand how mainSC can be null or undefined if the previous instruction initializes it.
[code]...
AS2 -> AS3 migration: doncha just love it?!have a look at the attached code. selection one makes us anew sound and gets it playting, great. then we need to adjust thevolume so we read in the files that:You can alter the volume and panning while a sound is playingby setting the pan or volume properties of a SoundTransform objectand then applying that object as the soundTransform property of aSoundChannel object.great, so selection 2 in code below should do that, right?
View 7 RepliesI was debugging sound in an app and decided to make a little test case as I kept getting odd errors... well I just moved to a new desk yesterday so hadn't hooked up speakers yet. Here's the test:
var backSound:Sound = new bgSound();
var backChannel:SoundChannel = backSound.play(0, 999);
trace(backChannel);
bgSound is just a library sound... if my speakers are unplugged from the sound card backChannel returns null. If speakers a plugged in backChannel is a soundChannel object.
so I have a lot of classes in actionscript 2. But I need to modify my application to use the soundchannel object for audio monitoring. as far as i know this is only in actionscript 3. so it it possible to write one class in AS3 and leave the rest in AS2?
if not is there a conversion tool which can make the process easier?
EDIT: Sorry for the question being reworded, but I am just simplifying the issue. I am not getting accurate values for SoundChannel. position for an external MP3 that is playing.I've tried a variety of audio bitrates and consistently,i am getting a SoundChannel.position that is less (~250 ms) then where the actual audio has played to. As well, the position never equals the duration. It always finishes behind, even when the SOUND_COMPLETE event is generated.
Adobe says any Sound position/duration issues are fixed with the latest Flash Player. I am obviously not getting the same results. I need very accurate position values in order to have a custom draggable timeline and cue points.
I have a Flex(4.6.0) application which creates 3 SoundChannels. I'd like to attach 2 of these channels to a NetStream for publishing, leaving the 3rd SoundChannel only for listening to locally.
The only audio component I can seem to attach to a NetStream is a Microphone, so I could use a Microphone loopback adapter and send ALL sound to the stream, but this would include all channels, windows sounds, sounds from other applications etc.
How do I attach individual soundchannels to a stream, or should I be going about this in a different way?
I'm creating a mute/unmute button.I have it working correctly, except 1 part.I want to make my SoundChannels remove themselves when the SOUND_COMPLETE Event is fired.I'm storing my Sounds and SoundChannels in an array called "soundsPlayingArray".I want to do 1 of 2 things.Either:
1) Have my "unMuteAll" function check to see whether a song is "playing" before unmuting it.
2) Remove the Sound + SoundChannel from array (and make them null) when the SOUND_COMPLETE Event fires.
How can I figure out what the instance name of the SoundChannel that dispatched the SOUND_COMPLETE event is?[code]