March 2010
Archive for

Tomorrow is April Fools’ Day and I thought, “This year, Imma gonna do-a sumptin!”  Who am I going to prank?  Battle of the Bits of course!  I don’t think those noobs even know I have this blog.  :/

So… to get started…  we need to detect that it is indeed April 1st, the day of April Fools’.  This can be done with some simple javascript —

  1. var today = new Date();
  2. if (today.getMonth()+‘.’+today.getDate()==‘3.1′)  {
  3. /*  put your pranks in HERE!!  :D  */
  4. }

At first glance this looks screwy. We create a Date() object and get today’s month and day. But April 1st != 3.1 – it should equal 4.1 right? Silly javascript! Month values are stored [0..11] instead of one through twelve. I thought maybe the day would be messed up too as it is stored [0..31] but it works correctly. I tested this code by setting my operating systems clock ahead to 4/1. The neat thing about using javascript for the date check is that it uses the visitors’ system clock rather than the servers.

Let’s add a prank : Sound

And for my first prank I will add a sound to every link click. This sound happens to be my own voice exclaiming *KLINK*. Here I add some jQuery, using the .live() method on all anchor tags.

  1. $(document).ready(function(){
  2. $(‘a’).live(‘click’,
  3. function(event) {
  4. event.preventDefault();
  5. $(‘#footer’).before(‘<embed src="/klink.wav" hidden="true" autostart="true"/>’);
  6. if (!$(this).hasClass(‘updateAjaxContent’)&amp;&amp;!$(this).hasClass(’speakerPopout’))
  7. window.setTimeout(‘window.location="’+$(this).attr(‘href’)+‘"’,500);
  8. }
  9. );
  10. });

This code is placed inside the date check so it will only run on April Foools’ Day. First, we prevent the default event from the click. Then we insert a hidden <embed> tag that autoplays our sound.  The visitor’s browser should know what to do, automajikally throwing a Windows Media or Quicktime player into the page depending on browser settings.  If you don’t have a #footer, make sure to change that to a place that exists on your page.  Finally, I run a check on the link’s classes to make sure they don’t already have javascript functionality.  If they do, the sound just plays.  If they don’t, we give the browser a half second to play the sound and then move on to the next page.

Another prank : Color

Want to really confuse your visitors? Let’s shift the colors of your layout randomly! Once again I use some jQuery, embed the following code inside the $(document).ready() which is inside the date check.

  1. function dec2hex(a) {
  2.       a = parseInt(a).toString(16);
  3.       return a.length&lt;2?"0"+a:a;
  4.     }
  5.  
  6.     var swatch, r, g, b, color;
  7.  
  8.     randomColor();
  9.  
  10.     function randomColor()  {
  11.       swatch = Math.floor(Math.random()*5);
  12.       r = dec2hex(Math.floor(Math.random()*256));
  13.       g = dec2hex(Math.floor(Math.random()*256));
  14.       b = dec2hex(Math.floor(Math.random()*256));
  15.       color = ‘#’+r+g+b;
  16.       switch (swatch) {
  17.         case 0:
  18.           $(‘boxLink:hover’).css(‘background-color’,color);
  19.           $(‘body’).animate({color:color},2500,function(){randomColor()});
  20.           break;
  21.         case 1:
  22.           $(‘.boxLink’).css(‘color’,color);
  23.           $(‘a’).animate({color:color},12500,function(){randomColor()});
  24.           break;
  25.         case 2:
  26.           $(‘.logo1′).animate({color:color},3500,function(){randomColor()});
  27.           break;
  28.         case 3:
  29.           $(‘.logo0′).animate({color:color},1500,function(){randomColor()});
  30.           break;
  31.         case 4:
  32.           $(‘html’).css(‘background-color’,color);
  33.           $(‘body’).css(‘background-color’,color);
  34.           $(‘boxLink:hover’).animate({color:color},4500,function(){randomColor()});
  35.           break;
  36.       }
  37.     }

I removed over half of the elements I am affecting with the randomly generated colors to make this easier to understand. The variable ’swatch’ is used to identify which color is being affected in the layout. dec2hex() helps convert the random values to a hex color value. I’m using the callback feature of the .animate() function to keep the colors fluxing (though I don’t see any color fading to another color {a bug?!?!}). If you call randomColor() directly from inside itself the browser will hang or you’ll get a recursive script error.

View Demo Here

Get Source Here

Tested in Firefox and Chrome. I saved a BotB render page to share the effects. I only replaced the links in the main menu and disabled the April Fools check in jqueryAprilFools.js so you can see the prank in actions always!

I hope somebody learns something. :D

Candy Coated Delirious Wallpaper Monday, March 29th, 2010

Well, hell. I have an ear infection. I’m dizzy and I don’t like loud noises. Unlike me, really. So… let’s take a two hour nap, drink a lot of fluids, and chill out to a photoshop text effect tutorial.

Candy Coated, a delicious treat! While I don’t have the typeface Sugar Pie, I do have Bello. So let’s get to this! I want everyone to see what an ear ache my eye can do for desktop wallpapers. :D

…and I’m pleased with the results. Until it gets underneath my desktop icons. VERTIGO AYEEEEE!!! We’ll try something else…

Don’t be daft. Click to see the full glory. On both of them?!?! zOMG!

The VIC-20 and Twitter Saturday, March 20th, 2010

On Feb 20th, 2010, Syd Bolton and friends presented the first tweet posted by a Commodore VIC-20 at the Personal Computer Mueseum in Ontario, Canada.  The video of this event isn’t the greatest, the VIC’s screen absolutely illegible and the enthusiasm overtly academic.  But, for a moment in time, some level of history was made.  Not only did computer technology separated by generations of innovation effectively communicate, but a non-profit, niche museum had it’s 15 minutes of fame on a national scale.

I don’t know whats more amazing : the 30 year old VIC-20 on television or a newscaster that can program his sign-off on a Commodore 64!

Syd Bolton’s sentimental decision for this particular machine, as it was his first machine, caught me up in my own romances.  It was my first machine too.  Tweeting had already been done on the Commdore 64, and the VIC offers a new height of challenge with it’s limited 3.5kb RAM for loading/writing software.  Bolton even choose a datasette peripheral device for storing the tweeting program.  But how does it really work?



top tweetVer running on VIC-20
bottom tweetVer source code is written in BASIC
Photos by Leif Bloomquist

The VIC-20 is connected to a modern PC via it’s RS-232 interface.  With this port and protocol, a Commodore computer is capable of communicating with various hardware including hobbyist electronics.  The modern PC software is titled tweetVer and is supposed to be public soon and supporting multiple 8bit platforms.  TweetVer, I am guessing, is the hub between 8bit and interwebs, doing the actual posting.  This is where some controversy begins, the VIC-20 vicariously attached to the web rather than directly.

The application of the experiment is a complete novelty, but the experiment itself is an awesome example of geek gadgetry and exploration.  At first glance,  I was hoping the VIC-20 negotiated an ISP and was directly utilizing the Twitter API.  From what I gathered through some comments, this method is actually possible, though you’d have to find a person willing to waste hours upon hours developing a complete novelty.

Some net trolls have garnered this epic event as nothing more than a publicity stunt.  It doesn’t help matters when a self-proclaimed VIC-20 lover poops out a generic press release for their first post on a community forum. But taking a cynical approach against a non-profit computer museum falls daft. The ends, exposing the masses to an antique machine stull usabel today, justifies the means.

All in all, afterall,  it is a nifty idea.

The LSDJ manual comes with an example for the pulse wave kick drum. My variation is on the right. I often use F1 on the volume envelope for a quick kick but if I want a long boom I use F3 to F6.  I keep the sweep envelope the same (and remember this sweep effect only works on the PU1 channel).  C-5 seems to be a happy trigger for the kick’s sweep.

But reserving a pulse channel for the kick can be restrictive to your harmonies.  Sure, you can fit notes between the kicks but sometimes that just won’t do. Let’s explore some more!

The wave channel features built-in sample banks known as ‘kits’.  You can use two kits simultaneously and they come out software mixed. For the most part, the samples have shite quality and I prefer to use this channel for a growly synth bass. For kicks, try doubling the 808 kick and the 909 or Linndrum kicks. Having the bass line play in between the kicks can make for funky syncopations!

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

lsdj kit n synth groove.mp3

Googling the net, I stumbled upon an old 8bc thread where Ikuma explained his method for synthesizing a kick drum (pictured below). Personally, I had a hard time getting it loud enough and keeping it bassy. If you want to use this method you should compensate the volume in the rest of your instruments.  I tried triggering this with all the octaves and C-8 seemed to have the most punch.

Last, but not least, the noise channel.  I played around a lot with this but I’m thinking there might be a better way (either that or the NES’s 2A03 is superior in my ears).  C-3 seems to be the best pitch but, again, the kick sounds rather flat, kind of quiet and lacking punch.  If you try out C-5 with this same instrument LSDJ plays back a textured snare-like sound which, incidentally, is a bit louder.  So I tried layering the noise and wave kicks and it seemed to work for volume compensation. With this particular ‘combination method’ we have freed up our two pulse channels but used up the two remaining.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

lsdj kick samples.mp3

Pulse bent bass drum kick wins out in my book but that won’t keep me from trying new things!

Spring Forward Sunday, March 14th, 2010

I took this photo but I didn't remove the snow! :o

Birds and bees outside!??!  The clock in my minivan displays the correct time now?!?!  I lost an hour of sleep!??!?  HOLY BAJEEEZUS!

Our Hero Sunday, March 7th, 2010

I got out of bed at 2pm; in the midst of great grogginess I checked Battle of the Bits for any activity and was heroically surprised!  Strobe, a venerable BotBr, effortlessly coagulated a victoriously stunning viral video with a photo of myself from, liek, 6 years ago.  I both laughed and scoffed like a junior high hermaphrodite at such the glorious wakeup surprise!

Watch it / Make your own here.