Repository navigation
feat(voice-settings): Add support for adjusting TTS playback speed - #708
Conversation
- Added `ttsSpeed` configuration in `AppConfig`. - Updated `VoiceSettingsSection` to include a slider for adjusting TTS speed. - Modified `OpenAiTextToSpeechService` and `PiperTextToSpeechService` to handle the new speed parameter. - Updated i18n messages for `tts_speed` in multiple languages.
There was a problem hiding this comment.
🟡 Changes recommended
There are correctness issues in the new TTS HTTP path (Piper endpoint path and gzip/binary handling) that can cause failed synthesis or corrupted audio/error bodies.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds a configurable TTS playback speed setting to the app’s voice configuration and UI, and threads it through the OpenAI and local Piper TTS implementations by switching TTS calls to direct HTTP requests that can include the speed parameter and correctly handle binary audio responses.
Changes:
- Add
ttsSpeedtoVoiceConfig(default1.0) and persist/update it viaAppConfig.updateField. - Add a “Speed” slider to the desktop Voice settings UI and localize its label/hint across supported languages.
- Update OpenAI + Piper TTS services to send
speedin the request body and fetch audio as raw bytes.
File summaries
| File | Description |
|---|---|
| shared/src/main/kotlin/io/askimo/core/util/HttpUtils.kt | Adds httpPostForBytes helper for binary POST responses (used by TTS). |
| shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt | Adds ttsSpeed to voice config, defaults, and update-field parsing/clamping. |
| desktop/src/main/kotlin/io/askimo/desktop/settings/VoiceSettingsSection.kt | Adds a slider + debounced persistence for TTS speed in Settings UI. |
| desktop-shared/src/main/resources/i18n/messages.properties | Adds English strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_zh_TW.properties | Adds zh-TW strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_zh_CN.properties | Adds zh-CN strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_vi_VN.properties | Adds vi-VN strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_pt_BR.properties | Adds pt-BR strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_ko_KR.properties | Adds ko-KR strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_ja_JP.properties | Adds ja-JP strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_fr.properties | Adds fr strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_es.properties | Adds es strings for TTS speed label/hint. |
| desktop-shared/src/main/resources/i18n/messages_de.properties | Adds de strings for TTS speed label/hint. |
| desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/PiperTextToSpeechService.kt | Switches Piper TTS to direct HTTP with speed and WAV response. |
| desktop-shared/src/main/kotlin/io/askimo/ui/voice/impl/OpenAiTextToSpeechService.kt | Switches OpenAI TTS to direct HTTP with speed and MP3 response. |
Review details
- Files reviewed: 15/15 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
ttsSpeed update parsing currently allows non-finite values (NaN/Infinity) to persist, which can break downstream UI/consumers expecting a finite slider-compatible number.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt:1379
ttsSpeedparsing/clamping should also reject non-finite values (NaN/Infinity). As written, values like "NaN" will parse successfully and survivecoerceIn, which can propagate into UI/state and break consumers expecting a finite slider value.
shared/src/main/kotlin/io/askimo/core/config/AppConfig.kt:1379- New
ttsSpeedupdate behavior (type coercion + clamping) isn't covered by the existing AppConfig update-field tests; adding a focused unit test would help prevent regressions (e.g., numeric/string inputs and out-of-range values).
- Files reviewed: 15/15 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🔵 Needs a closer look
The new speed slider should defensively clamp the initial ttsSpeed value loaded from YAML to avoid potential out-of-range Slider runtime issues.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
desktop/src/main/kotlin/io/askimo/desktop/settings/VoiceSettingsSection.kt:130
AppConfig.rawVoice.ttsSpeedcan come from askimo.yml and may be out of the Slider's allowed range (0.25–4.0), which can cause the Material Slider to throw or render inconsistently; clamp it when initializing UI state.
- Files reviewed: 16/16 changed files
- Comments generated: 0 new
- Review effort level: Lite
ttsSpeedconfiguration inAppConfig.VoiceSettingsSectionto include a slider for adjusting TTS speed.OpenAiTextToSpeechServiceandPiperTextToSpeechServiceto handle the new speed parameter.tts_speedin multiple languages.