When gen_text is split into multiple chunks by chunk_text(), each chunk
was generated with the full-sentence fix_duration, producing ~N×target
seconds. Allocate fix_duration across chunks by UTF-8 byte weight
(compensating for cross-fade overlap) so each chunk only generates its
proportional share. fix_duration=None and single-chunk paths unchanged.
process_batch is a generator function, so submitting it to a thread pool
only creates a generator object without running any inference code.
all actual work happens sequentially in the main thread when next() is called.
also removes the always-true 'if result:' guard on a generator object.
Previously, speech_edit.py worked in wav domain (inserting zeros into the waveform before computing mel spectrogram), which caused boundary artifacts when mel spectrogram windows straddled zeros and real audio.
This commit refactors the approach to work in mel domain:
- Compute mel spectrogram on the clean original audio first
- Insert zero frames in mel domain instead of zero samples in wav domain
- Use frame-level granularity throughout for consistency
Benefits:
- Eliminates boundary artifacts
- More consistent behavior regardless of small float variations in input times
- Cleaner edit boundaries
Changes to speech_edit.py (lines 148-220):
- Convert audio to mel using model.mel_spec() before editing
- Build mel_cond by concatenating original mel frames + zero frames
- Calculate all time-based values at frame level first, then convert to samples
- Pass mel_cond directly to model.sample() instead of raw audio
Modified it so that when you upload a text file, the text of that file will show in the text input window. Also made the text file upload window show up BELOW the text input display window.