1.2.1 • Published 7 months ago

1eurofilter v1.2.1

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
7 months ago

NPM Version npm downloads

1€ filter typescript version

Provides a typescript implementation for the 1€ filter.

Install

npm install 1eurofilter

Minimal example

import {OneEuroFilter} from '1eurofilter'

let frequency = 120; // Hz
let mincutoff = 1.0; // Hz
let beta = 0.1;      
let dcutoff = 1.0; 

let f = new OneEuroFilter(frequency, mincutoff, beta, dcutoff);

let noisyvalue = 2.1;
let timestamp = 0.0; // in seconds

let filtered = f.filter(noisyvalue, timestamp);

Doc

constructor

new OneEuroFilter(freq, mincutoff, beta, dcutoff)

Constructs a 1 euro filter.

Parameters

NameTypeDefault valueDescription
freqnumberundefinedAn estimate of the frequency in Hz of the signal (> 0), if timestamps are not available.
mincutoffnumber1.0Min cutoff frequency in Hz (> 0). Lower values allow to remove more jitter.
betanumber0.0Parameter to reduce latency (> 0).
dcutoffnumber1.0Used to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing.

filter

filter(value, timestamp): number

Returns the filtered value.

Parameters

NameTypeDescription
valuenumberNoisy value to filter
timestampnumber(optional) timestamp in seconds

reset

reset(): void

Resets the internal state of the filter.

setBeta

setBeta(beta): void

Sets the Beta parameter

Parameters

NameTypeDescription
betanumberParameter to reduce latency (> 0).

setDerivateCutoff

setDerivateCutoff(dcutoff): void

Sets the dcutoff parameter

Parameters

NameTypeDescription
dcutoffnumberUsed to filter the derivates. 1 Hz by default. Change this parameter if you know what you are doing.

setFrequency

setFrequency(freq): void

Sets the frequency of the signal

Parameters

NameTypeDescription
freqnumberAn estimate of the frequency in Hz of the signal (> 0), if timestamps are not available.

setMinCutoff

setMinCutoff(mincutoff): void

Sets the filter min cutoff frequency

Parameters

NameTypeDescription
mincutoffnumberMin cutoff frequency in Hz (> 0). Lower values allow to remove more jitter.

setParameters

setParameters(freq, mincutoff, beta): void

Sets the parameters of the 1 euro filter.

Parameters

NameTypeDescription
freqnumberAn estimate of the frequency in Hz of the signal (> 0), if timestamps are not available.
mincutoffnumberMin cutoff frequency in Hz (> 0). Lower values allow to remove more jitter.
betanumberParameter to reduce latency (> 0).

Related publication

DOI

@inproceedings{10.1145/2207676.2208639,
    author = {Casiez, G\'{e}ry and Roussel, Nicolas and Vogel, Daniel},
    title = {1 € Filter: A Simple Speed-Based Low-Pass Filter for Noisy Input in Interactive Systems},
    year = {2012},
    isbn = {9781450310154},
    publisher = {Association for Computing Machinery},
    address = {New York, NY, USA},
    url = {https://doi.org/10.1145/2207676.2208639},
    doi = {10.1145/2207676.2208639},
    pages = {2527–2530},
    numpages = {4},
    keywords = {noise, jitter, lag, precision, filtering, responsiveness, signal},
    location = {Austin, Texas, USA},
    series = {CHI '12}
}
1.2.1

7 months ago

1.2.0

7 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago