Page 1 of 1
EQ - VU Meter - Waveform reading in Flash How do you read the waveform of a sound?
#1
EQ - VU Meter - Waveform reading in Flash
Posted 09 May 2007 - 12:23 PM
I am looking to make a better media player than Windows Media Center, but similar. I am making a checklist of all the things I would like to be able to incorporate before I attempt it. The first thing that I am looking to do is learn how I can "read" the waveform in order to make a spectrum analyzer or simple VU meter that follows the dB of the music. What sort of features are built into Flash that I could use to accomplish this or what kind of function would I need to call?
Thanks,
simkiss
fl8 pro[size=3]
Thanks,
simkiss
fl8 pro[size=3]
#2
Re: EQ - VU Meter - Waveform reading in Flash
Posted 09 May 2007 - 01:44 PM
as posted in anoter forum
Quote
you must use a 3rd party tool that supports frequency analysis of the audio file (wav/aiff or mp3).
The application reads through the audio file and builds an array of the amplitude (volume) changes of a pre selected range of frequencies in the song at a rate matching the frame rate of your SWF. You create the eq animation by making a movie clip "bar" for each freuquency. Use a frame based loop to read through the array and change the movie clip's _height or _width properties to show changes in amplitude of each frequency as the song plays. This creates the animated graphic eq effect.
two tools that support this are:
FlashAmp Pro - http://www.marmalade...shamp/index.htm
swift-mp3 - http://www.swift-tools.net
The application reads through the audio file and builds an array of the amplitude (volume) changes of a pre selected range of frequencies in the song at a rate matching the frame rate of your SWF. You create the eq animation by making a movie clip "bar" for each freuquency. Use a frame based loop to read through the array and change the movie clip's _height or _width properties to show changes in amplitude of each frequency as the song plays. This creates the animated graphic eq effect.
two tools that support this are:
FlashAmp Pro - http://www.marmalade...shamp/index.htm
swift-mp3 - http://www.swift-tools.net
#13
Re: EQ - VU Meter - Waveform reading in Flash
Posted 09 October 2007 - 01:51 PM
You could also use as3:
You can see it contains 2 versions.. 1 circle based visual and one vertical peaklevel visual...
At this moment I want to generate a player like : http://www.bleep.com [see the demo player]. It generates a pregraphic of the audio peaks... then it plays at about 5% load and pause etc.
Via reversed engineering I could snif in the code but I cannot get the
visual woking [audio play and pause ok] but the visual peak not.
Anyone?? [see bleep.com sample]
Valentijn - ontwerp AT zonnet.nl
//1ste visual
/*var s:Sound = new Sound();
var sc:SoundChannel;
var ba:ByteArray = new ByteArray();
var array:Array;
s.load(new URLRequest("loop.mp3"));
sc = s.play(0,1000);
this.addEventListener(Event.ENTER_FRAME, spectrum);
var a:Number = 0;
function spectrum(event:Event)
{
a = 0;
graphics.clear();
SoundMixer.computeSpectrum(ba,true,0);
for(var i=0; i < 256; i=i+8)
{
a = ba.readFloat();
var num:Number = a*360;
graphics.lineStyle(num/15,0x0066FF|(num << 8));
graphics.drawCircle(stage.stageWidth/2,stage.stageHeight/2,i);
}
}*/
//2e visual
var url:String = "loop.mp3";
var request:URLRequest = new URLRequest(url);
var s:Sound = new Sound();
s.addEventListener(Event.COMPLETE, completeHandler);
s.load(request);
var song:SoundChannel = s.play();
song.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(100);
time.addEventListener(TimerEvent.TIMER, timerHandler);
time.start();
function completeHandler(event:Event):void {
event.target.play();
}
function soundCompleteHandler(event:Event):void {
time.stop();
}
function timerHandler(event:TimerEvent):void {
SoundMixer.computeSpectrum(ba, true);
var i:int;
gr.graphics.clear();
gr.graphics.lineStyle(0, 0xFF0000);
gr.graphics.beginFill(0xFF0000);
gr.graphics.moveTo(0, 0);
var w:uint = 2;
for (i=0; i<512; i+=w) {
var t:Number = ba.readFloat();
var n:Number = (t * 100);
gr.graphics.drawRect(i, 0, w, -n);
}
}
You can see it contains 2 versions.. 1 circle based visual and one vertical peaklevel visual...
At this moment I want to generate a player like : http://www.bleep.com [see the demo player]. It generates a pregraphic of the audio peaks... then it plays at about 5% load and pause etc.
Via reversed engineering I could snif in the code but I cannot get the
visual woking [audio play and pause ok] but the visual peak not.
Anyone?? [see bleep.com sample]
Valentijn - ontwerp AT zonnet.nl
Page 1 of 1

Ask A New Question
Reply



MultiQuote





|