You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google TTS en-US-Journey-O语音speaking_rate参数无效问题求助

问题解答

1. en-US-Journey-O是否支持speaking_rate参数?

en-US-Journey-O语音不支持speaking_rate参数。这类属于Google TTS的风格化专属语音(Journey系列主打叙事风格),会锁定语速、语调等核心发音参数,无法通过audio_config中的speaking_rate进行调整,即使配置参数也不会生效。

2. 可调整语速的自然语音推荐

以下Google Cloud TTS的en-US语音既支持语速调整,发音也保持自然:

  • WaveNet系列标准语音:
    • en-US-Wavenet/A/B/C/D/E/F
  • Neural2系列语音:
    • en-US-Neural2/A/B/C/D/E/F
      这些语音支持0.25~4.0区间的speaking_rate调整,同时还能配合pitch、volume_gain_db等参数自定义发音效果。

3. 代码调整示例

只需将语音名称替换为上述支持的类型即可,比如换成en-US-Wavenet-A:

def synthesize_text(text, output_file):
    client = texttospeech.TextToSpeechClient()

    # Synthesize text output
    input_text = texttospeech.SynthesisInput(text=text)

    # Voice parameters - 替换为支持语速调整的语音
    voice = texttospeech.VoiceSelectionParams(
        language_code="en-US",
        name = "en-US-Wavenet-A"
    )

    # Set up the audio configuration (output format)
    audio_config = texttospeech.AudioConfig(
        audio_encoding=texttospeech.AudioEncoding.LINEAR16,
        speaking_rate = 0.5  # 此参数现在会正常生效
    )

    # The text-to-speech request
    response = client.synthesize_speech(
        input=input_text, voice=voice, audio_config=audio_config
    )

    # Write the response (audio content) to the output file
    with open(output_file, "wb") as out:
        out.write(response.audio_content)
    print(f"Audio content written to {output_file}")

内容的提问来源于stack exchange,提问作者WtrSprite

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 15:21:04