Tuesday, May 19th, 2009
Locking onto beat; More visualizations of music
<>p>"darkimmortal" has created another really nice visualization of music that uses Canvas and SoundManager2 to do its work.Do yourself a favour, and hit play to see the funk

The example uses two canvases, one to do the logic wave work, and then it is copied into the main canvas that you see ctxR.drawImage( ctxL.canvas, 0, 0 );.
Here's some of the fun:
-
-
function render(event){
-
var now = new Date().getTime();
-
ctxL.clearRect( 0, 0, 200, 100 );
-
var cdex = ~~((now/100)%21);
-
var colors = [_calone[cdex], _caltwo[cdex], 'rgb('+~~(24+(_vis||[0,0])[1]/19+34*Math.cos(now/8192+(_vis||[0,0])[0]/92))+','+~~(16+20*Math.cos(2+now/7192+(_vis||[0,0])[1]/71))+','+~~(32+24*Math.cos(4+now/5192+(_vis||[0,0])[0]/87))+')'];
-
for( var j=0; j<colors .length; j++ ){
-
ctxL.beginPath();
-
ctxL.moveTo( 250,50 );
-
ctxL.fillStyle = colors[j];
-
var ii;
-
for( var i=0; i<128; i+=3 ){
-
ii = Math.abs(i-64);
-
// Wave equation from Dynamic Hypnoglow
-
// Optimised and made epic by Darkimmortal
-
ctxL.lineTo( ii*4-32, 32+(64+ii/2)*(.1+.2*Math.cos(j+(now/352)+i/31))+(i&64)*1/(68-ii)+16*Math.sin( (now+(_vis||[0,0])[0]/1337 )/( (788-j*287)%1337 ) - ii*(.07+j/43+(_vis||[0,0])[1]/1973-(_vis||[0,0])[0]/1837) ) );
-
// End of wave equation.
-
}
-
ctxL.closePath();
-
ctxL.fill();
-
}
-
-
ctxR.clearRect( 0, 0, 200, 100 );
-
ctxR.drawImage( ctxL.canvas, 0, 0 );
-
ctxR.globalCompositeOperation = 'lighter';
-
if(_bright){
-
_bright2 ++;
-
}
-
if(_bright2> 3){
-
_bright = false;
-
_bright2=0;
-
}
-
ctxL.globalCompositeOperation = _bright ? 'lighter' : 'copy';
-
-
for( var i=0; i<6; i++ ){
-
ctxL.drawImage(ctxL.canvas, 0, 0, 200>>i, 100>>i, 0, 0, 100>>i, 50>>i)
-
ctxR.drawImage(ctxL.canvas, 0, 0, 100>>i, 50>>i, 0, 0, 200, 100);
-
}
-
_overlay.style.backgroundPosition = ~~((_vis[_axis]/2.5) % 600 ) +'px '+ (_firefox + (_aim> 2800 ? 10 : (_aim <500 ? -10 : 0))) +'px';
-
-
if(_vis[_axis] <_aim){
-
_vis[_axis]+= 20;
-
}
-
if(_vis[_axis]> _aim){
-
_vis[_axis]-= 20;
-
}
-
-
_fpsb ++;
-
if(_fpsc + 1000 <now){
-
_fpsc = now;
-
_fps = _fpsb;
-
_fpsb = 0;
-
}
-
}
-
Related Content:











FYI the visuals are ripped off ( no other words considering the lack of proper credits although I contacted DarkImmortal a few weeks/months ago about that ) from the 20 lines “Dynamic Hypnoglow” effect I wrote in January 2008
Amazing :)
I never thought that this would be possible in the WEB in the near future.
Btw why does it say i should watch it on FF3.5 ? It works fine in Chrome 2
JavaScript is open source by essence but it doesn’t exempt developers from such simple things as IPR and mere courtesy.
uneralnet: I developed the visuals in Opera 9.5 and Firefox 3.0, one year and half ago.
Not crediting the properly gives the Open Web a bad name ;(
Yeah, lets bring the demo scene to JS and Canvas. :) Then it will be a challenge with performance again as back in the old Amiga days.
I knew this looked familiar……
Credits added.
Also lol at the rating
Also credits were there until recently when I decided no one really cared about it.
Did I know it would get posted publicly? No.
Anyway hope there’s no hard feelings :)
Whether it would get posted more publicly than on your 20+ millions hits image hosting service and in blog comments or not is irrelevant. It’s a simple matter of respect.
Anyhow, thanks for making it right.
@p01
great stuff, that is amazing!
D:
Although it is cool, Darkimmortal got it shown on here by moaning in another topic about how it was “better news” than http://ajaxian.com/archives/crap-i-missed-it-doesnt-miss-your-file-upload which I’d say myself was much more interesting to the masses.
Again, lack of respect.
No, everything I do gets ignored.
Also it may be news to you that this has been up for over 3 months.
bitch bitch bitch
LOL
So leasson learned is that “nagging works”, right…?
.
Just kidding ;)
.
I think DarkImmortal deserved the space here. And I also think his works is AWESOME…!
GREAT work!
And respect to Dion for posting about this, it really did deserve the space it was given here … ;)