Commit Graph
45 Commits
Author SHA1 Message Date
diodiogod 2bc4c2a18d Add IndexTTS 2.5 support 2026-08-11 23:08:35 -03:00
diodiogod df3a4cb2cf Blend IndexTTS audio and vector emotions 2026-07-11 01:39:43 -03:00
diodiogod 06003e0b3a Fix IndexTTS emotion and character routing 2026-07-11 01:24:38 -03:00
diodiogod 068c3f1f1e Add IndexTTS-2 inline emotion controls 2026-07-10 23:21:53 -03:00
diodiogod 63ff510768 Fix IndexTTS inline edit tag processing 2026-06-06 14:47:28 -03:00
diodiogod 9054b197b0 Version 4.25.17
Fix IndexTTS-2 compile flag handling and failure reporting

Technical details:
- Normalize legacy boolean workflow inputs so omitted IndexTTS-2 compile flags do not become truthy strings
- Fail fast when IndexTTS-2 torch.compile is enabled on CUDA without Triton installed
- Stop returning silent audio for IndexTTS-2 generation failures and surface real execution errors
- Remove stale IndexTTS-2 Python 3.12 VRAM warnings and noisy QwenEmotion debug logging
- Update IndexTTS-2 QwenEmotion loading to prefer dtype over deprecated torch_dtype
2026-04-14 17:29:42 -03:00
diodiogod 273229976b Version 4.24.7
Fix CosyVoice3 narrator reference and interrupt handling

Implementation details:
- Restore connected opt_narrator resolution in unified text and SRT nodes
- Propagate connected reference text and character names through CosyVoice3 processing
- Add mid-generation interrupt polling for CosyVoice3
- Patch bundled Qwen3-ASR generate loop for reliable ComfyUI interrupts
- Mark vendored Qwen3-ASR interrupt logic as a TTS Audio Suite patch
2026-03-27 22:05:56 -03:00
diodiogod 24466ef7f2 Fix: Add librosa 0.11.0 compatibility fallbacks for removed utilities. Fix unpacking error in index_tts processor. 2026-02-21 19:17:00 -03:00
diodiogod b13ec81872 Version 4.19.1
Add CosyVoice3 <restore> tag support

Technical implementation:
- Add extract_restore_tags_only() function to filter only restore tags
- Integrate EditPostProcessor into CosyVoice processor
- Preserve CosyVoice native paralinguistic tags (<breath>, <laughter>, etc.)
- Apply ChatterBox VC restoration after TTS generation
- Block Step Audio EditX emotion/style/speed/paralinguistic tags
2026-01-28 11:43:23 -03:00
diodiogod c85f93b5c7 Version 4.16.6
Fix CosyVoice3 character voice mode selection

Technical details:
- Clear reference_text when character has audio but no .txt file
- Force cross_lingual mode for characters without text transcripts
- Prevent zero_shot mode from using wrong voice characteristics
- Fix both processor and adapter character handling
- Fixes issue where characters without .txt used default narrator's text
2026-01-03 10:30:23 -03:00
diodiogod 7d9438ced1 Version 4.16.5
Fix CosyVoice3 PyYAML compatibility across all entry points

Technical details:
- Add max_depth patch to all CosyVoice import chains
- Patch engine wrapper, adapter, processor, SRT processor, and engine node
- Ensure yaml module is patched before any hyperpyyaml imports
- Addresses GitHub issue #220 more comprehensively
2026-01-03 10:21:18 -03:00
diodiogod 524c2d7bd4 Add CosyVoice3 model variant support with lazy downloading
Implements support for Fun-CosyVoice3-0.5B (standard) and Fun-CosyVoice3-0.5B-RL variants with lazy downloading:
- Only downloads variant-specific LLM file (~2GB) when needed
- Shared files (flow.pt, hift.pt, etc.) downloaded once and reused
- Both variants use same folder: Fun-CosyVoice3-0.5B
- Proper cache invalidation when switching between variants

Technical changes:
- Patched bundled CosyVoice library to accept llm_filename parameter
- Modified downloader to use SHARED_FILES + variant-specific LLM
- Audio cache now includes model_variant in hash calculation
- Model loading cache uses llm_filename in additional_params
- Added variant detection in path resolution and verification
2025-12-29 21:52:13 -03:00
diodiogod 8e17e130b0 Fix CosyVoice SRT character switching and multi-line subtitle support
Major fixes:
- SRT processor now uses process_text() for proper character switching
- Multi-line subtitles now process all lines, not just the first
- Connected narrator now takes priority over character folder narrator
- Fixed model reload loop - only update config instead of cleanup/reinit
- Added character_mapping parameter to CosyVoice processor
- Fixed cross_lingual debug output to not show system prompt

Technical details:
- CosyVoice processor accepts optional character_mapping override
- SRT processor builds mapping with connected narrator prioritized
- Lines without character tags fall back to narrator voice
- Removed duplicate character parsing - delegated to processor
- Fixed update_config() to not destroy and recreate processor
- Changed cross_lingual print to show original text not formatted_text
2025-12-29 18:09:05 -03:00
diodiogod bcbc52376b Clean up CosyVoice logging output
Removed verbose/redundant messages:
- Commented out mode detection debug message
- Changed 📊 to ✅ for RTF generation messages
- Removed "Next generations will be faster" message (fast model)
- Removed "Initializing engine (first run...)" message
- Removed "Loading: LLM → Flow → HiFT..." component list
- Removed redundant "engine loaded via unified interface" message
- Commented out bundled library path (internal detail)
- Kept useful "Loading CosyVoice model from..." with actual model path
- Commented out "input frame rate" debug messages (internal model param)
- Commented out "use wetext frontend" debug message
- Consolidated text length warnings to single message at processor level
  with friendlier wording about quality impact

Result: Cleaner output showing only relevant info to users.
2025-12-29 16:26:53 -03:00
diodiogod a58c68d575 Add parameter switching support to CosyVoice3
Implemented per-segment parameter overrides for seed and speed:
- Register CosyVoice in segment_parameters.py for seed and speed
- Apply segment.parameters using modular apply_segment_parameters()
- Extract segment_seed and segment_speed with fallback to node defaults
- Pass parameters through all generation paths (pause tags, chunking, direct)
- Add speed parameter to _generate_audio_segment() method
- Print parameter application message matching other engines

Supports inline tags like [Alice|seed:42|speed:1.5] with automatic
warnings for unsupported parameters via modular validation system.
2025-12-29 16:11:10 -03:00
diodiogod dbfe1872bc Don't prepend English language tags (CosyVoice default)
Only prepend language tags for non-English languages (zh, ja, ko).
English is CosyVoice's default, so no tag needed - prevents forcing
English mode on all text and allows auto-detection when appropriate.
2025-12-29 15:43:18 -03:00
diodiogod 7a6d6ca77d Add language switching support to CosyVoice processor
- Prepend CosyVoice native language tags (<|en|>, <|zh|>, <|ja|>, <|ko|>) based on segment language
- Integrate with unified language system using resolve_language_alias()
- Support both explicit [lang:] tags and character language defaults
- Validate manual language tags to avoid duplicates
- Only prepend if no valid CosyVoice language tag already present
2025-12-29 15:37:08 -03:00
diodiogod 828e27b45c Add character switching support to CosyVoice processor
- Configure character parser with available characters and aliases
- Extract character names from text tags dynamically
- Build character voice mapping with audio_only mode (text optional)
- Use lowercase character names for consistent mapping lookup
- Prioritize connected opt_narrator over character mapping for narrator
- Fallback to character mapping when no connected narrator
- Fix voice discovery to return full character_info for audio_only engines
- Fix wrapper tag conversion order (single tags first, then wrappers)
2025-12-29 15:05:07 -03:00
diodiogod 273677b8a9 Fix CosyVoice VRAM management and cache invalidation
- Add CosyVoiceWrapper.update_config() to propagate config changes to processor
- Pass use_fp16 parameter to adapter for proper audio cache key generation
- Create CosyVoiceHandler for proper component-level device management
  - Manually moves llm, flow, hift, campplus components to CPU/GPU
  - Properly frees VRAM when unloading (AutoModel lacks .to() method)
- Improve console warning formatting for length mismatch
  - Clean separation of warning from text content
  - Show character counts instead of full text dump

Fixes:
- Cache now invalidates when changing instruction/reference text
- Cache now invalidates when changing use_fp16 setting
- Unload Models button now properly frees ~3GB VRAM from CosyVoice
- Console output is cleaner and more organized
2025-12-29 09:27:54 -03:00
diodiogod 9ea7dc7243 Fix CosyVoice3 mode auto-detection and cache invalidation
- Add mode parameter to adapter.generate() signature to avoid **kwargs conflicts
- Include mode explicitly in cache key generation for proper invalidation
- Remove hardcoded mode from processor - let adapter auto-detect based on parameters
- Auto-detection logic:
  * instruct_text provided → instruct mode (ignores reference_text)
  * reference_text provided → zero_shot mode
  * neither provided → cross_lingual mode

Cache now properly invalidates when:
- Changing narrator (different speaker_audio hash)
- Adding/removing instruction (different instruct_text + mode change)
- Changing reference text (different reference_text)
- Changing generation mode

Fixes issue where instruction was ignored and zero_shot mode was always used
2025-12-29 08:28:15 -03:00
diodiogod d6ffa42cc7 CosyVoice3: Fix chunking method name and add mode detection debug
- Fix: chunk_text -> split_into_chunks in processor
- Add debug logging for mode detection in adapter
- Fix test file to use command-line args instead of hardcoded paths
2025-12-29 01:46:46 -03:00
diodiogod 4265a5e8c1 CosyVoice3: Complete implementation fixes and dependency cleanup
- Implement auto-mode detection (zero_shot/instruct/cross_lingual)
- Remove mode dropdown and reference_text from engine node
- Fix sample rate from 22050 Hz to 24000 Hz across all files
- Add paralinguistic tag conversion (<tag> to [tag]) via cosyvoice_special_tags.py
- Clean up requirements.txt (remove 13 unnecessary deps, keep only inflect)
- Update engine node tooltip with clear mode mutual exclusivity warning

All dependencies now properly handled by install.py except inflect (needed for text normalization)
2025-12-29 01:14:26 -03:00
tazztone 142a295189 opus4.5 test fixes 2025-12-19 13:14:06 +01:00
tazztone 84a10d3ee4 All CosyVoice3 integration phases complete! The engine is fully integrated with:
✅ Pause tags
✅ Character switching
✅ SRT support
✅ All timing modes
✅ Documentation
2025-12-18 09:48:52 +01:00
CrispyToken 7d053c1cdc Merge branch 'diodiogod:main' into main 2025-12-04 22:10:57 +01:00
CrispyToken ce5404d13e Added low_vram mode functionality to IndexTTS-2 Engine node 2025-12-04 22:08:20 +01:00
diodiogod b550b5b3f8 Fix generation_info consistency across IndexTTS and Step Audio EditX
Make both engines follow ChatterBox 23-Lang modular pattern:

**Step Audio EditX:**
- Update combine_audio_segments() to use ChunkCombiner with return_info=True
- Return (audio, chunk_info) tuple when requested
- Fix single segment shape handling (ensure 2D [channels, samples])

**IndexTTS:**
- Add combine_audio_segments() method using ChunkCombiner
- Update process_text() to accept return_info parameter
- Build chunk_info from text segments and return timing data

**Unified Node:**
- Call both engines with return_info=True
- Use ChunkTimingHelper.enhance_generation_info() for detailed reports
- Clean text without tags before calculating length

**Documentation:**
- Add generation_info consistency requirement to fails document
- Document correct pattern: ChunkCombiner + ChunkTimingHelper
- Note wrong pattern: inline torch.cat without timing

Now both engines provide detailed timing reports like F5-TTS and ChatterBox.
2025-12-04 09:51:10 -03:00
diodiogod 4060317a7b Fix IndexTTS-2 audio distortion: eliminate file I/O and use direct tensor output
Changes:
- Modify index_tts.py to call infer() with output_path=None, getting tensors directly instead of saving/loading files
- This avoids the TorchCodec DLL error on PyTorch 2.9+ Windows that was causing file corruption
- Remove global PyTorch patches from __init__.py since we no longer need torchaudio.save() in main path
- Unpack (sampling_rate, wav_data) tuple from infer() and convert int16 numpy array to float32 torch tensor
- Add save_audio_safe() function in index_tts_processor.py for graceful TorchCodec fallback in pause processor
- Replace all ta.save()/torchaudio.save() calls in pause processor with save_audio_safe()

Root cause: ComfyUI-IndexTTS2 works fine because it calls infer() with output_path=None (direct tensors).
Our suite was calling infer(output_path=output_path) which forced file save/load, triggering TorchCodec DLL errors.
The pause processor still needs torchaudio.save() so we provide a soundfile fallback instead of global patches.
2025-11-07 01:25:12 -03:00
diodiogod 7ce8172fbb Complete IndexTTS-2 parameter integration: cache, console logging, processor flow
Critical fixes:
1. Added missing parameters to cache key: do_sample, num_beams, stream_return,
   more_segment_before, use_torch_compile, use_accel
2. Fixed processor to pass do_sample, stream_return, more_segment_before to adapter
3. Added console logging for optimization and streaming parameters

This ensures:
- Cache properly invalidates when any parameter changes
- All new parameters flow through processor → adapter → engine
- User sees all configuration changes in console output
- Backward compatibility maintained (new params optional)
2025-11-06 20:03:37 -03:00
diodiogod 2318771c31 Add upstream optimization parameters to IndexTTS-2 node and engine
Add new optional parameters for IndexTTS-2 engine backward-compatible integration:
- use_torch_compile: Enable torch.compile for S2Mel stage optimization
- use_accel: Enable GPT2 acceleration with FlashAttention
- stream_return: Enable streaming mode for low-latency generation
- more_segment_before: Streaming segmentation parameter

Parameters added to:
- IndexTTSEngineNode (optional inputs for backward compatibility)
- IndexTTSAdapter (initialize_engine and generate methods)
- IndexTTSProcessor (passes params to adapter)
- IndexTTSEngine wrapper (stores and passes to model config)

All parameters properly parsed, documented with tooltips, and flow through
the entire generation pipeline without breaking existing workflows.
2025-11-06 19:36:43 -03:00
diodiogod 46fda45944 Fix: Remove torchcodec dependency to eliminate FFmpeg system requirement
Removed torchcodec from requirements.txt and install.py to eliminate the FFmpeg
system dependency that was causing Windows installation failures.

Implementation:
- Removed torchcodec>=0.2.0 from requirements.txt
- Removed torchcodec>=0.2.0 from install.py core_packages list
- Removed torchaudio 2.9+ migration warnings (no longer applicable)
- Added AudioProcessingUtils.safe_load_audio() utility for robust audio loading
- Updated all audio loading calls to use fallback-aware utility function

Audio Loading Changes:
- character_voices_node.py: Uses safe_load_audio() with fallback support
- tts_text_node.py: Uses safe_load_audio() for narrator and character voices (2x)
- tts_srt_node.py: Uses safe_load_audio() for narrator voice
- higgs_audio_tts_processor.py: Uses safe_load_audio() (2x)
- higgs_audio_srt_processor.py: Uses safe_load_audio() (2x)
- index_tts_processor.py: Uses safe_load_audio() (2x)
- f5tts_streaming_adapter.py: Uses safe_load_audio()
- higgs_audio_adapter.py: Uses safe_load_audio()
- subprocess.py: Uses safe_load_audio()

Compatibility:
- torchaudio.load() works fine with fallback backends (soundfile, scipy)
- No quality loss - only negligible audio loading speed difference (~milliseconds)
- All existing audio formats supported
- Better error handling with graceful fallbacks
2025-11-05 22:26:10 -03:00
diodiogod d0f403b40b Use consistent emoji for parameters (📊) across Index2 and VibeVoice 2025-10-29 08:05:17 -03:00
diodiogod b8de698bc7 Add per-segment parameter switching to Index2 (text and SRT)
- Modified IndexTTSProcessor to use CharacterSegment objects with parameters
- Added parameter detection to split generation when parameters change
- Reconstructs text with character tags to preserve character switching
- Applies per-segment parameters (seed, temperature, cfg, top_p, top_k, emotion_alpha)
- Parameters override node defaults for specific segments only, then revert
- Works with character switching for multi-character scripts
2025-10-29 01:53:58 -03:00
diodiogod 2ca5b7d6bc Fix Any Switch device parameter corruption in unified nodes
- Add sanitization for corrupted device values (floats like 0.6 instead of strings)
- Apply fix to all unified nodes: TTS Text, TTS SRT, Voice Changer
- Prevents 'device 0.6 is invalid' and similar errors when using rgthree Any Switch node
- On first run after ComfyUI restart, Any Switch corrupts numeric config parameters
- Workaround converts corrupted floats back to proper device strings ('cuda:0', 'auto')
2025-10-23 10:06:50 -03:00
diodiogod 77dce79ed5 Fix IndexTTS-2 tensor dimension error with direct audio input
- Fix Expected 2D Tensor, got 3D error when using opt_narrator
- Add proper dimension handling for ComfyUI audio tensors (3D -> 2D)
- Convert batch dimension and stereo to mono for IndexTTS-2 compatibility
- Align tensor processing with existing IndexTTS-2 patterns
2025-09-17 00:22:28 -03:00
diodiogod f4388a1731 Clean debug logs and rename QwenEmotion to IndexTTS-2 Text Emotion
- Remove cluttering 🐛 debug logs while keeping important emotion info
- Fix Character Voices emotion_audio detection in IndexTTS engine
- Fix Character Voices audio path extraction in adapter
- Rename 🧠 QwenEmotion Text Analysis → 🌈 IndexTTS-2 Text Emotion
- Update emoji from 🧠 to 🌈 for visual consistency with Emotion Vectors
- Update all references in registry mappings and tooltips
- Clean up debug messages with new branding

Visual consistency: Both IndexTTS-2 emotion nodes now use 🌈 rainbow emoji
2025-09-16 10:28:18 -03:00
diodiogod e49af97e6d Add dynamic {seg} template support for QwenEmotion per-segment analysis
- Add {seg} placeholder support in QwenEmotion emotion_text templates
- Implement dynamic template processing in IndexTTS processor
- Replace {seg} with actual segment text for contextual emotion analysis
- Add is_dynamic_template flag to track template usage
- Update default example to showcase dynamic template feature
- Add debug logging for template processing

Example: "Angry man shouting: {seg}" becomes "Angry man shouting: Get out!"
for each text segment, enabling context-aware emotion analysis.
2025-09-16 10:01:20 -03:00
diodiogod 4531a6a756 Implement unified emotion control system for IndexTTS-2
- Remove emotion_alpha from QwenEmotion node (engine controls intensity)
- Add proper QwenEmotion model selection with local model detection
- Create 🧠 QwenEmotion Text Analysis node with auto-download support
- Update IndexTTS-2 Engine to accept unified emotion_control input
- Replace AnyType with proper connection hints for emotion inputs
- Validate QwenEmotion models for completeness (required files check)
- Maintain backward compatibility with Character Voices opt_narrator
2025-09-16 09:06:04 -03:00
diodiogod 9a71ee2d61 Fix IndexTTS-2 cache system for consistent segment caching
- Add seed parameter support throughout IndexTTS-2 pipeline
- Fix cache key generation using stable audio content hashing
- Resolve temporary file path invalidation preventing cache hits
- Use centralized audio_hash utility for consistent audio identification
- Enable proper cache hits for identical text/character/emotion combinations
2025-09-15 23:31:18 -03:00
diodiogod 73ea1f5979 Fix IndexTTS-2 tensor dimension issue with direct audio input
- Fix 3D tensor handling when saving character/narrator audio to temp files
- Ensure 2D tensor format (channels, samples) for torchaudio.save
- Resolves 'Expected 2D Tensor, got 3D' error with opt_narrator direct audio
- Affects both TTS Text and SRT processing workflows
2025-09-15 17:16:10 -03:00
diodiogod 14436035ae Fix IndexTTS-2 emotion resolution and character parser integration
- Add centralized emotion resolution to character parser
- Fix QwenEmotion variable scope error in IndexTTS-2 inference
- Refactor emotion resolution to avoid code duplication
- Enable both connected engine emotions and character-specific emotion overrides
- Support [Alice:Bob] syntax for voice identity with emotion reference
- Clean integration with existing character alias system
2025-09-15 10:48:43 -03:00
diodiogod 7503aec464 Fix IndexTTS-2 character switching functionality
- Set up character parser with available characters and aliases in processor
- Use global character_parser instance instead of creating new ones
- Add missing _generate_multi_character_segments method to adapter
- Fix character mapping to use "audio_only" engine type for proper voice discovery
- Add missing torchaudio import for character voice loading
- Enable proper Alice -> female_01 alias resolution with German language support

Character switching now works: [Alice] properly switches to female_01 voice
while [female_01] uses the voice directly without language defaults.
2025-09-13 08:49:07 -03:00
diodiogod b4b0c48353 Fix IndexTTS-2 emotion_audio tensor handling
- Convert emotion_audio tensors to temporary file paths before passing to IndexTTS engine
- Handle tensor dimension normalization (3D->2D, 1D->2D) for torchaudio.save compatibility
- Add proper temporary file cleanup for both character switching and regular generation paths
- Fixes "Invalid file" and "Expected 2D Tensor, got 3D" errors when using emotion_audio input

The IndexTTS engine expects file paths but the processor receives tensor dictionaries,
so conversion to temporary files is required.
2025-09-12 09:46:57 -03:00
diodiogod b965a38326 Add IndexTTS-2 engine - initial implementation and basic testing
- Initial IndexTTS-2 TTS engine implementation
- Basic unified interface integration
- Auto-download system for IndexTTS-2 models
- Character voice switching support via QwenEmotion
- Token-based chunking system
- ComfyUI model management integration
- Fixed debug output and basic inference working
- Multi-language text preprocessing foundation
- Basic error handling framework

Note: Initial implementation - requires further testing and refinement
2025-09-12 09:33:55 -03:00
diodiogod 51de42754f Complete IndexTTS-2 TTS engine integration with emotion disentanglement
Major Features:
• IndexTTS-2 engine with zero-shot voice cloning and emotion control
• Multi-modal emotion support (audio refs, text descriptions, manual vectors)
• Character switching with emotion references: [Alice:angry_bob]
• Native IndexTTS-2 token-based chunking integration
• Comprehensive parameter exposure with 25+ engine-specific options

Core Components:
• engines/processors/index_tts_processor.py - Main processor with emotion support
• nodes/engines/index_tts_engine_node.py - Engine configuration node
• Updated unified TTS Text node with IndexTTS-2 integration
• Node registration in main nodes.py

Dependencies:
• Added 8 safe IndexTTS-2 dependencies to install.py and requirements.txt
• Dependency testing confirmed only descript-audiotools conflicts (already handled)
• All new deps use flexible versioning (>=) to avoid lock conflicts

Character Parser Fix:
• Fixed circular import by moving CharacterSegment to separate types.py
• Maintains backward compatibility while supporting emotion references
• Modular structure preserved (4 modules under 500 lines each)

Technical Details:
• Emotion disentanglement separates speaker identity from emotional expression
• Supports [character:emotion] syntax for per-segment emotion control
• IndexTTS-2 native chunking overrides character-based chunking when enabled
• Full caching integration and pause tag support included
• Error handling with graceful fallbacks for missing voices/emotions
2025-09-11 21:59:19 -03:00