Skip to content

Fix Tichro voice falling back to M3 (case-sensitive lookup) - #6

Merged
Osiris-DevWorks merged 4 commits into
mainfrom
fix/voice-name-case-insensitive
May 17, 2026
Merged

Osiris-DevWorks merged 4 commits into
mainfrom
fix/voice-name-case-insensitive

Conversation

@Osiris-DevWorks

@Osiris-DevWorks Osiris-DevWorks commented May 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bug fix: any user whose super_tts.user_preferences.voice_name was written before voice_set started normalizing case (e.g. stored as 'tichro' instead of 'Tichro') was silently routed to the engine default voice. SupertonicEngine did two case-sensitive lookups on the incoming voice_name — the AVAILABLE_VOICES membership check (tts/supertonic_engine.py:152) and the pre-cache lookup (:164) — and both missed. The /voice set command still echoed the canonical name back, so the user thought their pref was right but heard M3.
  • Config-path cleanup: the cog was reading tts.model and tts.engines.<model>.* from config.yaml, but the actual layout is tts.supertonic.*. engine_config was always {} in practice, so the configured device and default voice never reached the engine and it always fell back to the function-signature defaults. Rewired the cog + factory to read the real layout. Updated config.yaml's default voice from the dead 'custom' (no corresponding style ships) to 'M3', and hardened the engine init to warn-and-fall-back if a future config typo names an unknown voice rather than crashing on FileNotFoundError.
  • Data migration: db/migrations/migrate_02_canonicalize_voice_name_case.sql heals existing rows in user_preferences.voice_name and voice_claims.voice_id to canonical casing. Runs as part of the standard migrate_*.sql phase; idempotent re-runs touch 0 rows.
  • Docs: rolled in the v0.1.0 GUI/installer track documentation that CLAUDE.md was missing (PyQt6 shell, BotRunner threading, persistence split, PyInstaller + Inno Setup pipeline).

Test plan

  • Pre-fix reproduction: instantiated SupertonicEngine the same way the cog builds it, then synthesize(voice_name='tichro') returned audio whose shape and md5 matched M3, not Tichro.
  • Post-fix: every casing of 'tichro' ('Tichro', 'tichro', 'TICHRO', 'TiChRo') now produces the Tichro-shape audio buffer. 'M3'/'m3' produce M3. 'bogus' still falls back to M3 with the existing Invalid voice …, using default M3 warning.
  • Config-path fix end-to-end: engine_config from tts.supertonic: {'device': 'auto', 'voice': 'M3'} actually reaches the engine now; the resilience guard catches a deliberately bogus 'NotAReal' voice and falls back to M3 with a warning rather than aborting startup with FileNotFoundError.
  • Apply the migration to staging and confirm a re-run touches 0 rows.
  • Have Tichro retry /voice set tichro and a TTS message in voice channel.

🤖 Generated with Claude Code

Osiris-DevWorks and others added 4 commits May 16, 2026 21:12
SupertonicEngine did two case-sensitive lookups on the incoming voice_name
— the AVAILABLE_VOICES membership check and the pre-cache lookup. A
user_preferences.voice_name row written before voice_set normalized casing
(e.g. 'tichro' instead of 'Tichro') would miss both, log "Invalid voice
…, using default M3", and synthesize with the engine's instance default
instead. The set-voice command still echoed the canonical name back, so
the user thinks they're on Tichro but hears M3.

Normalize selected_voice through a {lower(): canonical} index at synth
time so any historical casing maps to the right pre-cached style. Invalid
voices still log the existing warning and fall back to the default.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The existing CLAUDE.md covered the Docker/Railway server path but
predated v0.1.0's GUI installer work. Adds sections for the PyQt6 GUI
shell (gui_main.py, BotRunner threading, tab layout, .env vs QSettings
persistence split), the PyInstaller + Inno Setup build pipeline
(VERSION.TXT as version source, hiddenimports, AppId GUID, build_all.bat
parser quirks), and touches up Bootstrap + Configuration sections to
mention SUPER_TTS_GUI_MODE and the %APPDATA% .env path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The cog was reading tts.engines.<model>.* and tts.model from config.yaml,
neither of which has ever existed in this repo's config layout. engine_config
silently came back as {}, so the configured device and default voice never
reached SupertonicEngine — it always fell through to the function-signature
defaults (device='auto', voice='M3'). Aligned the cog and factory with the
actual tts.supertonic.* layout, and updated the config's default voice from
the dead 'custom' (no corresponding voice style ships) to 'M3'.

Also hardened SupertonicEngine.__init__ to validate the requested default
voice against AVAILABLE_VOICES case-insensitively and warn+fall-back to M3
if it's unknown, so a future config typo doesn't take down the bot at
startup with a FileNotFoundError from get_voice_style.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Heals existing user_preferences.voice_name and voice_claims.voice_id rows
written before voice_set / claim_voice normalized case (e.g. 'tichro' →
'Tichro'). Runs in the standard migrate_*.sql phase per
db/init_db.py:execute_sql_files. Idempotent: WHERE clauses only match
rows whose stored value differs from the canonical form, so re-runs
touch 0 rows.

The runtime fix in tts/supertonic_engine.py already makes the bug
non-symptomatic, but tidying the stored data prevents future ambiguity
and makes /voice get show the right thing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Osiris-DevWorks
Osiris-DevWorks merged commit fe804e2 into main May 17, 2026
1 check passed
@Osiris-DevWorks Osiris-DevWorks changed the title Fix/voice name case insensitive Fix Tichro voice falling back to M3 (case-sensitive lookup) May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant