Skip to content

feat(tts): add pitch and volume configuration options for Edge TTS - #21935

Closed
ariel-ai-bot wants to merge 2 commits into
NousResearch:mainfrom
ariel-ai-bot:main
Closed

feat(tts): add pitch and volume configuration options for Edge TTS#21935
ariel-ai-bot wants to merge 2 commits into
NousResearch:mainfrom
ariel-ai-bot:main

Conversation

@ariel-ai-bot

@ariel-ai-bot ariel-ai-bot commented May 8, 2026

Copy link
Copy Markdown

Summary

Add support for configurable pitch and volume adjustment in the Edge TTS provider. Previously, the _generate_edge_tts() function only read voice and speed from the config, ignoring pitch and volume entirely.

Changes

  • tools/tts_tool.py:

    • Added DEFAULT_EDGE_PITCH = "+0Hz" and DEFAULT_EDGE_VOLUME = "+0%" constants
    • Modified _generate_edge_tts() to read pitch from tts.edge.pitch and volume from tts.edge.volume config
    • Passes both parameters to edge_tts.Communicate() when configured (defaults skip the parameters to maintain backward compatibility)
  • website/docs/user-guide/configuration.md:

    • Added pitch: "+0Hz" and volume: "+0%" options under tts.edge: in the config example
    • Added pitch and volume format documentation explaining the formats (range: -100Hz~+100Hz for pitch, -100%~+100% for volume)

Config Usage

tts:
  provider: "edge"
  edge:
    voice: "zh-TW-HsiaoChenNeural"
    speed: 0.9
    pitch: "+50Hz"   # Higher pitch for cute/childlike voice
    volume: "+10%"   # Slightly louder

Verification

Confirmed that edge_tts.Communicate accepts pitch and volume parameters:

def __init__(
    self, text, voice, *, rate="+0%", volume="+0%", pitch="+0Hz",
    boundary="SentenceBoundary", connector=None, proxy=None,
    connect_timeout=10, receive_timeout=60
)

Source: https://github.com/rany2/edge-tts/blob/master/src/edge_tts/communicate.py

Type Safety

Added explicit type annotation kwargs: Dict[str, Any] for the kwargs dict to satisfy type checkers.

- Add DEFAULT_EDGE_PITCH constant (+0Hz)
- Read pitch from tts.edge.pitch in _generate_edge_tts
- Pass pitch to edge-tts Communicate when configured
- Update documentation with pitch option and format examples

Fixes: edge-tts 預設 config.yaml 沒有讀取音高的選項
- Add DEFAULT_EDGE_VOLUME = "+0%" constant
- Modified _generate_edge_tts() to read volume from tts.edge.volume config
- Pass volume to edge_tts.Communicate() when configured
- Update documentation with volume option and format examples

edge-tts.Communicate accepts: rate, volume, pitch parameters
@ariel-ai-bot ariel-ai-bot changed the title feat(tts): add pitch configuration option for Edge TTS feat(tts): add pitch and volume configuration options for Edge TTS May 8, 2026
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets tool/tts Text-to-speech and transcription labels May 9, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #2965 which adds the same rate/pitch/volume controls for Edge TTS. Consider consolidating.

@ariel-ai-bot

Copy link
Copy Markdown
Author

This PR is a duplicate of #2965, which already implements the same rate/pitch/volume controls for Edge TTS with additional validation, clamping, and test coverage. Closing this to avoid redundant changes.

Thank you @alt-glitch for the review and for pointing this out! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have tool/tts Text-to-speech and transcription type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants