From c6d5413a24ebd1319bc8691e8a6f01dfbeba2711 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Mon, 31 Jul 2023 12:28:20 +0200 Subject: [PATCH] add reference --- .../gno.land/p/demo/audio/biquad/biquad.gno | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/gno.land/p/demo/audio/biquad/biquad.gno b/examples/gno.land/p/demo/audio/biquad/biquad.gno index 221e07c3bb4..dbbe148c0d7 100644 --- a/examples/gno.land/p/demo/audio/biquad/biquad.gno +++ b/examples/gno.land/p/demo/audio/biquad/biquad.gno @@ -12,14 +12,19 @@ type Filter struct { x1_f, x2_f, y1_f, y2_f float64 } -// New provides a new biquad +// New provides a new biquad according to the equation for a first-order +// biquad. The algorithm follows the equations in this: https://www.ti.com/lit/pdf/slaa447 // Inputs: -// fc: filter cutoff -// fs: sample rate -// q: resonance coefficient -// db: shelf decibels (strength) -// filterType: string that specifies the type of filter (currently only 'highpass' or 'lowpass') -// Outputs: a filter object +// +// fc: filter cutoff +// fs: sample rate +// q: resonance coefficient +// db: shelf decibels (strength) +// filterType: string that specifies the type of filter (currently only 'highpass' or 'lowpass') +// +// Outputs: +// +// a filter object func New(fc float64, fs float64, q float64, db float64, filterType string) *Filter { w0 := 2 * math.Pi * (fc / fs) cosW := math.Cos(w0)