Skip to content

Trim trailing frames in offline encode path#5

Open
artuskg wants to merge 1 commit into
awni:mainfrom
artuskg:codex/awni-fix3-encode-tail-trim
Open

Trim trailing frames in offline encode path#5
artuskg wants to merge 1 commit into
awni:mainfrom
artuskg:codex/awni-fix3-encode-tail-trim

Conversation

@artuskg
Copy link
Copy Markdown

@artuskg artuskg commented Feb 9, 2026

Bug fix: offline encode() should trim from tail, not head

Problem

In offline encode():

  • odd mel length trimmed with mel[:, 1:]
  • non-divisible downsample remainder trimmed with x[remainder:]

Both drop leading frames.

Resolution

  • Trim trailing frame for odd mel length: mel = mel[:, :-1]
  • Trim trailing remainder before downsample reshape: x = x[:-remainder]

Why this helps

This preserves earliest alignment and avoids forward-shifting the encoded sequence relative to streaming/incremental behavior.

Regression test

  • tests/test_bugfix_encode_trim_optional.py::test_encode_trims_trailing_frames_not_leading_frames

How to run

VOXMLX_ENABLE_MLX_RUNTIME_TESTS=1 python3 -m unittest -v tests.test_bugfix_encode_trim_optional

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant