OundMixer.computeSpectrum Problem
I'm totally stumped here.
The music visualizer works on my desktop, but as soon as I post it to the web the equalizer bars do not work.
anyone have any ideas?
Website (spectrum bars not working)
source here
audioManager.as is were the computeSpectrum code is
FlashKit > Flash Help > Actionscript 3.0
Posted on: 11-23-2007, 02:02 AM
View Complete Forum Thread with Replies
Sponsored Links:
ComputeSpectrum Help
Hello Everyone, I need help with computeSpectrum (not the usual EQ project)
I am very new to AS and need help with the following code. The objective is to play a MC when the spectrum array hits a certain number range from the "rangeBegin", "rangeEnd" variables. I'm sure it's something obvious that I'm missing but like I said, I'm a newbie.
Thanks in advance for any help at all
CODE:
++++++++++++++++++++++++++++
import flash.display.MovieClip;
var rangeBegin:Number = 100;
var rangeEnd:Number = 162;
var s:Sound = new Sound(new URLRequest("music.mp3"));
s.play(0, 4);
var ba:ByteArray = new ByteArray();
addEventListener(Event.ENTER_FRAME, loop);
function loop(e:Event):void {
SoundMixer.computeSpectrum(ba);
for (var i:uint=rangeBegin; i<rangeEnd; i++) {
var num:Number = ba.readFloat();
drum.gotoAndPlay();
}
}
View Replies !
View Related
SS ComputeSpectrum
I want to know if there is a way to get SoundMixer.computeSpectrum to work on the server side, I know on the tech docs this can't be done on the client side, due to sandbox security restrictions?
View Replies !
View Related
ComputeSpectrum
Hey guys-
This is the first AS3 I've touched since it came out. I am messing around with the computeSpectrum and now im kind of stuck..
I have it working, but I want to add more to it. For example...I want it to be a gradient..kind of like this one:
http://kirupa.com/forum/showthread.p...omputespectrum
I have a little example that ive done here and even added a little blur filter, but other than that I dont know what else i can do..
http://ostari.com/ronnie/spectrum/spectrum.swf
ActionScript Code:
var mySound:Sound = new Sound();mySound.load(new URLRequest("song.mp3"));mySound.play();var myByteArray:ByteArray = new ByteArray();function readSpectrum(event:Event) { SoundMixer.computeSpectrum(myByteArray, false,0); graphics.clear(); for (var i = 0; i<256; i+= 8) { drawSpectrum(myByteArray.readFloat(),i); }}function drawSpectrum(myReadFloat:Number, myIteration:Number) { var myNumber:Number = myReadFloat * 500; graphics.lineStyle(1, 0x000000); graphics.beginFill(0x99ff00); ball.rotation = myNumber*-0.1; graphics.drawRoundRect((16 * (myIteration / 8)) + 19,250,16,-(myNumber/2),20,20); //graphics.drawRect((16 * (myIteration / 8)) + 19, 250,16,-(myNumber / 5)); //graphics.drawEllipse((16 * (myIteration / 8)) + 19,250,16,-(myNumber / 5)); //graphics.drawCircle((16 * (myIteration / 8)) + 19,250,-(myNumber / 5)); var filter:BitmapFilter = new BlurFilter(3,3,BitmapFilterQuality.HIGH); //var filter:GlowFilter = new GlowFilter(0x00ccff,5,2,2,50); var myFilters:Array = new Array(); myFilters.push(filter); filters = myFilters;}this.addEventListener(Event.ENTER_FRAME, readSpectrum);
and there is my code...soo any tips on making the bars a gradient like the first example I showed?
View Replies !
View Related
ComputeSpectrum Issue
Hi,
i was playing around with computeSpectrum FFTMode and got some weird results.
First, all the frequencies over 11000 hz are not there, it looks like only 0-11000 hz are written in the ByteArray;
Second, when i read the ByteArray with readFloat() the values goes up to 1.465~.
Did someone worked with computeSpectrum, to explain how this work? There is not much help in the Flash Help
cheers
View Replies !
View Related
SoundMixer.computeSpectrum
In dealing with SoundMixer.computeSpectrum, can anybody give me a hand by checking out MY FILES and telling me why the bars are not accurate like the wave format is?
I think what I'm trying to do is self explanatory once you see the files.
Cheers
View Replies !
View Related
AS3 ComputeSpectrum() Bass
Hi, I used an example tutorial to create a sounds visualizer using computeSpectrum(), but I was wondering how I can detect sounds in it lower than a certain frequency. I want to be able to do this so I can detect bass sounds in the playing audio. Thanks!
View Replies !
View Related
ComputeSpectrum Issue
Hi,
i was playing around with computeSpectrum FFTMode and got some weird results.
First, all the frequencies over 11000 hz are not there, it looks like only 0-11000 hz are written in the ByteArray;
Second, when i read the ByteArray with readFloat() the values goes up to 1.465~.
What am i doing wrong?
Edited: 10/30/2007 at 03:38:59 PM by podlium
View Replies !
View Related
ComputeSpectrum Oddity
I've got a spectrum visualization, that is working great locally, however, not working at all live. The sound is playing and everything else is function as should, just the visualization isn't. Not sure what I need to provide to help solve this, cause it seems very odd. Any ideas?
View Replies !
View Related
Is ComputeSpectrum() Broken?
I've been having trouble with my audio visualizer that uses computeSpectrum() ever since the latest update.
I haven't made any changes in the code for the audio visualizer, but after the last Adobe Update I downloaded, it seems that not only my visualizer is broken, but every visualizer I look at online is displaying waveform data that is not what it should be. I'm wondering if any other Flash users are having this problem, or if there's some way I could have broken it...
Also, I don't have any other streaming .swf's open at the time I'm viewing the visualizers, so it couldn't really be that problem.
Thanks in advance for any thoughts or input, because I'm completely lost...
EDIT:
It seems that other visualizers are working, but mine still aren't, I have a version online that I haven't messed with since the update, and even that one is broken though.
Edited: 10/05/2008 at 04:42:34 PM by Jorgon
View Replies !
View Related
ComputeSpectrum Question?
Hey guys,
just wondering if anyone has come across a tutorial or any information about the computeSpectrum that could help me out.
I know how to create a spectrum analyzer, however what I would like to do is be able to take the bytes from the byte array and put it back into a sound object. So for example take a song cut out, all of the high frequencies and then push those bytes back to a sound object. Does anyone know if this is possible with AS3???
Thanks
View Replies !
View Related
[AS3] SoundMixer.computeSpectrum
Last edited by InfinityI : 2006-07-05 at 08:51.
I have been trying out AS3 for the first time and looking into the "computeSpectrum" method to create a graphical representation of the song as it plays. I wish to create a simple display that will display the track using 8 bars, each bar having 7 keyframes (frame 1 no blocks showing, frame 7 all blocks showing).
This is what I have so far:
ActionScript Code:
var sound:Sound = new Sound();
var stream:ByteArray = new ByteArray();
sound.load(new URLRequest('song.mp3'));
sound.play(0);
function spectrum(event)
{
SoundMixer.computeSpectrum(stream, true, 0);
var bar;
var barCount = 8;
var byte = 0;
var sample = 256;
var band = (sample - 2) / barCount;
var position = band / 2;
for (var i = 0; i < barCount; i++)
{
stream.position = Math.floor(position);
position += band;
byte = (stream.readFloat() * 256) << 0;
bar = this['bar' + (i + 1)];
bar.gotoAndStop(Math.round((byte / 256) * bar.totalFrames));
}
}
this.addEventListener(Event.ENTER_FRAME, spectrum);
But it seems totally random and not to reflect the track like I would expect.
Basically im wondering how I can display the spectrum byte array across a number of bars.
Thanks in advance
View Replies !
View Related
SoundMixer.computeSpectrum
Hi,
is there any workaround for computing spectrum on .flv file loaded from the different domain without using cross-domain policy file?
I know there is similar workaround with BitmapData and different domains, so maybe there is also workaround for the spectrum?
Best regards,
Bart
View Replies !
View Related
ComputeSpectrum On A SoundObject ?
i've used lee's code and these classes Sound SoundChannel SoundTransform but when i transform the sound the eq just disappear it is only one line .... can somebody help me to fix the problem ...
Code:
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.*;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import flash.net.URLRequest;
import flash.utils.Timer;
var url:String = "MySound.mp3";
var soundFactory:Sound;
var channel:SoundChannel;
var positionTimer:Timer;
var request:URLRequest;
var ba:ByteArray = new ByteArray();
addEventListener(Event.ENTER_FRAME, loop);
var bmd:BitmapData = new BitmapData(450, 400, true, 0x000000);
var bm:Bitmap = new Bitmap(bmd);
addChild(bm);
var sp:Sprite = new Sprite();
addChild(sp);
var blur:BlurFilter = new BlurFilter(10,10,3);
var colorMatrix:ColorMatrixFilter = new ColorMatrixFilter([
1, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 2, 0, 0,
0, 0, 0, 1, 0
]);
inIt();
function inIt():void {
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
request = new URLRequest(url);
soundFactory = new Sound();
soundFactory.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
soundFactory.load(request);
channel = soundFactory.play();
soundFactory.addEventListener(ProgressEvent.PROGRESS, progressHandler);
soundFactory.addEventListener(Event.ID3, id3Handler);
channel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
soundFactory.addEventListener(Event.COMPLETE, completeHandler);
positionTimerConf();
}
function positionTimerConf():void {
positionTimer = new Timer(50);
positionTimer.addEventListener(TimerEvent.TIMER, positionTimerHandler);
positionTimer.start();
}
function completeHandler(event:Event):void {
trace("completeHandler: " + event);
}
function faddeIn(t:MovieClip):void {
Tweener.addTween(t,{alpha:1, visible:1, time:0.7, transition:"linear"});
}
function faddeOut(t:MovieClip):void {
Tweener.addTween(t,{alpha:0, visible:0, time:0.7, transition:"linear"});
}
function id3Handler(event:Event):void {
trace("id3Handler: " + event);
}
function progressHandler(event:ProgressEvent):void {
trace("progressHandler: " + event);
}
function soundCompleteHandler(event:Event):void {
trace("soundCompleteHandler: " + event);
positionTimer.stop();
}
function positionTimerHandler(event:TimerEvent):void {
trace("positionTimerHandler: " + channel.position.toFixed(2));
}
function ioErrorHandler(event:Event):void {
trace("ioErrorHandler: " + event);
}
function setPan(pan:Number):void {
trace("setPan: " + pan.toFixed(2));
var transform:SoundTransform = channel.soundTransform;
transform.pan = pan;
channel.soundTransform = transform;
}
function setVolume(volume:Number):void {
trace("setVolume: " + volume.toFixed(2));
var transform:SoundTransform = channel.soundTransform;
transform.volume = volume;
channel.soundTransform = transform;
}
function loop(e:Event):void {
sp.graphics.clear();
sp.graphics.lineStyle(3, 0xFFFFFF);
sp.graphics.moveTo(-1, 200);
SoundMixer.computeSpectrum(ba);
for (var i:uint=0; i<256; i++) {
var num:Number = -ba.readFloat()*200 + 200;
sp.graphics.lineTo(i*1.76, num);
}
bmd.draw(sp);
bmd.applyFilter(bmd,bmd.rect,new Point(),blur);
bmd.applyFilter(bmd,bmd.rect,new Point(),colorMatrix);
bmd.scroll(3,0);
}
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
function mouseMoveHandler(event:MouseEvent):void {
var halfStage:uint = Math.floor(stage.stageWidth / 2);
var xPos:uint = event.stageX;
var yPos:uint = event.stageY;
var value:Number;
var pan:Number;
if (xPos > halfStage) {
value = xPos / halfStage;
pan = value - 1;
} else if (xPos < halfStage) {
value = (xPos - halfStage) / halfStage;
pan = value;
} else {
pan = 0;
}
if (pan > 1) {
pan = 0;
}
var volume:Number = 1 - (yPos / stage.stageHeight);
setVolume(volume);
setPan(pan);
}
View Replies !
View Related
ComputeSpectrum FFTMode Questions
I can't seem to find much information on the computeSpectrum function with FFTMode set to true.
Does anyone know what frequency range is covered by the values in the byte array and if the covered frequencies from low to high are represented in a linear way ?
View Replies !
View Related
[CS3] Computespectrum Failing Randomly
Hi..
am trying to make a mp3 player by using actionscript3.
In this , am trying a upload a mp3 file and play that particular file. Am also using the computespectrum() to display the graphics.
Now the problem am facing is with the computespectrum . Randomly , the computespectrum is failing for the same file and is throwing error.The error is as follows
SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: http://site.com/FileUploader/mp3player.swf cannot access . This may be worked around by calling Security.allowDomain.
at flash.media::SoundMixer$/computeSpectrum()
Am actually uploading the file into a folder named "mp3files". The "mp3files" folder and the swf are lying in the same domain.
Has anyone got an error like this before.. Pl help me.. Am really stuck with this...
View Replies !
View Related
Computespectrum Failing Randomly
Hi..
am trying to make a mp3 player by using actionscript3.
In this , am trying a upload a mp3 file and play that particular file. Am also using the computespectrum() to display the graphics.
Now the problem am facing is with the computespectrum . Randomly , the computespectrum is failing for the same file and is throwing error.The error is as follows
SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: http://site.com/FileUploader/mp3player.swf cannot access . This may be worked around by calling Security.allowDomain.
at flash.media::SoundMixer$/computeSpectrum()
Am actually uploading the file into a folder named "mp3files". The "mp3files" folder and the swf are lying in the same domain.
Has anyone got an error like this before.. Pl help me.. Am really stuck with this...
View Replies !
View Related
Microphone To SoundMixer.computeSpectrum
Hi all,
is there any way that audio input from a microphone can be sent to the SoundMixer class so that input audio can be analysed using the computeSpectrum method?
Also, can 2 or more audio input streams be taken from different microphone audio inputs so that stereo input can be achieved or are we limited to mono audio input?
Cheers
View Replies !
View Related
Computespectrum Failing Randomly
Hi..
am trying to make a mp3 player by using actionscript3.
In this , am trying a upload a mp3 file and play that particular file. Am also using the computespectrum() to display the graphics.
Now the problem am facing is with the computespectrum . Randomly , the computespectrum is failing for the same file and is throwing error.The error is as follows
SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: http://site.com/FileUploader/mp3player.swf cannot access . This may be worked around by calling Security.allowDomain.
at flash.media::SoundMixer$/computeSpectrum()
Am actually uploading the file into a folder named "mp3files". The "mp3files" folder and the swf are lying in the same domain.
Has anyone got an error like this before.. Pl help me.. Am really stuck with this...
View Replies !
View Related
SoundeMixer.computeSpectrum Confusion
Hi All,
I have a problem with SoundMixer.computeSpectrum method. Im using it at an audio app. to display the sound wave spectrum of a loaded sound. When I test the flash app. locally ( I load the sound from my web server ) it works as expected, when I hit the play button the spectrum it is displayed properly; however when I test the flash app. at my web server, the sound does plays but the spectrum is not displayed whatsoever. I have the follwoing server config.
http://www.mydomain.com ==> where the flash app. is located
http://audio.mydomain.com ==> where all of my audio files are
I already have the crossdomain policy file at my audio subdomain, so I dont know why I cannot access computeSpectrum(). As far as I know, in order to have access to SoundMixer methods and properties you need the secutiry policy, and it is there, so what am I missing ?
Thanks in advanced In the meantime Ill keep googleing
Mario
View Replies !
View Related
ComputeSpectrum, Values Out Of Range?
I'm using SoundMixer.computeSpectrum(), and have followed pretty much the most basic way of implementing it.
Code:
SoundMixer.computeSpectrum(ba);
for (var i:uint = 0; i < 256; i++) {
var lev:Number = ba.readFloat();
if (lev > 0) {
trace(lev);
}
}
Right now I'm just trying to see what kind of values I get out of this... and then I'm home-free from there.
Problem is, instead of seeing values from -1.0 to 1.0, I'm actually getting trace data from 0 to 1.7, 1.3, 1.2. This doesn't happen that often, but it happens - and is totally killing my animations. As I'm expecting to use the 0.0 to 1 value as a scale factor.
Has anyone encountered this?? Could it be the sound file and not the coding? I'm playing a 192k sampled 44.1kHz clip.
View Replies !
View Related
Bug (?) In Flash/AS3 When Using SoundMixer.computeSpectrum
Hi,
I'm currently playing around with sound visualization in Flash and AS3, but I'm pretty stuck in something that seems like a bug to me.
Anyway, I'm using this code:
PlayMusic.as
ActionScript Code:
public class PlayMusic {
private var sound:Sound;
public function PlayMusic():void {
sound = new Sound;
sound.load(new URLRequest("resource/my_mp3.mp3"));
sound.addEventListener(Event.COMPLETE, playSound);
}
private function playSound(e:Event):void {
sound.play(0);
}
}
DocumentClass.as
ActionScript Code:
private var ba:ByteArray = new ByteArray
...
public function DocumentClass() {
this.addEventListener(Event.ENTER_FRAME, loop);
}
...
private function loop(e:Event) {
SoundMixer.computeSpectrum(ba, true);
var t:Number = 0;
var c:Number = 0;
for(var i:int = 0; i < 256; i++) {
t += ba.readFloat();
}
trace(t);
}
I'm certain the path to the mp3 is correct, it starts playing, but here is the wierd thing, when I'm running it I get a steady stream of these:
ActionScript Code:
Error: Error #2030: End of file was encountered.
at flash.utils::ByteArray/readFloat()
at classes::DocumentClass/loop()
And if I just remove this line "t += ba.readFload();" I instead get zeroes (from the trace(t)-line) mixed with:
ActionScript Code:
SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: file:///Macintosh%20HD/
Users/myuser/path/to/swf/main.swf cannot access . This may be worked around by calling Security.allowDomain.
at flash.media::SoundMixer$/computeSpectrum()
at classes::DocumentClass/loop()
And well, as if that wasn't enough, if I try and run it a couple of times the whole application just crashes (not only the swf, but Flash CS4 too).
What can I do?
System info:
Macbook Pro 15" 5,1 (latest edition)
Running Mac OS X 10.5.5 and Flash CS4 (10.0)
View Replies !
View Related
SoundMixer.computeSpectrum () Can't Work
e.g,there are two independed and noninteract swf file in different domain,all of them call the method SoundMixer.computeSpectrum () ,
1.if opening them in different brower instances, the method SoundMixer.computeSpectrum () worked correctly.
2. if opening them in the same brower but different tab,securityError #2121 ocurred
View Replies !
View Related
Couple Of Computespectrum Questions
Is it easy to control movieclips using the bytearray data generated by computespectrum?
How would one go about using specific parts of the byte array, for example isolating data that refers to a certain frequency range? Can this be done?
Thanks
View Replies !
View Related
ComputeSpectrum / Live Streams
Hi
I`ve got a project involving recording live audio and streaming it through flash, and using computeSpectrum to react to the music.
I was wondering if anyone had any experience of streaming live audio with Flash (so far I think it's only possible with FMS) and if computeSpectrum works the same with a live stream.
Thanks a lot for any help
View Replies !
View Related
ComputeSpectrum / ReadFloat Problems
Hi guys, I've been up for hours killing myself over this problem.
I'm making a 3D spectrum visualizer in PaperVision3D using computeSpectrum. My super basic 2D computeSpectrum tests worked flawlessly, but in my 3D version I'm having huge problems.
The first problem was that the byteArray kept running out, resulting in an end of file error, as though the pointer wasn't being reset. So I manually reset the pointer each frame (songByteArray.position = 0) -- and that worked! and then after about 2 seconds it crashes the Flash IDE!!!
I just tested and when I run the .swf in the Flash Player it doesn't seem to crash. Can anybody help me out here? I know what I'm doing is nothing special, there have been lots of cool experimental visualizers in papervision. What gives???
View Replies !
View Related
Question About Using SondMixer.computeSpectrum Twice
I am trying to have two sounds loaded into flash with two seperate visual analyzers. The problem that I am coming across is that both analyers animate to the two sounds mixed together. Is there any kind of work around to have each analyzer animate to a seperate sound?
Along the lines of this is there a way to mute the sound but still continue to have the analyer animate?
View Replies !
View Related
SoundMixer.computeSpectrum With Movieclips Confusion.
I have an 8 frame MC named symbol and I'm trying to get it to visualize when a song is playing. So I got this code and I'm new to AS3, but I get the basic gist of what's happening. But how I do I get it to play my movie clip? Do I have to drag in onto the stage or what?
PHP Code:
var requested:URLRequest = new URLRequest("http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3");
var s:Sound = new Sound();
s.addEventListener(Event.COMPLETE, completeHandler);
s.load(requested);
var song:SoundChannel=new SoundChannel();
s.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
var ba:ByteArray = new ByteArray();
var gr:Sprite = new Sprite();
gr.x = 20;
gr.y = 200;
addChild(gr);
var time:Timer = new Timer(50);
time.addEventListener(TimerEvent.TIMER, timerHandler);
time.start();
function completeHandler(event:Event):void {
song=event.target.play();
}
function soundCompleteHandler(event:Event):void {
time.stop();
}
var numOfFrames:int=52;
function timerHandler(event:TimerEvent):void {
SoundMixer.computeSpectrum(ba, false);
var i:int;
var w:uint = 15;
var p:int=0
for (i=0; i<512; i+=w) {
var t:Number = ba.readFloat();
p+=t
}
symbol.gotoAndStop(Math.abs(Math.ceil((p)*8)/256))
}
This is my fla:
http://tivaelydoc.110mb.com/explosion.fla
View Replies !
View Related
SoundMixer.computeSpectrum() What Does It Write To ByteArray?
Hi, hope someone can explain this in more human language then it's written in manual.
Here's how I've understood it, but it looks almost wrong to me...
(the calculations are made for 44,1KHz)
Once you call SoundMixer.computeSpectrum() you get 2048 bytes, 256 x 4 for left channel and 256 x 4 for right channel. The question is what time it describes? Meaning... it can't be 44100 * 2048 (90 316 800) bytes per second! Just because it is nearly 100 times more than average WAVE file would need for the double sample rate...
View Replies !
View Related
ComputeSpectrum + Audio Source Question
Like many others I really like computeSpectrum That said, there's something I want to do and I don't know if it's possible.
In every example that I've seen (and in my own experience working with it) computeSpectrum functions on all audio currently being output by Flash. What I want/need to do is target the spectrum/FFT stuff to only one channel of audio. What I mean is, I want to get and display spectrum data on some playing audio (ie: an .mp3), but at the same time I want to be able to play other audio (ie: interface sound effects) that does not interfere with that spectrum.
Is there any way, obvious or not, to accomplish this? I could easily be missing something.
Here's one non-obvious method that I thought of: Perhaps there is some way to quickly capture the entire spectrum data of the entire .mp3 ahead of time and then use that data to provide the spectrum while really playing back the .mp3. If nothing else is possible, is this at least possible somehow, or does computeSpectrum -only- work in realtime on playing audio?
Does anyone have a magical solution for me?
View Replies !
View Related
SoundMixer.computeSpectrum With Movieclips Confusion.
I have an 8 frame MC named symbol and I'm trying to get it to visualize when a song is playing. So I got this code and I'm new to AS3, but I get the basic gist of what's happening. But how I do I get it to play my movie clip? Do I have to drag in onto the stage or what?
PHP Code:
var requested:URLRequest = new URLRequest("http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3");var s:Sound = new Sound();s.addEventListener(Event.COMPLETE, completeHandler);s.load(requested);var song:SoundChannel=new SoundChannel();s.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);var ba:ByteArray = new ByteArray();var gr:Sprite = new Sprite();gr.x = 20;gr.y = 200;addChild(gr);var time:Timer = new Timer(50);time.addEventListener(TimerEvent.TIMER, timerHandler);time.start();function completeHandler(event:Event):void { song=event.target.play();}function soundCompleteHandler(event:Event):void { time.stop();}var numOfFrames:int=52;function timerHandler(event:TimerEvent):void { SoundMixer.computeSpectrum(ba, false); var i:int; var w:uint = 15;var p:int=0 for (i=0; i<512; i+=w) { var t:Number = ba.readFloat();p+=t } symbol.gotoAndStop(Math.abs(Math.ceil((p)*8)/256))}
This is my fla:
http://tivaelydoc.110mb.com/explosion.fla
View Replies !
View Related
SoundMixer.computeSpectrum() What Does It Write To ByteArray?
Hi, hope someone can explain this in more human language then it's written in manual.
Here's how I've understood it, but it looks almost wrong to me...
(the calculations are made for 44,1KHz)
Once you call SoundMixer.computeSpectrum() you get 2048 bytes, 256 x 4 for left channel and 256 x 4 for right channel. The question is what time it describes? Meaning... it can't be 44100 * 2048 (90 316 800) bytes per second! Just because it is nearly 100 times more than average WAVE file would need for the double sample rate...
View Replies !
View Related
SoundMixer.computeSpectrum To Music Theory?
Hi all.
I have a general question that I need help getting started with. I've been playing around with audio visualization stuff lately with success using SoundMixer.computeSpectrum() to build simple frequency analysis bars. However I want to figure out how to use all these numbers to determine notes and tones and that kinda thing to understand the music that is being played.
Does anyone have some ideas about where I should look for this kind of thing, or what kind of search terms I should be looking for?
Thanks!
View Replies !
View Related
ComputeSpectrum Based Flash Game Help
Hi,
I am researching making a game for my degree at university that is based around the new computeSpectrum functionality in AS3. I have read a lot and tried out a few tutorials but hopefully would like some clarification from the clever people here on whether things could be possible.
I have a basic/moderate understanding of AS2, I have not yet made anything with AS3...
My game is likely to be a platform based game within which the content/obstacles are generated by the frequency data. So I'd have say 4 platforms, with platform 1 being moved by frequencies from 40hz to 150hz. platform 2 by frequencies from 200hz to 500hz, platform 3 by frequencies from 2000hz to 5000hz and platform 4 by 8000hz to 16000hz.
I have a few questions:
1) From my own observation and through reading comments by others I have noticed that the spectrum that is output is not displayed as well as it should/could be. The frequencies towards the left side of the spectrum (assuming it is displayed in a bar style horizontal manner) represent a vast amount of the frequency range, rather than just the low end frequencies occupied by basslines and kick drums etc. Does anyone know of a way of working with this so it could be more accurate? I guess what I'd need is to be able to restrict or filter the data output to contain only frequencies within a specific range.
2) Following on from this, would I then be able to have mutliple outputs that each send different data to affect multiple platforms?
3) Assuming the previous 2 questions could be satisfied, is it feasible for me to have a player controlled character interact with the obstacles controlled by the computeSpectrum output?
Sorry if this is hard to grasp, I haven't explained my needs very well
Thanks so much for anyone that can give me pointers
Alex
View Replies !
View Related
ComputeSpectrum Multiple Movies On Same Page / Frames
hi, i'd like to know if its possible to use the computeSpectrum function "globally" for all movies on the same page / domain
when i have 2 movies open in the flash ide(one playing music, the other with the computeSpectrum script) it works and the second movie can compute the spectrum of the output of the first movie... however when i try it outside of the flash ide the spectrum.swf doesn't show anything
so i played around with local connections... music.swf sends the spectrum bytearray to spectrum.swf and it works... however this costs alot of cpu
heres the player connected via localConnection:
http://lab.harder-styles.ws/connected/player.html
View Replies !
View Related
SecurityError: Error #2121: Security Sandbox Violation: SoundMixer.computeSpectrum:
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. This may be worked around by calling Security.allowDomain.
at flash.media::SoundMixer$/computeSpectrum()
at soundSpectrum_rev5_fla::mc_6/loop()
Please advise.... http://dev1.kbrcomm.com/OLA
I should mention that the swf that is generating the errors is AS3 and the swf that is reported in the error message is AS2
Edited: 12/19/2008 at 09:14:24 AM by Woolly Bugger
View Replies !
View Related
|