-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 17f7f88
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |