Repository navigation
Commit db658e5
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 107cd1b commit db658e5
2 files changed
Lines changed: 77 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
417 | 417 | | |
418 | 418 | | |
419 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
420 | 429 | | |
421 | 430 | | |
422 | 431 | | |
| |||
524 | 533 | | |
525 | 534 | | |
526 | 535 | | |
527 | | - | |
| 536 | + | |
528 | 537 | | |
529 | 538 | | |
530 | 539 | | |
| |||
603 | 612 | | |
604 | 613 | | |
605 | 614 | | |
606 | | - | |
| 615 | + | |
607 | 616 | | |
608 | 617 | | |
609 | 618 | | |
| |||
617 | 626 | | |
618 | 627 | | |
619 | 628 | | |
620 | | - | |
| 629 | + | |
621 | 630 | | |
622 | 631 | | |
623 | 632 | | |
| |||
631 | 640 | | |
632 | 641 | | |
633 | 642 | | |
634 | | - | |
| 643 | + | |
635 | 644 | | |
636 | 645 | | |
637 | 646 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
300 | 300 | | |
301 | 301 | | |
302 | 302 | | |
303 | | - | |
304 | 303 | | |
305 | 304 | | |
306 | 305 | | |
| |||
418 | 417 | | |
419 | 418 | | |
420 | 419 | | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
421 | 484 | | |
422 | 485 | | |
423 | 486 | | |
| |||
0 commit comments