Repository navigation
Commit 249e8f8
committed
[FIX] ASR: correct reconstruction dim count, blend seam, and RMS window rounding
Three independent fixes in the calibration/reconstruction path:
- maxdims / keep-mask off-by-one in asr_process: maxdims used np.fix
(truncate toward zero) instead of round-half-away, and the keep-mask
index term protected one component too many. The spec converts the
fractional 0.66 factor with round-half-away-from-zero, and its 1-based
(1:C) < (C - maxdims) protects C-maxdims-1 components, so use
int(np.floor(0.66 * nc + 0.5)) and np.arange(nc) < nc - maxdims - 1.
Together these made meegkit under-remove artifact dimensions.
- Raised-cosine blend endpoint in asr_process: np.arange(ns)/ns never
reaches 1, so the block's final sample kept a residual fraction of the
previous reconstruction. Shift the phase to np.arange(1, ns + 1)/ns so
blend[-1] = 1.0 and the last sample equals the new reconstruction.
- RMS window starts in asr_calibrate: the step N*(1-win_overlap) was
rounded before building the window starts, drifting from the correct
positions for a non-integer step (biasing mu/sig/T). Extract a
_rms_window_offsets helper that rounds each start (matching clean_windows).
Adds a regression test for each.1 parent 3721224 commit 249e8f8
2 files changed
Lines changed: 77 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
402 | 411 | | |
403 | 412 | | |
404 | 413 | | |
| |||
499 | 508 | | |
500 | 509 | | |
501 | 510 | | |
502 | | - | |
| 511 | + | |
503 | 512 | | |
504 | 513 | | |
505 | 514 | | |
| |||
573 | 582 | | |
574 | 583 | | |
575 | 584 | | |
576 | | - | |
| 585 | + | |
577 | 586 | | |
578 | 587 | | |
579 | 588 | | |
| |||
587 | 596 | | |
588 | 597 | | |
589 | 598 | | |
590 | | - | |
| 599 | + | |
591 | 600 | | |
592 | 601 | | |
593 | 602 | | |
| |||
601 | 610 | | |
602 | 611 | | |
603 | 612 | | |
604 | | - | |
| 613 | + | |
605 | 614 | | |
606 | 615 | | |
607 | 616 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
258 | 258 | | |
259 | 259 | | |
260 | 260 | | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
261 | 325 | | |
262 | 326 | | |
263 | 327 | | |
| |||
0 commit comments