multilingual_app: default voice prompts are GCS URLs, but librosa.load cannot open URLs — synthesis with the default voice always fails
Summary
Every language's default reference voice in multilingual_app.py is a
remote https://storage.googleapis.com/... URL. That URL is passed
verbatim to librosa.load(), which only opens local files. Any synthesis
that does not upload a reference voice fails with a Gradio event: error
and a FileNotFoundError for the URL itself — for all 23 supported
languages.
Environment
| chatterbox | main @ 5de7a54aa4e5e2baadb0182dde554908b48b85c2 (2026-07-21), installed via pip install -e . |
| gradio | 6.8.0 (also reproduced on 5.50.0) |
| librosa | 0.11.0 |
| Python | 3.12.3 (Ubuntu 24.04, CUDA GPU — bug is GPU-independent) |
Steps to reproduce
- Clone the repo, install, and run the multilingual app:
git clone https://github.com/resemble-ai/chatterbox cd chatterbox && pip install -e . GRADIO_SERVER_NAME=127.0.0.1 GRADIO_SERVER_PORT=7860 python multilingual_app.py - Do not upload any reference voice (use the default).
- Call the Gradio API directly:(Same failure happens from the web UI: type text, click Generate, with the default voice sample selected.)
EVENT=$(curl -s -X POST http://127.0.0.1:7860/gradio_api/call/generate_tts_audio \ -H 'Content-Type: application/json' \ -d '{"data":["Hello, this is a test.","en",null,0.5,0.8,0,0.5]}' \ | python3 -c 'import sys,json;print(json.load(sys.stdin)["event_id"])') curl -sN "http://127.0.0.1:7860/gradio_api/call/generate_tts_audio/$EVENT"
Actual result
The call returns event: error, data: null. The server log shows:
Using audio prompt: https://storage.googleapis.com/chatterbox-demo-samples/mtl_prompts/en_f1.flac
.../librosa/core/audio.py:255: UserWarning: PySoundFile failed. Trying audioread instead.
Traceback (most recent call last):
...
File ".../librosa/core/audio.py", line 240, in __audioread_load
reader = audioread.audio_open(path)
...
FileNotFoundError: [Errno 2] No such file or directory:
'https://storage.googleapis.com/chatterbox-demo-samples/mtl_prompts/pt_m1.flac'(For en the URL is en_f1.flac; same shape for every language.)
Expected result
Audio is generated using the shipped default voice prompt, or the prompt is fetched locally first.
Root cause
LANGUAGE_CONFIG[<lang>]["audio"] holds plain HTTPS URLs for all
languages. Both code paths return the URL unchanged:
default_audio_for_ui()(line ~112) feeds the URL to the Audio component as its default value;resolve_audio_prompt()(line ~170) returns the URL toChatterboxMultilingualTTS.generate(), which ends up inlibrosa.load(wav_fpath, sr=S3GEN_SR)(src/chatterbox/mtl_tts.py, line ~255).soundfile/audioreadonly open local paths.
Suggested fix
Download each default prompt once into a local cache and pass the local path on (keeps user-supplied paths untouched). A minimal patch that fixes the issue:
VOICE_PROMPT_CACHE_DIR = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "voice_prompts")
def resolve_audio_prompt(language_id: str, provided_path: str | None) -> str | None:
if provided_path and str(provided_path).strip():
return provided_path
url = LANGUAGE_CONFIG.get(language_id, {}).get("audio")
if not url:
return None
if not url.startswith("http"):
return url
os.makedirs(VOICE_PROMPT_CACHE_DIR, exist_ok=True)
local_path = os.path.join(VOICE_PROMPT_CACHE_DIR, url.rsplit("/", 1)[-1])
if not os.path.exists(local_path):
print(f"Downloading default voice prompt {url} -> {local_path}")
urllib.request.urlretrieve(url, local_path)
return local_path…and route default_audio_for_ui() through it as well:
def default_audio_for_ui(lang: str) -> str | None:
return resolve_audio_prompt(lang, None)A cache shared across languages (or the HF cache) would also work; the
important part is that librosa.load never receives a URL.
Suggested regression test
resolve_audio_prompt("pt", None)returns an existing local path (endswith.flac,os.path.exists).- End-to-end:
generate_tts_audiowithlanguage="en", no uploaded voice, returns a non-empty audio file.
Workaround before the fix
Upload any reference voice, or patch resolve_audio_prompt locally as
above (we validated the patch on this checkout: synthesis succeeds in
pt and en and the prompt is cached under voice_prompts/).
Source: resemble-ai/chatterbox