Skip to content

feat: Aivisの再生速度(Speaking Rate)設定を追加#338

Merged
MocA-Love merged 2 commits intomainfrom
zippy-mandolin
Apr 19, 2026
Merged

feat: Aivisの再生速度(Speaking Rate)設定を追加#338
MocA-Love merged 2 commits intomainfrom
zippy-mandolin

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Apr 19, 2026

概要

Issue #337 の対応。Settings > Ringtones の Aivis Voice Announcement に再生速度スライダーを追加。

変更内容

  • AivisSpeakingRateSlider コンポーネントを新規作成(0.5x〜2.0x、ステップ0.1x)
  • AivisSettings.tsx にスライダーを追加(音量スライダーの直下)
  • tRPC getAivisSettings / setAivisSettingsspeakingRate フィールドを追加
  • testAivisPlayback ミューテーションにも speakingRate を追加(テスト再生に反映)
  • aivis-tts.tssynthesize() 関数で Aivis API の speaking_rate パラメーターを送信
  • local-db スキーマに aivis_speaking_rate カラム(real型)を追加
  • Drizzle マイグレーション 0066_add_aivis_speaking_rate.sql を追加

動作

  • デフォルト: 1.0x(既存の動作と同じ)
  • 範囲: 0.5x〜2.0x
  • 音声が有効な場合のみスライダーが表示される

Closes #337

Summary by CodeRabbit

リリースノート

  • 新機能
    • Aivis音声出力の話す速度を調整できるスライダーコントロールをAivis設定に追加しました。ユーザーは0.5倍から2.0倍の範囲で話す速度を変更でき、設定は自動的に保存されます。テスト再生時にも調整した話す速度が反映されます。

Settings > Ringtones の Aivis Voice Announcement に Speaking Rate スライダーを追加。
0.5x〜2.0x の範囲で設定でき、Aivis API の speaking_rate パラメーターとして渡される。
@MocA-Love
Copy link
Copy Markdown
Owner Author

@codex review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 19, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 54 minutes and 10 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 10 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb4c6dad-9e76-4e4b-9e74-675dcf80ea5d

📥 Commits

Reviewing files that changed from the base of the PR and between a54d087 and 38b0f73.

📒 Files selected for processing (2)
  • apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/AivisSpeakingRateSlider.tsx
  • packages/local-db/drizzle/meta/0066_snapshot.json
📝 Walkthrough

Walkthrough

このプルリクエストは、Aivis TTS音声再生速度設定機能を追加します。データベーススキーマ、TRPC手続き、TTS合成機能、UIコンポーネントを拡張し、ユーザーが0.5~2.0の範囲で再生速度を制御できるようにします。

Changes

Cohort / File(s) Summary
Database Schema
packages/local-db/drizzle/0066_add_aivis_speaking_rate.sql, packages/local-db/drizzle/meta/0066_snapshot.json, packages/local-db/drizzle/meta/_journal.json, packages/local-db/src/schema/schema.ts
新しくaivis_speaking_rate column(real型)をsettingsテーブルに追加し、Drizzleマイグレーション履歴とスキーマスナップショットを更新。
Backend TRPC API
apps/desktop/src/lib/trpc/routers/settings/index.ts
getAivisSettingsspeakingRateフィールドを追加(範囲[0.5, 2.0]、デフォルト1.0)。setAivisSettingstestAivisPlaybackにオプションのspeakingRate入力フィールドを追加。
Backend TTS実装
apps/desktop/src/main/lib/notifications/aivis-tts.ts
playAivisTts関数にオプションのspeakingRateパラメータを追加。内部synthesize関数でspeaking_rateをリクエストボディに含める処理を実装。
Frontend UI コンポーネント
apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/AivisSettings.tsx, apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/AivisSpeakingRateSlider.tsx, apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/index.ts
新しいAivisSpeakingRateSliderコンポーネントを作成し、スライダーUIで再生速度設定を提供。AivisSettingsで新コンポーネントをインテグレーション。

Sequence Diagram

sequenceDiagram
    participant User as ユーザー
    participant UI as AivisSettings UI
    participant TRPC as TRPC Server
    participant DB as Database
    participant TTS as Aivis TTS

    User->>UI: 再生速度スライダーを操作
    UI->>TRPC: setAivisSettings(speakingRate: 1.5)
    TRPC->>DB: UPDATE settings SET aivisSpeakingRate = 1.5
    DB-->>TRPC: 設定保存完了
    TRPC-->>UI: 設定更新成功
    UI-->>User: UI更新(新しい再生速度を表示)

    User->>UI: テスト再生ボタンをクリック
    UI->>TRPC: testAivisPlayback(text, speakingRate: 1.5)
    TRPC->>TTS: playAivisTts(..., speakingRate: 1.5)
    TTS->>TTS: synthesize(speaking_rate: 1.5をリクエストに含む)
    TTS-->>User: 設定された再生速度で音声を再生
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 ウサギが走る、設定の森で
再生速度、つまみをくるくる回し
0.5から2.0へ、音声踊り
データベースに刻まれたドブル鼓動
ホップ、ステップ、新機能ジャンプ! 🎵

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed タイトルはプルリクエストの主な変更内容を正確に反映しており、Aivis の再生速度設定追加という主要な機能追加を明確に説明しています。
Description check ✅ Passed プルリクエストの説明は、変更内容、実装の詳細、動作仕様が明確に記述されており、関連するIssue #337 も明記されていますが、テンプレートの「Type of Change」「Testing」「Screenshots」セクションが記入されていません。
Linked Issues check ✅ Passed Issue #337 で要求された Aivis Voice Announcement の再生速度制御機能が完全に実装されています。speakingRate パラメーターをスライダー UI、tRPC スキーマ、Aivis API 呼び出し、データベーススキーマに統合した実装が確認できます。
Out of Scope Changes check ✅ Passed すべての変更が Issue #337 で要求された Aivis 再生速度設定機能に直接関連しており、範囲外の変更は認められません。データベーススキーマ追加、tRPC インターフェース拡張、UI コンポーネント追加、TTS API 統合がすべて一貫した目標の達成に向けたものです。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch zippy-mandolin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a54d087fc4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/local-db/drizzle/meta/0066_snapshot.json Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/AivisSpeakingRateSlider.tsx (1)

19-26: hydrated ref と useEffect は実質的にデッドコードです。

hydrated.currenttrue にセットしているだけで、以降どこからも参照されていません。display = draft ?? data?.speakingRate ?? 1.0 で既にハイドレーション前後の表示は正しく扱えているため、削除してシンプルにできます。

♻️ 提案する修正
 	const [draft, setDraft] = useState<number | null>(null);
-	const hydrated = useRef(false);
-
-	useEffect(() => {
-		if (!data || hydrated.current) return;
-		hydrated.current = true;
-	}, [data]);

 	const display = draft ?? data?.speakingRate ?? 1.0;

併せて未使用になった useEffect / useRef のインポートも整理してください。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/AivisSpeakingRateSlider.tsx`
around lines 19 - 26, Remove the dead hydration logic: delete the hydrated ref
(hydrated/useRef) and the related useEffect block in AivisSpeakingRateSlider so
the component simply uses display = draft ?? data?.speakingRate ?? 1.0; then
remove unused imports useEffect and useRef from the file and run a quick linter
to ensure no other references to hydrated remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/local-db/drizzle/meta/_journal.json`:
- Around line 466-473: The new journal entry with idx 66 and tag
"0066_add_aivis_speaking_rate" has a hardcoded when: 1745078400000 that is
earlier than the previous entry (1776551275327); fix by regenerating the
journal/snapshot/migration for this change using drizzle-kit (e.g., run
drizzle-kit generate in packages/local-db/) so the when value is set to the
current epoch ms and entries remain time-ordered, or if you must edit manually
update the when field to a timestamp greater than 1776551275327; avoid manual
edits and prefer regeneration so idx: 66, version: "6", and SQL artifacts stay
consistent.

In `@packages/local-db/drizzle/meta/0066_snapshot.json`:
- Around line 4-5: The snapshot file contains manually set "id" and "prevId"
values ("snapshot_0066") which must be UUIDs and should chain to the previous
snapshot; regenerate the migration artifacts so "id" and "prevId" are proper
UUIDs and prevId points to the previous snapshot (e.g., the UUID for
snapshot_0065) by running the schema update flow and executing `drizzle-kit
generate` to recreate the SQL/journal/snapshot set rather than editing "id" and
"prevId" by hand.

---

Nitpick comments:
In
`@apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/AivisSpeakingRateSlider.tsx`:
- Around line 19-26: Remove the dead hydration logic: delete the hydrated ref
(hydrated/useRef) and the related useEffect block in AivisSpeakingRateSlider so
the component simply uses display = draft ?? data?.speakingRate ?? 1.0; then
remove unused imports useEffect and useRef from the file and run a quick linter
to ensure no other references to hydrated remain.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dde2a57f-c457-4f18-8124-af07e86ff77a

📥 Commits

Reviewing files that changed from the base of the PR and between d81b911 and a54d087.

📒 Files selected for processing (9)
  • apps/desktop/src/lib/trpc/routers/settings/index.ts
  • apps/desktop/src/main/lib/notifications/aivis-tts.ts
  • apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/AivisSettings.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/AivisSpeakingRateSlider.tsx
  • apps/desktop/src/renderer/routes/_authenticated/settings/ringtones/components/AivisSettings/components/AivisSpeakingRateSlider/index.ts
  • packages/local-db/drizzle/0066_add_aivis_speaking_rate.sql
  • packages/local-db/drizzle/meta/0066_snapshot.json
  • packages/local-db/drizzle/meta/_journal.json
  • packages/local-db/src/schema/schema.ts

Comment thread packages/local-db/drizzle/meta/_journal.json
Comment thread packages/local-db/drizzle/meta/0066_snapshot.json Outdated
@MocA-Love
Copy link
Copy Markdown
Owner Author

CodeRabbitのレビューを対応しました:

  • dead code(hydrated ref / useEffect)を除去
  • スナップショットの id/prevId を適切な UUID に修正

@MocA-Love MocA-Love merged commit c68f49a into main Apr 19, 2026
14 checks passed
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.

[bug] Aivisの設定を追加

1 participant