Skip to content

Instantly share code, notes, and snippets.

View robreuss's full-sized avatar

Rob Reuss robreuss

View GitHub Profile
@kristopherjohnson
kristopherjohnson / LowPassFilterSignal.swift
Last active June 10, 2024 05:30
Simple implementation of low-pass filter
struct LowPassFilterSignal {
/// Current signal value
var value: Double
/// A scaling factor in the range 0.0..<1.0 that determines
/// how resistant the value is to change
let filterFactor: Double
/// Update the value, using filterFactor to attenuate changes
mutating func update(newValue: Double) {