Permalink
Browse files

delay sort of working

  • Loading branch information...
1 parent 0e0a2f3 commit ea0bde772a6ddd9453ff63e7182f5bee0a69b4b1 @pgte committed Nov 12, 2011
Showing with 9 additions and 5 deletions.
  1. +0 −1 index.js
  2. +9 −4 lib/maestro.js
View
@@ -29,7 +29,6 @@ function Hoooker (options) {
maestro.start();
self.on('serial::knobs', function(data) {
- console.log(data);
Object.keys(data).forEach(function(key) {
var value = parseInt(data[key], 10);
var fun = KNOB_MAP[parseInt(key, 10)];
View
@@ -8,6 +8,7 @@ var osc = require('./osc');
var PwmFilter = require('../filter/pwm');
var EnvelopeFilter = require('../filter/envelope');
var DistortFilter = require('../filter/distort');
+var DelayFilter = require('../filter/delay');
var out = require('./out');
module.exports = function() {
@@ -22,16 +23,18 @@ module.exports = function() {
var pwmFilter = PwmFilter(1, 0.5);
var envelopeFilter = EnvelopeFilter(3);
var distortFilter = DistortFilter(2);
+ var delayFilter = DelayFilter(6);
var filters = [
- pwmFilter
- , envelopeFilter
+ envelopeFilter
, distortFilter
+ // , pwmFilter
+ , delayFilter
]
function calculateBufferDuration() {
duration = Math.ceil(SAMPLE_FREQ / freq);
durationSecs = duration / SAMPLE_FREQ;
- durationMs = durationSecs * 1000 - 1;
+ durationMs = durationSecs * 1000;
console.log('durationSecs:', durationSecs);
console.log('duration:', duration);
};
@@ -78,7 +81,7 @@ module.exports = function() {
var buf;
if (! playing) { return; }
- setTimeout(cycle, durationMs);
+ setTimeout(cycle, durationMs - 1);
time += duration;
@@ -94,6 +97,8 @@ module.exports = function() {
player.push(out(buf));
+ lastTime = Date.now()
+
// sentDuration += duration;
// console.log('time:', time, ', sentDuration:', sentDuration / 44.100);

0 comments on commit ea0bde7

Please sign in to comment.