@audio/stft 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -3
- package/util.js +4 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/stft",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Canonical STFT — batch / stream / analyse with normalized Hann OLA; stream ≡ batch under any chunking",
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"util.js"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"fourier-transform": "^2.3.0"
|
|
18
|
+
"fourier-transform": "^2.3.0",
|
|
19
|
+
"@audio/window": "^1.0.2"
|
|
19
20
|
},
|
|
20
21
|
"keywords": [
|
|
21
22
|
"audio",
|
|
@@ -46,5 +47,6 @@
|
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"tst": "^9.4.0"
|
|
49
|
-
}
|
|
50
|
+
},
|
|
51
|
+
"funding": "https://github.com/sponsors/audiojs"
|
|
50
52
|
}
|
package/util.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// Internal — Hann window + stream ring buffers + OLA normalization.
|
|
2
|
-
|
|
1
|
+
// Internal — Hann window (via @audio/window) + stream ring buffers + OLA normalization.
|
|
2
|
+
|
|
3
|
+
import window from '@audio/window'
|
|
3
4
|
|
|
4
5
|
export const PI2 = Math.PI * 2
|
|
5
6
|
|
|
@@ -8,8 +9,7 @@ let _hannCache = new Map()
|
|
|
8
9
|
export function hannWindow(N) {
|
|
9
10
|
let w = _hannCache.get(N)
|
|
10
11
|
if (w) return w
|
|
11
|
-
w =
|
|
12
|
-
for (let i = 0; i < N; i++) w[i] = 0.5 * (1 - Math.cos(PI2 * i / N))
|
|
12
|
+
w = window('hann', N, { periodic: true })
|
|
13
13
|
_hannCache.set(N, w)
|
|
14
14
|
return w
|
|
15
15
|
}
|