diff --git a/packages/dsp/src/osc/cos.ts b/packages/dsp/src/osc/cos.ts new file mode 100644 index 0000000000..3d8b17e81b --- /dev/null +++ b/packages/dsp/src/osc/cos.ts @@ -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);