leapjs-plugins icon indicating copy to clipboard operation
leapjs-plugins copied to clipboard

Filtering plugin/out of the box

Open pehrlich opened this issue 10 years ago • 0 comments

cc @nashira @paulmand3l

function LowPassFilter(cutoff) {
    var accumulator = 0;

    this.setCutoff = function (value) {
      cutoff = value;
    };

    this.sample = function(sample) {
      accumulator += (sample - accumulator) * cutoff;
      return accumulator;
    }
  }

pehrlich avatar Mar 13 '14 23:03 pehrlich