# ChatterboxTTS Dependencies for ComfyUI

# --- IMPORTANT: TROUBLESHOOTING INSTALLATION ---
# Some dependencies, particularly 's3tokenizer', can occasionally cause installation
# issues on certain Python setups (e.g., Python 3.10, sometimes used by tools like Stability Matrix).
# These issues often manifest as errors related to 'distutils', 'setuptools', or 'egg_info'
# during the build process of a package.
#
# To minimize potential problems, it's HIGHLY RECOMMENDED to first ensure your
# core packaging tools are up-to-date in your activated ComfyUI virtual environment:
#      python -m pip install --upgrade pip setuptools wheel
#
# After running the command above, proceed to install these requirements:
#   pip install -r requirements.txt
#
# If you still encounter issues after these steps:
#   - Restart ComfyUI and let the ComfyUI Manager retry the installation.
#   - As a last resort, consider recreating your virtual environment, then running the
#     `pip install --upgrade pip setuptools wheel` command again before installing any custom node requirements.


# Foundation dependencies (MUST be installed first in this order)
numpy>=2.0.0,<2.3.0  # Balance compatibility: >=2.0 for audio-separator, <2.3 for Numba
scipy
torch
torchaudio

# Audio processing dependencies (depend on numpy/torch)
librosa
soundfile
sounddevice
einops

# Core ChatterboxTTS dependencies
s3tokenizer>=0.1.7
resemble-perth
omegaconf
transformers==4.46.3
diffusers

# Additional dependencies for SRT support and audio processing
conformer>=0.3.2

# Audio processing and timing dependencies
soundfile
sounddevice

# F5-TTS dependencies (optional - only needed if using F5-TTS nodes)
# Note: F5-TTS is best installed from source for latest features:
# git clone https://github.com/SWivid/F5-TTS.git && cd F5-TTS && pip install -e .
f5-tts>=0.0.1
cached-path>=1.3.0

# RVC (Real-time Voice Conversion) dependencies - NEW for v4
# Required for RVC Voice Changer functionality and character model loading
faiss-cpu>=1.7.4          # Vector similarity search for voice matching (CPU version for compatibility)
# faiss-gpu>=1.7.4        # Uncomment for GPU acceleration (requires CUDA compatibility)
onnxruntime-gpu           # ONNX model inference with CUDA acceleration for vocal separation
# onnxruntime             # CPU fallback if GPU version fails: pip uninstall onnxruntime-gpu && pip install onnxruntime
torchcrepe                # CREPE pitch extraction algorithm
torchfcpe                 # Fast Context-based Pitch Estimation (FCPE) for real-time RVC
monotonic-alignment-search # Audio alignment utilities
audio-separator           # Ultimate Vocal Remover compatibility layer for vocal separation
requests                  # Model downloading functionality

# Video analysis dependencies for Mouth Movement Analyzer
mediapipe>=0.10.0         # Google's MediaPipe for facial landmark detection
opencv-python>=4.8.0      # Computer vision library for video processing
protobuf>=4.21.0,<5.0.0   # Protocol buffers compatibility for MediaPipe

# OpenSeeFace dependencies (optional - for robust tracking in challenging conditions)
onnxruntime               # ONNX model inference for OpenSeeFace (already included above for RVC)
pillow                    # Image processing library for OpenSeeFace
# Note: OpenSeeFace itself is not on PyPI, users should install via:
# git clone https://github.com/emilianavt/OpenSeeFace.git