MCPcopy Create free account
hub / github.com/fogleman/nes / LowPassFilter

Function LowPassFilter

nes/filter.go:28–36  ·  view source on GitHub ↗

sampleRate: samples per second cutoffFreq: oscillations per second

(sampleRate float32, cutoffFreq float32)

Source from the content-addressed store, hash-verified

26// sampleRate: samples per second
27// cutoffFreq: oscillations per second
28func 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
38func HighPassFilter(sampleRate float32, cutoffFreq float32) Filter {
39 c := sampleRate / math.Pi / cutoffFreq

Callers 1

SetAudioSampleRateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…