sampleRate: samples per second cutoffFreq: oscillations per second
(sampleRate float32, cutoffFreq float32)
| 26 | // sampleRate: samples per second |
| 27 | // cutoffFreq: oscillations per second |
| 28 | func LowPassFilter(sampleRate float32, cutoffFreq float32) Filter { |
| 29 | c := sampleRate / math.Pi / cutoffFreq |
| 30 | a0i := 1 / (1 + c) |
| 31 | return &FirstOrderFilter{ |
| 32 | B0: a0i, |
| 33 | B1: a0i, |
| 34 | A1: (1 - c) * a0i, |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | func HighPassFilter(sampleRate float32, cutoffFreq float32) Filter { |
| 39 | c := sampleRate / math.Pi / cutoffFreq |
no outgoing calls
no test coverage detected
searching dependent graphs…