Skip to content

Instantly share code, notes, and snippets.

@fand
Created June 4, 2014 02:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fand/7f3dfbdcf33e26c171a7 to your computer and use it in GitHub Desktop.
Save fand/7f3dfbdcf33e26c171a7 to your computer and use it in GitHub Desktop.
CPUSOUND
var spawn = require('child_process').spawn;
var top = spawn('top', ['-b', '-d', '1']);
var buf = '';
top.stdout.on('data', function(data){
buf = data.toString();
});
var baudio = require('baudio');
var b = baudio(function (t, i) {
var idx = i * (i >> 11);
return t * buf[idx % buf.length] % 0xFF;
});
b.play();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment