Skip to content

feat(voice-settings): Add support for adjusting TTS playback speed - #708

Merged
haiphucnguyen merged 3 commits into
mainfrom
feature/support-adjusting-speed-for-tts
Sep 8, 2026
Merged

haiphucnguyen merged 3 commits into
mainfrom
feature/support-adjusting-speed-for-tts

Conversation

@haiphucnguyen

Copy link
Copy Markdown
Collaborator
  • 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.

- 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.
Copilot AI lite review requested due to automatic review settings September 8, 2026 22:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 ttsSpeed to VoiceConfig (default 1.0) and persist/update it via AppConfig.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 speed in 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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

  • ttsSpeed parsing/clamping should also reject non-finite values (NaN/Infinity). As written, values like "NaN" will parse successfully and survive coerceIn, 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 ttsSpeed update 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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.ttsSpeed can 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

@haiphucnguyen
haiphucnguyen merged commit 3c9c7ef into main Sep 8, 2026
11 checks passed
@haiphucnguyen
haiphucnguyen deleted the feature/support-adjusting-speed-for-tts branch September 8, 2026 23:14
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.

2 participants