UNPKG

@thi.ng/dsp

Version:

Composable signal generators, oscillators, filters, FFT, spectrum, windowing & related DSP utils

6 lines (5 loc) 163 B
import { fract } from "@thi.ng/math/prec"; const tri = (phase, freq, amp = 1, dc = 0) => dc + amp * (Math.abs(fract(phase * freq) * 4 - 2) - 1); export { tri };