So I tried out some AS3, in particular the spectrum analyzing functions and came up with this thing. The music is the tune from Tomato's tomfoolery thread.
Wait for load, 1.5MB
[FLASH]http://files.myfrogbag.com/bwdehj/spectrumTests2.swf width=360 height=300[/FLASH]
Edit: Thanks Snake for decompiling it
What exactly is the spectrum analyzing?
Quote from: IceeClock;1510403What exactly is the spectrum analyzing?
lots of tomfoolery of course
I've got a decompiler and CS3. Leave it to me.
Captain the tomfoolery levels are off the scale! The ship can't take much more of this!
Roman asked me to post the code for posterity:
import flash.media.*;
package
{
import flash.media.*;
dynamic public class mySound extends Sound {
public function mySound() {
return;
}
}
}
import flash.media.*;
package
{
import flash.media.*;
dynamic public class mySound1 extends Sound {
public function mySound1() {
return;
}
}
}
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
package spectrumTests2_fla
{
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
dynamic public class MainTimeline extends MovieClip {
public var gr:Sprite;
public var baq:ByteArray;
public var song:SoundChannel;
public var tran:SoundTransform;
public var ba:ByteArray;
public var timeq:Timer;
public var iit:Number;
public var s:mySound;
public var time:Timer;
public var wqq:TextField;
public var wq:TextField;
public var grq:Sprite;
public function MainTimeline() {
addFrameScript(0, frame1);
return;
}
public function timerHandler(param1:TimerEvent) : void {
var _loc_2:int;
var _loc_3:Number;
var _loc_4:uint;
var _loc_5:Number;
var _loc_6:Number;
var _loc_7:Number;
var _loc_8:Number;
var _loc_9:Number;
SoundMixer.computeSpectrum(ba, true, 0);
_loc_3 = 0;
gr.graphics.clear();
gr.graphics.lineStyle(0, 16711680);
gr.graphics.beginFill(16711680);
gr.graphics.moveTo(0, 0);
_loc_4 = 1;
_loc_5 = 0;
_loc_2 = 0;
while (_loc_2 < 512){
// label
_loc_8 = ba.readFloat();
if (_loc_2 < 64){
_loc_5 = _loc_5 + _loc_8;
}
_loc_9 = _loc_8 * 5;
gr.graphics.drawCircle(Math.cos(_loc_2 / 512 / (180 / Math.PI) * 360) * 128, Math.sin(_loc_2 / 512 / (180 / Math.PI) * 360) * 128, _loc_9);
_loc_3 = _loc_3 + _loc_8;
_loc_2 = _loc_2 + _loc_4;
}
gr.rotation = gr.rotation - (_loc_3 + 0.5) / 25;
_loc_6 = 0.3 + _loc_5 / 20;
scaleX = scaleX + (_loc_6 - scaleX) / 10;
scaleY = scaleX;
_loc_7 = scaleY;
x = -275 * _loc_7 + 275;
y = -200 * _loc_7 + 200;
x = Math.round(x);
y = Math.round(y);
return;
}
function frame1() {
s = new mySound();
song = s.play();
song.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler);
ba = new ByteArray();
baq = new ByteArray();
gr = new Sprite();
gr.x = 275;
gr.y = 200;
addChild(gr);
grq = new Sprite();
grq.x = 275;
grq.y = 200;
addChild(grq);
time = new Timer(0);
time.addEventListener(TimerEvent.TIMER, timerHandler);
time.start();
tran = song.soundTransform;
tran.volume = 2;
song.soundTransform = tran;
iit = 0;
timeq = new Timer(0);
timeq.addEventListener(TimerEvent.TIMER, timerHandlerq);
timeq.start();
return;
}
public function soundCompleteHandler(param1:Event) : void {
var _loc_2:SoundChannel;
_loc_2 = s.play();
return;
}
public function completeHandlerq(param1:Event) : void {
param1.target.play();
return;
}
public function completeHandler(param1:Event) : void {
param1.target.play();
return;
}
public function timerHandlerq(param1:TimerEvent) : void {
var _loc_2:Number;
var _loc_3:uint;
var _loc_4:Number;
var _loc_5:Number;
var _loc_6:Number;
var _loc_7:Number;
SoundMixer.computeSpectrum(baq, false, 0);
grq.graphics.clear();
grq.graphics.lineStyle(0, 255);
grq.graphics.beginFill(255);
grq.graphics.moveTo(0, 0);
_loc_3 = 2;
_loc_5 = 0;
_loc_2 = 0;
while (_loc_2 < 512){
// label
_loc_6 = 0;
_loc_6 = _loc_6 + baq.readFloat();
_loc_7 = _loc_6 * 50;
grq.graphics.drawRect(_loc_2 / 2 - 128, 0, _loc_3 / 2, -_loc_7);
if (_loc_2 > 256){
_loc_5 = _loc_5 + _loc_6;
}
_loc_2 = _loc_2 + _loc_3;
}
return;
}
}
}
The decompiler really makes the code look funny! Thats certainlly not how I program, but it looks like it has everything there! Thanks snake :D
Btw, It would be a nice exercise for me to make more of these. If you have suggestions on how I should make the spectrum look, you should post them and I might try to make it. Or you could even provide graphics so like a dancing guy or something.
is there supposed to be an image? all i hear is a goofy song
Quote from: GodClock;1510424is there supposed to be an image? all i hear is a goofy song
i think he changed it, there was a bouncy little wave thign that went to the music
Quote from: GodClock;1510424is there supposed to be an image? all i hear is a goofy song
Maybe upgrade flash player? Did you try to refresh?
Quote from: Joey;1510425i think he changed it, there was a bouncy little wave thign that went to the music
Naw, didn't change it.
Very cool spectrumizer. I like the spinning red circle around the blue wavy thing.
Make a rainbowy spectrum of the song in my signature. That'd be neat :D
Or Smell Yo Dick.
It's nice and all, but will you ever teach/explain how you do these things, or will you leave those who are willing to learn in the dark while you extend to heights unimaginable?
Quote from: RomanClock;1510423Btw, It would be a nice exercise for me to make more of these. If you have suggestions on how I should make the spectrum look, you should post them and I might try to make it. Or you could even provide graphics so like a dancing guy or something.
How about an eyeball, like the pupil pulses based on volume and like blood veins and shit pulse based on trebble/bass.
Maybe even have something corresponding with a change of iris color.
Quote from: SockpuppetClock;1510475It's nice and all, but will you ever teach/explain how you do these things, or will you leave those who are willing to learn in the dark while you extend to heights unimaginable?
yeah, bring back the actionscript academy!!
Quote from: SockpuppetClock;1510475It's nice and all, but will you ever teach/explain how you do these things, or will you leave those who are willing to learn in the dark while you extend to heights unimaginable?
Well, seeing this is almost the only thing I know in AS3, I shouldn't suppose I know enough to teach it that well...
But yea, I should do an ASA, though I was disappointed in the turnout last time, and that was about sound management in AS3 (loading sound form the library, play/stop/pause, position slider, volume slider, pan slider) which is what I thought people would be interested in. It would also be difficult for me to get into more advanced types of AS since most clocks still have trouble on some of the easier aspects.
Maybe suggest a good topic to talk about?
(https://clockcrew.net/talk/proxy.php?request=http%3A%2F%2Fimg.dailymail.co.uk%2Fi%2Fpix%2F2007%2F08_04%2FCurlBeardMOS0109_468x387.jpg&hash=3fd450d12d03219b2e8a4dcaf3aefca573647d3e)
Oh and sock puppet, if you want to learn more about AS you can just get on AIM and ask too. That's probably the best way.
(https://clockcrew.net/talk/proxy.php?request=http%3A%2F%2Fmypetjawa.mu.nu%2Farchives%2Fhidininbeard.jpg&hash=70d9e302f1f2720f4d2669958aa68c8ff7a42e99)
It would be neat if you tried making some other effects with it. Maybe instead of having the spectrum thing in a line, you could make it into a ring with polar coordinates.If you did that and had it change the color constantly, and only clear the graphics every couple of seconds, It would probably look cool. I don't know how fast it would run, though.
Oh boy! Tomfoolery spectrums are what all true warriors strive for!!