Skip to content

Commit

Permalink
add reference
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Jul 31, 2023
1 parent ba2fd7d commit c6d5413
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions examples/gno.land/p/demo/audio/biquad/biquad.gno
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c6d5413

Please sign in to comment.