Configuration
ttsforge stores its configuration in a JSON file and provides a CLI interface for managing settings.
Configuration File Location
The configuration file is stored at:
Linux:
~/.config/ttsforge/config.jsonmacOS:
~/Library/Application Support/ttsforge/config.jsonWindows:
%APPDATA%\ttsforge\config.json
Managing Configuration
View current configuration:
ttsforge config --show
Set a configuration option:
ttsforge config --set KEY VALUE
Set multiple options:
ttsforge config --set default_voice am_adam --set default_speed 1.1
Reset to defaults:
ttsforge config --reset
Configuration Options
Voice and Language Settings
default_voiceDefault TTS voice to use.
Type: string
Default:
af_heartExample:
ttsforge config --set default_voice am_adam
default_languageDefault language code.
Type: string
Default:
a(American English)Choices:
a,b,e,f,h,i,j,p,zExample:
ttsforge config --set default_language b
phonemization_langOverride language for phonemization (e.g.,
de,fr,en-us).Type: string or null
Default:
NoneExample:
ttsforge config --set phonemization_lang de
default_speedDefault speech speed multiplier.
Type: float
Default:
1.0Range:
0.5to2.0Example:
ttsforge config --set default_speed 1.1
Output Settings
default_formatDefault output audio format.
Type: string
Default:
m4bChoices:
wav,mp3,flac,opus,m4bExample:
ttsforge config --set default_format mp3
Processing Settings
use_gpuEnable GPU acceleration for TTS inference.
Type: boolean
Default:
falseRequires:
onnxruntime-gpupackageExample:
ttsforge config --set use_gpu true
model_qualityONNX model quality/quantization.
Type: string
Default:
fp32Choices:
fp32,fp16,q8,q8f16,q4,q4f16,uint8,uint8f16Example:
ttsforge config --set model_quality fp16
model_variantModel variant to download.
Type: string
Default:
v1.0Choices:
v1.0,v1.1-zh,v1.1-deExample:
ttsforge config --set model_variant v1.1-de
auto_detect_languageAutomatically detect language from EPUB metadata.
Type: boolean
Default:
trueExample:
ttsforge config --set auto_detect_language false
default_split_modeDefault text splitting mode for processing.
Type: string
Default:
autoChoices:
auto,line,paragraph,sentence,clauseExample:
ttsforge config --set default_split_mode sentence
Read Settings
default_content_modeDefault content mode for
read(chaptersorpages).Type: string
Default:
chaptersExample:
ttsforge config --set default_content_mode pages
default_page_sizeSynthetic page size in characters for
readpages mode.Type: integer
Default:
2000Example:
ttsforge config --set default_page_size 2500
Mixed-Language Settings
use_mixed_languageEnable automatic detection and handling of multiple languages in text.
Type: boolean
Default:
falseRequires:
lingua-language-detectorpackage (pip install lingua-language-detector)Example:
ttsforge config --set use_mixed_language true
mixed_language_primaryPrimary/fallback language for mixed-language mode.
Type: string or null
Default:
NoneSupported:
en-us,en-gb,de,fr-fr,es,it,pt,pl,tr,ru,ko,ja,zh/cmnExample:
ttsforge config --set mixed_language_primary de
mixed_language_allowedList of languages allowed for auto-detection in mixed-language mode.
Type: list of strings or null
Default:
NoneRequired when
use_mixed_languageis enabledExample:
ttsforge config --set mixed_language_allowed "['de', 'en-us']"
mixed_language_confidenceConfidence threshold for language detection (0.0-1.0).
Type: float
Default:
0.7Range:
0.0to1.0Higher values require more confidence before switching languages
Example:
ttsforge config --set mixed_language_confidence 0.8
Audio Timing Settings
silence_between_chaptersSilence duration between chapters in seconds.
Type: float
Default:
2.0Example:
ttsforge config --set silence_between_chapters 3.0
pause_clausePause after clauses in seconds.
Type: float
Default:
0.5Example:
ttsforge config --set pause_clause 0.4
pause_sentencePause after sentences in seconds.
Type: float
Default:
0.7Example:
ttsforge config --set pause_sentence 0.6
pause_paragraphPause after paragraphs in seconds.
Type: float
Default:
0.9Example:
ttsforge config --set pause_paragraph 1.1
pause_varianceRandom variance added to pause durations in seconds.
Type: float
Default:
0.05Example:
ttsforge config --set pause_variance 0.08
pause_modePause mode:
tts,manual, orauto.Type: string
Default:
autoExample:
ttsforge config --set pause_mode manual
Chapter Announcement Settings
announce_chaptersRead chapter titles aloud before chapter content.
Type: boolean
Default:
trueExample:
ttsforge config --set announce_chapters false
chapter_pause_after_titlePause duration after the chapter title announcement in seconds.
Type: float
Default:
2.0Example:
ttsforge config --set chapter_pause_after_title 1.5
File Output Settings
save_chapters_separatelySave individual chapter audio files.
Type: boolean
Default:
falseExample:
ttsforge config --set save_chapters_separately true
merge_at_endMerge chapter files into final audiobook.
Type: boolean
Default:
trueExample:
ttsforge config --set merge_at_end false
Filename Template Settings
These settings control how output files are named. See Filename Templates for details.
output_filename_templateTemplate for final audiobook filenames.
Type: string
Default:
{book_title}Example:
ttsforge config --set output_filename_template "{author}_{book_title}"
chapter_filename_templateTemplate for chapter WAV file names during conversion.
Type: string
Default:
{chapter_num:03d}_{book_title}_{chapter_title}Example:
ttsforge config --set chapter_filename_template "{chapter_num:03d}_{chapter_title}"
phoneme_export_templateTemplate for phoneme export filenames.
Type: string
Default:
{book_title}Example:
ttsforge config --set phoneme_export_template "{book_title}_phonemes"
default_titleFallback title when book has no metadata.
Type: string
Default:
UntitledExample:
ttsforge config --set default_title "Unknown Book"
Complete Configuration Reference
Option |
Type |
Default |
Description |
|---|---|---|---|
|
string |
|
Default TTS voice |
|
string |
|
Default language code |
|
float |
|
Speech speed multiplier |
|
string |
|
Output audio format |
|
boolean |
|
Enable GPU acceleration |
|
string |
|
Model quality/quantization |
|
string |
|
Model variant |
|
float |
|
Silence between chapters (seconds) |
|
float |
|
Clause pause (seconds) |
|
float |
|
Sentence pause (seconds) |
|
float |
|
Paragraph pause (seconds) |
|
float |
|
Pause variance (seconds) |
|
string |
|
Pause mode (tts/manual/auto) |
|
boolean |
|
Speak chapter titles |
|
float |
|
Pause after chapter titles (seconds) |
|
boolean |
|
Keep chapter audio files |
|
boolean |
|
Merge chapters into final file |
|
boolean |
|
Auto-detect language from EPUB |
|
string/null |
|
Override phonemization language |
|
string |
|
Text splitting mode |
|
string |
|
Default read mode (chapters/pages) |
|
integer |
|
Page size for read pages mode |
|
string |
|
Output filename template |
|
string |
|
Chapter filename template |
|
string |
|
Phoneme export template |
|
string |
|
Fallback title |
|
boolean |
|
Enable mixed-language mode |
|
string/null |
|
Primary language for mixed mode |
|
list/null |
|
Allowed languages list |
|
float |
|
Language detection threshold |
Example Configuration File
Here’s an example config.json with custom settings:
{
"default_voice": "am_adam",
"default_language": "a",
"default_speed": 1.1,
"default_format": "m4b",
"use_gpu": true,
"model_quality": "fp32",
"model_variant": "v1.0",
"silence_between_chapters": 2.5,
"pause_clause": 0.5,
"pause_sentence": 0.7,
"pause_paragraph": 0.9,
"pause_variance": 0.05,
"pause_mode": "auto",
"enable_short_sentence": None,
"announce_chapters": true,
"chapter_pause_after_title": 2.0,
"save_chapters_separately": false,
"merge_at_end": true,
"auto_detect_language": true,
"phonemization_lang": null,
"default_split_mode": "sentence",
"default_content_mode": "chapters",
"default_page_size": 2000,
"output_filename_template": "{author} - {book_title}",
"chapter_filename_template": "{chapter_num:03d}_{chapter_title}",
"phoneme_export_template": "{book_title}",
"default_title": "Untitled",
"use_mixed_language": false,
"mixed_language_primary": null,
"mixed_language_allowed": null,
"mixed_language_confidence": 0.7
}
Command-Line Override
Configuration values can be overridden on the command line. Command-line options take precedence over configuration file settings:
# Use configured voice, but override speed
ttsforge convert book.epub -s 1.2
# Override voice and format
ttsforge convert book.epub -v bf_emma -f mp3
Environment Variables
ttsforge does not currently support environment variables for configuration. Use the config file or command-line options instead.