Skip to content

Configuration File: tts_engines.json

erew123 edited this page Nov 11, 2024 · 3 revisions

The tts_engines.json file, located in /system/tts_engines/, stores information about the Text-to-Speech (TTS) engines available in the application. It keeps track of the currently loaded engine, its selected model, and a list of other available engines with their respective models.

File Structure

{
    "engine_loaded": "piper",
    "selected_model": "piper",
    "engines_available": [
        {
            "name": "parler",
            "selected_model": "parler - parler_tts_mini_v0.1"
        },
        {
            "name": "piper",
            "selected_model": "piper"
        },
        {
            "name": "vits",
            "selected_model": "vits - tts_models--en--vctk--vits"
        },
        {
            "name": "xtts",
            "selected_model": "xtts - xttsv2_2.0.3"
        }
    ]
}

Main Settings

These settings will be what is used when you start AllTalk.

  • engine_loaded: The name of the currently loaded TTS engine.
  • selected_model: The model currently being used by the loaded engine.

Available Engines

The engines_available array contains objects for each available TTS engine:

  • name: The name of the TTS engine.
  • selected_model: The currently selected model for that engine.

Functionality

  1. Engine Switching: When you switch to another TTS engine in the interface, the engine_loaded and selected_model fields are updated to reflect the newly selected engine and its corresponding model.

  2. Model Switching: If you change the model for the currently loaded engine, only the selected_model field is updated for the engine_loaded.

  3. Persistence: This file helps maintain the state of TTS engine selections across sessions, allowing the application to remember your last used engine and model and load that in when you next start AllTalk.

Example Scenarios

  1. Current State:

    • Loaded engine: Piper
    • Selected model for Piper: "piper"
  2. Switching to VITS:

    • engine_loaded would change to "vits"
    • selected_model would update to "vits - tts_models--en--vctk--vits"
  3. Changing Piper's model (while Piper is the loaded engine):

    • Only the selected_model field would update to reflect the new Piper model

This configuration allows for flexible management of multiple TTS engines and their respective models, enabling easy switching and state management within the application.

Config loader flowchart

flowchart TD
    Start[Program Start] --> ConfigCheck{Check Config Files}
    
    %% Config Update Process
    ConfigCheck --> LoadConfigs[Load main_config, update_config, and downgrade_config]
    LoadConfigs --> NeedChanges{Changes Needed?}
    NeedChanges -->|Yes| BackupConfig[Create Timestamped Backup.YYYYMMDDHHMMSS.bak]
    BackupConfig --> UpdateConfig[Apply Updates/Downgrades to confignew.json]
    NeedChanges -->|No| SkipConfig[Skip Config Update]
    
    %% TTS Engines Process
    ConfigCheck --> LoadTTSEngines{Load TTS Engines Config}
    
    LoadTTSEngines -->|Success| CheckNew[Check new_engines.json for new engines]
    LoadTTSEngines -->|Fail| TryBackup{Backup Exists?}
    
    TryBackup -->|Yes| RestoreBackup[Restore from .backup file]
    TryBackup -->|No| CreateDefault[Create Default Configuration]
    
    CheckNew --> NewFound{New Engine Found?}
    NewFound -->|Yes| BackupTTS[Create .backup of tts_engines.json]
    BackupTTS --> AddEngine[Add New Engine to Configuration]
    NewFound -->|No| Complete
    
    RestoreBackup --> CheckNew
    CreateDefault --> CheckNew
    UpdateConfig --> Complete
    SkipConfig --> Complete
    AddEngine --> Complete
    
    Complete[Configuration Complete]
    
    subgraph "File Types"
        ConfigFiles["Configuration Files:
        - confignew.json (main config)
        - at_configupdate.json (additions)
        - at_configdowngrade.json (removals)
        - tts_engines.json (engine config)
        - new_engines.json (new engine definitions)"]
    end
    
    subgraph "Backup Types"
        BackupFiles["Backup Files:
        - .YYYYMMDDHHMMSS.bak (config changes)
        - .backup (TTS engine changes)"]
    end
Loading
Clone this wiki locally