aboutsummaryrefslogtreecommitdiff
path: root/app/converter/config.py
blob: d0028dcb89ed7d93aeed0b5f256847213b57b0b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Default output options
AUDIO_FORMAT = "m4b"
AUDIO_BITRATE = "128k"
LANGUAGE = "English"

API_TIMEOUT = 600  # Timeout per chunk request in seconds
MAX_RETRIES = 3    # Attempts per chunk request
HEARTBEAT_INTERVAL_SECONDS = 30  # Print "still working" in console logs every N seconds

# Words per TTS generation request (client-side chunking).
CHUNK_SIZE = 250

# Where books are read from and where finished audiobooks are written.
# Relative paths resolve against the project root (the folder containing
# audiobook.py). The --input/--output CLI flags override these per run.
INPUT_DIR = "./input"
OUTPUT_DIR = "./output"

# Playback speed factor for the final audiobook (1.0 = normal).
# Pitch-preserving. The --speed CLI flag overrides this per run.
SPEED = 1.0

# Dump each chunk's raw audio and the exact text sent for it under the
# debug/ folder (organized per book and chapter), and log every TTS
# request and response to the console and log file. The --debug CLI flag
# forces this on for a single run.
DEBUG = False

# Default for "Stop server and exit" (TUI Settings menu: "Stop server
# and exit"): automatically stop the TTS server and exit the TUI after
# generating audiobooks.
STOP_SERVER_AND_EXIT = True

# Default TTS backend.
# audiocpp: audiocpp_server
# qwen: qwen-tts-demo
# faster: faster-qwen-tts
# The --backend CLI flag overrides this
BACKEND = "audiocpp"

###############################################################################
# BACKEND 1: qwen-tts-demo (qwen) options                                       #
###############################################################################

# The qwen backend runs ONE demo server at a time, on this port. Which model
# the server hosts is chosen per run on the Generate Audiobooks screen and
# persisted below (see QWEN_MODEL); switching models restarts the server.
QWEN_API_URL     = "http://127.0.0.1:7860"  # single qwen-tts-demo server

# Remote (externally-run) server URL. The hub probes it and offers a
# "[remote]" backend entry when it answers with a known qwen-tts demo (any
# of the three models), so an externally-started server can be used alongside
# a locally-managed one. Leave empty to disable remote probing. The default
# matches the local port so an external server squatting the local port is
# found without any configuration.
QWEN_REMOTE_URL  = "http://127.0.0.1:7860"

# Which model the managed demo server runs (one server hosts one model):
#   CustomVoice - built-in speakers (see SPEAKER)
#   Base        - voice cloning from a reference .wav
#   VoiceDesign - voice described by an instruction
# Chosen per run in the Generate-audiobooks form; edited here only as the
# default for the next run.
QWEN_MODEL = "CustomVoice"

# Custom voice options
SPEAKER = "Vivian"  #Vivian, Serena, Uncle_Fu, Dylan, Eric, Ryan, Aiden, Ono_Anna, Sohee
# Style/delivery instruction for CustomVoice runs; also the default design
# instruction when a VoiceDesign run does not override it.
INSTRUCT = "Speak naturally and clearly, as if reading a dramatic book to an adult audience."

# Don't clone with transcription, only use x-vector-only cloning. Generally "worse"
XVECTOR_ONLY = False

# Randomization seed. -1 means randomize with every generation
# With SEED = -1 and CONSTANT_SEED = True, one random seed will be used for the entire audiobook.
# This may keep the voice slightly more consistent across chunk boundaries
SEED = -1
CONSTANT_SEED = False

###############################################################################
# BACKEND 2: faster-qwen-tts options                                          #
###############################################################################
FASTER_API_URL   = "http://127.0.0.1:8000"    # faster-qwen3-tts server (Base model only)
FASTER_REMOTE_URL = "http://127.0.0.1:8000"   # externally-run faster-qwen3-tts server ("" disables probing)

# Default voice if no --voice is passed
FASTER_VOICE = "narrator"

###############################################################################
# BACKEND 3: audio.cpp options                                                #
###############################################################################
AUDIOCPP_API_URL = "http://127.0.0.1:8080"  # audio.cpp audiocpp_server
AUDIOCPP_REMOTE_URL = "http://127.0.0.1:8080"  # externally-run audiocpp_server ("" disables probing)

# Model ids in the audio.cpp server.json config. AUDIOCPP_MODEL_ID may point
# at any TTS model entry the server hosts; the family is detected from the
# server at startup and adapts the request automatically. Only qwen3_tts has
# built-in speakers (speaker mode); every other family needs --voice with a
# server-side voice preset. The server entry id is the model package's
# target_directory name (e.g. "Qwen3-TTS-12Hz-1.7B-Base-GGUF"). For
# single-model servers, set AUDIOCPP_CLONE_MODEL_ID to the same id as
# AUDIOCPP_MODEL_ID (or leave it empty); for Qwen3-TTS it typically names a
# second entry with the Base (cloning) model. Both default to empty so a
# single-entry server is auto-selected; a multi-model server (one server.json
# hosting several lazily-loaded entries) needs no editing here either: leave
# AUDIOCPP_MODEL_ID unset to auto-select when only one entry is hosted, or
# pick the entry per run with the --model CLI flag.
AUDIOCPP_MODEL_ID = "Qwen3-TTS-12Hz-1.7B-Base-GGUF"
AUDIOCPP_CLONE_MODEL_ID = "Qwen3-TTS-12Hz-1.7B-Base-GGUF"

# Voice design / style instruction sent with every audio.cpp request when
# the --instructions CLI flag is not given. Required for server entries
# hosted with task "vdes" (voice design models such as Qwen3-TTS
# VoiceDesign); on other families it acts as a style/delivery instruction
# when the model supports one and is ignored otherwise. Empty by default.
AUDIOCPP_INSTRUCTIONS = ""

# Ask the audio.cpp server to unload all currently loaded models before
# converting, so models left resident by earlier runs free their memory
# (e.g. VRAM on GPU backends) and only the selected entry loads. Set to
# False to keep other models resident across runs (the TUI Settings menu
# exposes this as "Unload models", default Yes).
AUDIOCPP_UNLOAD_MODELS = True