tts speaks MP3: a seventh of WAV's bytes over a slow link to the server
A sentence's length for `append` comes from the Xing header LAME writes into the first frame. The cache key carries the format, so no WAV is reused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ljdk7nDaguh9Uhi3zhcSjn
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
200509c1bd
commit
a12bc5a2ee
@@ -189,7 +189,11 @@ async def speak(
|
||||
model: str = "tts-1",
|
||||
timeout: float = 30.0,
|
||||
) -> bytes:
|
||||
"""``POST {api_base}/audio/speech``: ``text`` spoken, as WAV."""
|
||||
"""``POST {api_base}/audio/speech``: ``text`` spoken, as MP3.
|
||||
|
||||
MP3 rather than WAV: a seventh of the bytes, which over a slow link to
|
||||
the server is most of the wait for a sentence.
|
||||
"""
|
||||
async with httpx.AsyncClient(timeout=timeout) as http:
|
||||
response = await http.post(
|
||||
api_base.rstrip("/") + "/audio/speech",
|
||||
@@ -197,7 +201,7 @@ async def speak(
|
||||
"model": model,
|
||||
"input": text,
|
||||
"voice": voice,
|
||||
"response_format": "wav",
|
||||
"response_format": "mp3",
|
||||
},
|
||||
)
|
||||
if response.is_error:
|
||||
|
||||
Reference in New Issue
Block a user