@audio/denoise-core 0.1.0 → 0.1.1
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 +1 -1
- package/stft.js +1 -0
- package/util.js +5 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audio/denoise-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Shared restoration primitives — STFT (batch/stream/analyse), noise estimation (min-stats, IMCRA), VAD, AR modeling, quality metrics",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
package/stft.js
CHANGED
package/util.js
CHANGED
|
@@ -120,7 +120,7 @@ export function makeStreamBufs(N, nf = 0) {
|
|
|
120
120
|
N, nf,
|
|
121
121
|
ib: new Float32Array(N * 4), il: 0,
|
|
122
122
|
ob: new Float32Array(N * 8), nb: new Float32Array(N * 8),
|
|
123
|
-
pos: 0, oread: 0
|
|
123
|
+
pos: 0, oread: 0, hi: 0
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -156,9 +156,11 @@ export function take(st, upTo) {
|
|
|
156
156
|
}
|
|
157
157
|
st.oread += len
|
|
158
158
|
if (st.oread > st.N * 8) {
|
|
159
|
+
// shift left; zero only past the high-water mark — frames extend N−hop beyond
|
|
160
|
+
// pos, so zeroing from pos would erase the last frame's partial overlap-add tail
|
|
159
161
|
st.ob.copyWithin(0, st.oread); st.nb.copyWithin(0, st.oread)
|
|
160
|
-
st.pos -= st.oread; st.oread = 0
|
|
161
|
-
st.ob.fill(0, st.
|
|
162
|
+
st.pos -= st.oread; st.hi = Math.max(0, st.hi - st.oread); st.oread = 0
|
|
163
|
+
st.ob.fill(0, st.hi); st.nb.fill(0, st.hi)
|
|
162
164
|
}
|
|
163
165
|
return out
|
|
164
166
|
}
|