Skip to content
Browse files

expose the server parameters to scripts, update voice example using s…

…erver params
  • Loading branch information...
1 parent f502078 commit a992351e9ebe79516428c04f8a68e2e0b6fc78f7 @substack committed Sep 22, 2012
Showing with 11 additions and 1 deletion.
  1. +3 −1 example/voice.js
  2. +8 −0 server.js
View
4 example/voice.js
@@ -5,8 +5,10 @@ var c = new Voice().octave(4);
var m = new Voice().octave(4).harmonic(3);
var e = new Env(0, 0.3, 0, 4);
+var baudio = require('baudio');
+
return function (t, i) {
- var ii = Math.floor(i % 8000 * (44100 / 8000));
+ var ii = Math.floor(i % baudio.rate * (44100 / baudio.rate));
c.t = ii;
e.t = ii;
return c.pitch(m.sample() * 48).sample()
View
8 server.js
@@ -27,6 +27,14 @@ var clone = require('clone');
var context = deepFreeze(clone({
Buffer : Buffer,
require : function (pkg) {
+ if (pkg === 'baudio') {
+ return {
+ rate : b.rate,
+ size : b.size,
+ channels : b.channels
+ }
+ }
+
var s = require.resolve(pkg);
var cwd = process.cwd() + '/';
if (s.slice(0, cwd.length) !== cwd) {

0 comments on commit a992351

Please sign in to comment.
Something went wrong with that request. Please try again.