Zachary Berry

Designer & Developer

Creating a custom node.js module with the Revealing Module pattern

So you want to utilize the revealing module pattern in a custom node.js module? It’s not hard but it wasn’t immediately obvious to me, so here’s how you do it.

Every node.js module is just a simple javascript file that contains a special exports variable. That exports variable is what gets exposed to the class that requires your module.

For example, take a custom module mymodule.js:

exports.animal = 'kitties';

Here’s how you’d use it:

var myModule = require('./mymodule.js');

console.log(myModule.animal); // prints 'kitties'
Continue reading...

Tracking 3D Objects in 2D with three.js

I’ve been playing with the fantastic three.js library lately, and for a project I needed a way to determine where an object in 3D space was on the page in 2D. I’ve gotten something working after reading through articles, documentation and commentary on three.js’ github issues page.

In the example below I have a div (the red circle) that’s being absolutely positioned on top of where I’ve determined the sphere to be.

Continue reading...

Incorporating an iPad into a DAW controlled studio

I’ve been experimenting with various methods to control the iPad via MIDI as well as getting pro-audio out of it, and now I’d like to share my results.

First - this video by tekserv is a good introduction on some of the possibilities to get MIDI working as well as how to get clean audio out, and is worth viewing:

But, what if you wanted to do both MIDI in/out and pro-audio out at the same time? You can - read on as I run through a few options you have, starting simple and going into full DAW integration

Continue reading...

Amazon Cloud Player, now with Keyboard Shortcuts & Growl Notifications!

…Sorta. :) Code is at GitHub! Explanation below:

Andy Lemay made a very useful post on how to use fluid to run Amazon CloudPlayer as its own app. In a nutshell: You can download an excellent application called Fluid to create a desktop version of a webpage - in this case, the newly released Amazon Cloud Player. This worked great, however I was hoping to get keyboard shortcuts and Growl notifications working. Luckily, Fluid has a UserScript API to allow you to write UserScripts (essentially just js files) which can be loaded into the web application.

Now to poke around! Digging into the page and js files in Amazon CloudPlayer revealed a nice API that I figured I could hack into. TextMate’s ‘Reformat Document’ was a huge help here to turn the minimized js files into something human readable.

Continue reading...