aboutsummaryrefslogtreecommitdiff
path: root/converter/tts.py
diff options
context:
space:
mode:
Diffstat (limited to 'converter/tts.py')
-rw-r--r--converter/tts.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/converter/tts.py b/converter/tts.py
index 741d9d3..a1c0b09 100644
--- a/converter/tts.py
+++ b/converter/tts.py
@@ -28,7 +28,7 @@ from typing import Any, Dict, List, Optional, Tuple
from . import config
from .audio import concat_audio_files, probe_duration_ms
-from .chunking import MAX_REQUEST_WORDS, split_into_chunks
+from .chunking import split_into_chunks
logger = logging.getLogger(__name__)
@@ -440,14 +440,14 @@ class QwenTTSClient(_BaseTTSClient):
"""Generate one audio chunk; returns its path in the chunks folder.
The text is split into sub-requests of at most
- ``MAX_REQUEST_WORDS`` words each (the book-level chunker
+ ``config.CHUNK_SIZE`` words each (the book-level chunker
normally guarantees this already; the split is defense in depth
against pathological input such as a punctuation-free run of
text), and the audio files returned for the sub-requests are
concatenated into one chunk file.
"""
try:
- sub_texts = split_into_chunks(text, max_words=MAX_REQUEST_WORDS)
+ sub_texts = split_into_chunks(text, max_words=config.CHUNK_SIZE)
if not sub_texts:
raise RuntimeError("No text to synthesize")
@@ -673,7 +673,7 @@ class FasterTTSClient(_BaseTTSClient):
def generate_chunk(self, text: str, chunk_num: int) -> Optional[str]:
"""Generate one audio chunk; returns its path in the chunks folder."""
try:
- sub_chunks = split_into_chunks(text, max_words=MAX_REQUEST_WORDS)
+ sub_chunks = split_into_chunks(text, max_words=config.CHUNK_SIZE)
if not sub_chunks:
raise RuntimeError("No text to synthesize")
@@ -914,13 +914,13 @@ class AudioCppTTSClient(_BaseTTSClient):
"""Generate one audio chunk; returns its path in the chunks folder.
The text is split into sub-requests of at most
- ``MAX_REQUEST_WORDS`` words each (defense in depth against
+ ``config.CHUNK_SIZE`` words each (defense in depth against
pathological input, matching the Gradio client), each sub-request
returns a complete WAV file, and the parts are concatenated into
one chunk file.
"""
try:
- sub_texts = split_into_chunks(text, max_words=MAX_REQUEST_WORDS)
+ sub_texts = split_into_chunks(text, max_words=config.CHUNK_SIZE)
if not sub_texts:
raise RuntimeError("No text to synthesize")