fix(tts): filter emoji characters from text-to-speech input - #18598
Closed
Jasonlib wants to merge 1 commit into
Closed
fix(tts): filter emoji characters from text-to-speech input#18598Jasonlib wants to merge 1 commit into
Jasonlib wants to merge 1 commit into
Conversation
Add emoji regex filter to all TTS text preprocessing paths to prevent voice engines from attempting to pronounce emoji characters. Affected files: - tools/tts_tool.py: _strip_markdown_for_tts() - cli.py: _voice_speak_response() - hermes_cli/voice.py: speak_text() Fixes issue where emojis would be read as literal characters by TTS, degrading voice output quality.
Collaborator
3 tasks
teknium1
reviewed
Jul 12, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for targeting a real TTS cleanup gap.
Problems
- The added
tools/tts_tool.pyfilter only changes_strip_markdown_for_tts(). The agent-callabletext_to_speech_tool()still forwards rawtextto providers, including ElevenLabs attools/tts_tool.py:2284, OpenAI attools/tts_tool.py:2295, and Edge attools/tts_tool.py:2371. The PR therefore does not cover a live TTS entry point. - The PR changes no test files. Current sanitizer coverage at
tests/tools/test_voice_cli_integration.py:48-123covers Markdown stripping only.
Suggested changes
- Centralize emoji normalization and invoke it at the
text_to_speech_tool()boundary, then reuse it from the gateway/streaming helper and CLI/TUI voice paths. - Add focused direct-tool, streaming, and emoji-sequence regression tests.
Automated hermes-sweeper review.
| text = _MD_HR.sub('', text) | ||
| text = _MD_EXCESS_NL.sub('\n\n', text) | ||
| # Strip emojis so TTS doesn't read out emoji descriptions | ||
| text = re.sub(r'[\U0001F600-\U0001F64F' # emoticons |
Contributor
There was a problem hiding this comment.
This helper is not called by text_to_speech_tool(): current main dispatches its raw text argument directly to every provider. Please extract a shared normalizer and invoke it at the tool boundary as well, so agent-issued text_to_speech calls receive the same cleanup.
1 task
Contributor
This was referenced Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add emoji regex filter to all TTS text preprocessing paths to prevent voice engines from attempting to pronounce emoji characters.
Problem
When users send messages with emojis (😊, 👍, etc.), the text-to-speech engines (Edge TTS, ElevenLabs, MiniMax, etc.) attempt to pronounce them as literal characters (e.g., "smiling face with smiling eyes", "thumbs up"). This degrades voice output quality and creates awkward listening experiences.
Solution
Add an emoji regex filter to all TTS text preprocessing functions:
tools/tts_tool.py:_strip_markdown_for_tts()cli.py:_voice_speak_response()hermes_cli/voice.py:speak_text()The regex pattern covers the full Unicode emoji range:
Testing
Verified locally:
Files Changed
cli.py: +2 lineshermes_cli/voice.py: +2 linestools/tts_tool.py: +13 linesTotal: 17 insertions, 0 deletions