From 17f7f88fcc9cd481131c722fa8e55309b28f4d05 Mon Sep 17 00:00:00 2001 From: stagas Date: Sun, 9 Nov 2014 12:26:23 +0200 Subject: [PATCH] initial --- index.js | 11 +++++++++++ test.js | 27 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 index.js create mode 100644 test.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..ea910d4 --- /dev/null +++ b/index.js @@ -0,0 +1,11 @@ + +/** + * @module prewarp + * @author stagas + * @org opendsp + * @license mit + */ + +export default function prewarp(f){ + return Math.tan(Math.PI * f / sampleRate); +} diff --git a/test.js b/test.js new file mode 100644 index 0000000..f0ea285 --- /dev/null +++ b/test.js @@ -0,0 +1,27 @@ + +/** + * test + */ + +import debug from 'debug'; +import prewarp from './index'; + +var out = 0; + +var w = prewarp(0); +var a = w / (1 + w); +out += a.toFixed(1)==='0.0'; + +var w = prewarp(sampleRate/4); +var a = w / (1 + w); +out += a.toFixed(1)==='0.5'; + +var w = prewarp(sampleRate/2); +var a = w / (1 + w); +out += a.toFixed(1)==='1.0'; + +debug(3 === out && 'all tests pass'); + +export function dsp(t){ + return 0; +}