Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
stagas committed Nov 9, 2014
0 parents commit 17f7f88
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

/**
* @module prewarp
* @author stagas
* @org opendsp
* @license mit
*/

export default function prewarp(f){
return Math.tan(Math.PI * f / sampleRate);
}
27 changes: 27 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 17f7f88

Please sign in to comment.