Skip to content

API ‐ TTS Request Flowchart

erew123 edited this page Sep 30, 2024 · 3 revisions

AllTalk V2 TTS Request flow chart

flowchart TD
    A[API Request sent to /api/tts-generate] --> B[Receive Input Parameters]
    B --> C[Validate text and variables in request with Pydantic]
    C --> D{Settings valid?}
    D -->|No| E[Return error to request source and stop]
    D -->|Yes| F[Check for missing settings in the API request]
    F --> G[Populate missing settings from Global stored API settings if necessary]
    G --> W{Streaming?}
    W -->|Yes| X{Current TTS Engine supports streaming?}
    X -->|Yes| Y[Start generating TTS stream back to request source]
    X -->|No| Z[Return error to request source and stop]
    W -->|No| H{Is Narrator Enabled in the request?}
    H -->|No| I[Send all text to TTS Engine]
    H -->|Yes| J[Identify text type Character/Narrator]
    J --> K[Process based on text type & send to TTS Engine]
    I --> L[Apply API Allowed Text Filtering/Passthrough from Global API settings]
    K --> L
    L --> M[Apply Text Filtering method]
    M --> N[Generated TTS sent to RVC]
    N --> O{RVC enabled?}
    O -->|No| P[Continue to transcoding]
    O -->|Yes| Q[Process with RVC]
    Q --> P
    P --> R{Transcoding enabled?}
    R -->|No| S[Send TTS back to request source]
    R -->|Yes| T[Transcode audio]
    T --> U[Send transcoded audio back to request source]

    G <-.-> V["`Potential Global Settings:
    text_filtering
    character_voice_gen
    rvccharacter_voice_gen
    rvccharacter_pitch
    narrator_enabled
    narrator_voice_gen
    rvcnarrator_voice_gen
    rvcnarrator_pitch
    text_not_inside
    language
    output_file_name*
    output_file_timestamp
    autoplay
    autoplay_volume
    speed
    pitch
    temperature
    repetition_penalty`"]

    classDef defaultNode fill:#f0f0f0,stroke:#333,stroke-width:1px;
    class A,B,C,E,F,G,I,J,K,L,M,N,P,Q,S,T,U,Y,Z defaultNode;
    classDef decisionNode fill:#f0e68c,stroke:#333,stroke-width:1px;
    class D,H,O,R,W,X decisionNode;
    classDef listNode fill:#e6f3ff,stroke:#333,stroke-width:1px;
    class V listNode;
    classDef endpointNode fill:#ff9999,stroke:#333,stroke-width:1px;
    class Y,Z,U endpointNode;
Loading
Clone this wiki locally