Implements Step Audio EditX edit tag support for classic ChatterBox SRT following the batch processing pattern. Modified both chatterbox_srt_node.py and multilingual_engine.py to support edit tag extraction and batch processing.
Key changes:
- Modified multilingual_engine.py to extract edit tags per segment and add edit_tags field to AudioSegmentResult
- Implemented pause-first splitting when both pause and edit tags present to preserve pauses during editing
- Added batch edit processing infrastructure to collect all edit segments across subtitles
- Added segment_position tracking to properly reconstruct mixed edited/non-edited segments
- Fixed storage logic to prevent overwriting segment_audio_parts list with wav tensor
- Supports all processing paths: parameter_switching, multilingual/multicharacter, and simple
Follows SRT_Edit_Tag_Batch_Processing_Pattern.md - edit engine loads once for all segments instead of per-subtitle.
- Updated character parser regex to exclude standalone [it]/[italian] tags while preserving [it:]/[italian:] syntax
- Added apply_italian_prefix_if_needed() method for automatic [it] prefix application when Italian language is detected
- Extended character parser with split_by_character_with_language_and_explicit_flag() to preserve explicit language flags
- Updated ChatterBox TTS and SRT nodes to use new parser method with automatic Italian prefix handling
- Fixed timing report text to show processed segments instead of raw input with character tags
- Added console debug prints to show final text sent to TTS models for verification
Italian ChatterBox model now correctly receives [it] prefix for Italian text when:
- User explicitly uses [it:Alice] or [italian:Bob] character syntax
- User uses [it:] or [italian:] language switching syntax
- Character is mapped to Italian in alias system
- Does NOT apply prefix when just using Italian model globally (preserves bilingual capability)
When text contains pause tags, use internal pause processor caching which
caches individual text segments separately from pause timing. This ensures
changing pause duration doesn't invalidate cache for text content.
- Detect pause tags in multilingual engine and enable pause processing
- Route pause tag segments to internal caching in adapter
- Route non-pause segments to external caching as before
When multilingual engine detected a model was 'already loaded', it only updated
state variables but didn't switch self.tts_model to the correct cached model
instance. This caused German text to be generated with English model despite
logs showing German model was active.
Fixed by calling load_tts_model which will reuse cached model but properly
set self.tts_model to the correct language model instance.
The multilingual engine was loading the correct language model (e.g. German for [de:] tags)
but the adapter was still receiving the original default model language (English) in
parameters, causing German text to be generated with English model.
Fixed by updating current_language in params to match the actual loaded model before
calling the adapter, ensuring language tags use the correct model.
Language-only tags like [de:] were still using resolved character alias
'david_attenborough cc3' instead of 'narrator' for cache keys. Fixed by
passing 'narrator' as character parameter to engine adapter when
original_character was 'narrator' (language-only tag).
MAJOR FIXES:
- Fix character alias system overriding user voice selection for language-only tags
- Fix multilingual engine loading wrong tokenizer (English) for all languages
- Fix subtitle processing using wrong model after multilingual segment processing
- Preserve original character info to detect language-only tags vs explicit character tags
TECHNICAL DETAILS:
- Add original_character field to CharacterSegment to track pre-alias resolution names
- Fix multilingual engine to load correct language model first (not default English)
- Add model restoration logic after multilingual processing in traditional SRT
- Improve voice selection messages to show when using main voice vs character voice
- Fix cache coverage method to handle new 5-tuple segment data format
This resolves the regression where German/Norwegian segments sounded English
despite logs showing correct models loading. The issue was the multilingual engine
loading English tokenizer first, then caching it for all subsequent languages.
- Add current_model_name to Traditional SRT for multilingual engine compatibility
- Prioritize main narrator voice over character aliases for language-only tags
- Multilingual engine now detects already loaded models to prevent duplicates
- Add comprehensive cache checking before model loading decisions
- Skip model loading entirely when all language group segments are cached
- Use consistent model names in cache keys for reliable cache hits
- Track cache status properly across segment processing
- Implement early cache detection to prevent redundant model loading
- Make cached runs nearly instant by eliminating model loading overhead
- Implement generic local-first fallback utility for all TTS engines
- Fix ChatterBox and F5-TTS duplicate model loading during language fallback
- Add F5-TTS language grouping to load models once per language group
- Fix pt-br language mapping support in language mapper
- Add model tracking to prevent redundant loading in multilingual engine
- Optimize SRT nodes to use unified language-grouped processing
This ensures efficient model loading with proper local model reuse,
eliminating unnecessary downloads and duplicate model loading for
low-VRAM scenarios while maintaining full language support.
- Fix multilingual engine to check if segments are actually cached before loading models
- Replace stubbed _analyze_cache_coverage with real cache checking logic
- Skip model loading entirely when all segments in language group are cached
- Prevents unnecessary model reloading when only timing parameters change
- Should dramatically improve performance for cached SRT generations
- Addresses issue where models loaded even when audio was cached