-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize to allow separate requires #4
- Loading branch information
Showing
21 changed files
with
210 additions
and
159 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,12 @@ | ||
'use strict' | ||
|
||
function bartlettHann (i,N) { | ||
var inm1 = i/(N-1), | ||
a0 = 0.62, | ||
a1 = 0.48, | ||
a2 = 0.38 | ||
|
||
return a0 - a1 * Math.abs(inm1 - 0.5) - a2 * Math.cos(6.283185307179586*inm1) | ||
} | ||
|
||
module.exports = bartlettHann |
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,7 @@ | ||
'use strict' | ||
|
||
function bartlett (i,N) { | ||
return 1 - Math.abs( 2 * (i - 0.5*(N-1)) / (N-1) ) | ||
} | ||
|
||
module.exports = bartlett |
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,13 @@ | ||
'use strict' | ||
|
||
function blackmanHarris (i,N) { | ||
var a0 = 0.35875, | ||
a1 = 0.48829, | ||
a2 = 0.14128, | ||
a3 = 0.01168, | ||
f = 6.283185307179586*i/(N-1) | ||
|
||
return a0 - a1*Math.cos(f) +a2*Math.cos(2*f) - a3*Math.cos(3*f) | ||
} | ||
|
||
module.exports = blackmanHarris |
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,13 @@ | ||
'use strict' | ||
|
||
function blackmanNuttall (i,N) { | ||
var a0 = 0.3635819, | ||
a1 = 0.4891775, | ||
a2 = 0.1365995, | ||
a3 = 0.0106411, | ||
f = 6.283185307179586*i/(N-1) | ||
|
||
return a0 - a1*Math.cos(f) +a2*Math.cos(2*f) - a3*Math.cos(3*f) | ||
} | ||
|
||
module.exports = blackmanNuttall |
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,12 @@ | ||
'use strict' | ||
|
||
function blackman (i,N) { | ||
var a0 = 0.42, | ||
a1 = 0.5, | ||
a2 = 0.08, | ||
f = 6.283185307179586*i/(N-1) | ||
|
||
return a0 - a1 * Math.cos(f) + a2*Math.cos(2*f) | ||
} | ||
|
||
module.exports = blackman |
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,7 @@ | ||
'use strict' | ||
|
||
function cosine (i,N) { | ||
return Math.sin(3.141592653589793*i/(N-1)) | ||
} | ||
|
||
module.exports = cosine |
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,12 @@ | ||
'use strict' | ||
|
||
function exactBlackman (i,N) { | ||
var a0 = 0.42659, | ||
a1 = 0.49656, | ||
a2 = 0.076849, | ||
f = 6.283185307179586*i/(N-1) | ||
|
||
return a0 - a1 * Math.cos(f) + a2*Math.cos(2*f) | ||
} | ||
|
||
module.exports = exactBlackman |
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,14 @@ | ||
'use strict' | ||
|
||
function flatTop (i,N) { | ||
var a0 = 1, | ||
a1 = 1.93, | ||
a2 = 1.29, | ||
a3 = 0.388, | ||
a4 = 0.028, | ||
f = 6.283185307179586*i/(N-1) | ||
|
||
return a0 - a1*Math.cos(f) +a2*Math.cos(2*f) - a3*Math.cos(3*f) + a4 * Math.cos(4*f) | ||
} | ||
|
||
module.exports = flatTop |
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,10 @@ | ||
'use strict' | ||
|
||
function gaussian (i,N,sigma) { | ||
var nm12 = 0.5*(N-1), | ||
f = (i-nm12)/sigma/nm12 | ||
|
||
return Math.exp(-0.5*f*f) | ||
} | ||
|
||
module.exports = gaussian |
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,7 @@ | ||
'use strict' | ||
|
||
function hamming (i,N) { | ||
return 0.54 - 0.46 * Math.cos(6.283185307179586*i/(N-1)) | ||
} | ||
|
||
module.exports = hamming |
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,7 @@ | ||
'use strict' | ||
|
||
function hann (i,N) { | ||
return 0.5*(1 - Math.cos(6.283185307179586*i/(N-1))) | ||
} | ||
|
||
module.exports = hann |
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
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 @@ | ||
'use strict' | ||
|
||
function sinc (x) { | ||
return x === 0 ? 1 : 0.3183098861837907 * Math.sin(Math.PI*x) / x | ||
} | ||
|
||
function lanczos (i, N) { | ||
return sinc(2*i/(N-1)-1) | ||
} | ||
|
||
module.exports = lanczos |
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,15 @@ | ||
'use strict' | ||
|
||
var TWOPI = Math.PI * 2 | ||
|
||
function nuttall (i,N) { | ||
var a0 = 0.355768, | ||
a1 = 0.487396, | ||
a2 = 0.144232, | ||
a3 = 0.012604, | ||
f = TWOPI*i/(N-1) | ||
|
||
return a0 - a1*Math.cos(f) +a2*Math.cos(2*f) - a3*Math.cos(3*f) | ||
} | ||
|
||
module.exports = nuttall |
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,7 @@ | ||
'use strict' | ||
|
||
function rectangular (i,N) { | ||
return 1 | ||
} | ||
|
||
module.exports = rectangular |
Empty file.
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,7 @@ | ||
'use strict' | ||
|
||
function triangular (i,N) { | ||
return 1 - Math.abs( 2 * (i - 0.5*(N-1)) / N ) | ||
} | ||
|
||
module.exports = triangular |
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,15 @@ | ||
'use strict' | ||
|
||
function tukey (i,N, alpha) { | ||
var anm12 = 0.5*alpha*(N-1) | ||
|
||
if( i <= anm12 ) { | ||
return 0.5*(1+Math.cos(Math.PI*(i/anm12 - 1))) | ||
} else if ( i < (N-1)*(1-0.5*alpha) ) { | ||
return 1 | ||
} else { | ||
return 0.5*(1+Math.cos(Math.PI*(i/anm12 - 2/alpha + 1))) | ||
} | ||
} | ||
|
||
module.exports = tukey |
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,9 @@ | ||
'use strict' | ||
|
||
function welch (i,N) { | ||
var nm12 = 0.5*(N-1), | ||
f = (i - nm12)/nm12 | ||
return 1 - f*f | ||
} | ||
|
||
module.exports = welch |
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
Oops, something went wrong.