Created
June 4, 2014 02:52
-
-
Save fand/7f3dfbdcf33e26c171a7 to your computer and use it in GitHub Desktop.
CPUSOUND
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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