Skip to content

Commit

Permalink
feat(dsp): add cos() stateless oscillator
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Dec 17, 2020
1 parent 88edaac commit 276c6b7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/dsp/src/osc/cos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { TAU } from "@thi.ng/math";
import type { StatelessOscillator } from "../api";

export const cos: StatelessOscillator = (phase, freq, amp = 1, dc = 0) =>
dc + amp * Math.cos(phase * freq * TAU);

0 comments on commit 276c6b7

Please sign in to comment.