Review feedback on the preprocessor:
1. ``trim_top_db=30`` was labelled "conservative" in the docstring but is
actually *more* aggressive than librosa's default of 60. Normal
speech dynamic range sits around 30 dB, so 30 dB would eat quiet
trailing syllables and soft consonants. Raise the default to 40 dB —
below normal speech dynamic range but still catching obvious edge
silence — and fix the docstring.
2. Unconditional 100 ms edge padding ran even when ``librosa.effects.trim``
removed nothing. For a well-recorded 29.9 s upload that path would
push the waveform past the 30 s ceiling and trigger a spurious "too
long" rejection. Only pad when trimming actually shortened the
audio, and cap the pad so the output never exceeds the input length.
Adds a regression test for the net-neutral length behaviour.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Uploaded/recorded voice samples were rejected outright whenever the peak
exceeded 0.99 ("Audio is clipping (reduce input gain)"). That wasn't
actionable: a recording in the app has no pre-gain control, and an
already-captured file can't be re-taken by the user. The Settings
"Normalize audio" toggle only affects generated TTS output, so users who
enabled it expecting it to help with sample uploads were still blocked.
Replace the hard reject with a small, always-on preprocess step that
runs right after load:
- DC-offset removal
- Conservative edge-silence trim (top_db=30) with 100 ms padding kept
- Peak cap at 0.95 if the input peak exceeds that
Duration and RMS checks now run on the preprocessed waveform, so
samples that were previously rejected for being "hot" are accepted and
stored with safe headroom. True in-waveform clipping artifacts still
can't be repaired — peak scaling only prevents downstream re-clipping
during multi-sample combination and TTS inference.
Adds a unit-test file (previously none existed for audio.py).
Fixes#456.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- Add validation in create_profile() to check for existing names before insert
- Add validation in update_profile() to prevent renaming to duplicate names
- Improve error handling in API endpoints with user-friendly messages
- Add comprehensive test suite for duplicate name validation
- Update CHANGELOG.md with fix details
This fix prevents database constraint violations and provides clear
error messages when users attempt to create or update profiles with
names that already exist in the database.
20 tests covering:
- All 6 default local origins are allowed
- Arbitrary external origins are blocked
- Preflight (OPTIONS) requests respect the allowlist
- VOICEBOX_CORS_ORIGINS env var extends the allowlist
- Edge cases: empty env, whitespace trimming, trailing commas
Tests use a minimal FastAPI app mirroring the real CORS config,
so they run without ML dependencies (torch, numpy, etc.).
- Rearranged imports for consistency in useModelDownloadToast hook.
- Improved logging in useModelDownloadToast for better debugging during download events.
- Updated progress calculation to handle cases where progress exceeds 100%.
- Enhanced toast notifications to reflect download completion and error states.
- Introduced throttling in ProgressManager to optimize SSE updates and prevent overwhelming clients.
- Added new test scripts for monitoring SSE events during model downloads, ensuring accurate progress reporting.
- Introduced a new directory for manual test scripts aimed at debugging and validating backend functionality.
- Added README.md detailing the purpose and usage of various test scripts, including tests for TTS generation, model downloads, and progress tracking.
- Included an __init__.py file to define the test suite structure and provide context for the tests.
- Introduced methods to check if models are cached locally in MLX and PyTorch backends.
- Enhanced progress tracking during model loading to filter out non-download progress when models are cached.
- Updated HFProgressTracker to conditionally report progress based on download status.
- Added test scripts for monitoring SSE events during model downloads and verifying progress tracking functionality.
- Improved overall error handling and logging for better debugging during model download processes.