Skip to content

Use the Voice Preview Edition sounds for CarPlay Assist cues - #5696

Draft
bgoncal wants to merge 8 commits into
mainfrom
carplay-assist-voice-pe-sounds
Draft

Use the Voice Preview Edition sounds for CarPlay Assist cues#5696
bgoncal wants to merge 8 commits into
mainfrom
carplay-assist-voice-pe-sounds

Conversation

@bgoncal

@bgoncal bgoncal commented Sep 8, 2026

Copy link
Copy Markdown
Member

AI Policy

Select exactly one option that describes AI usage in this contribution:

  • I have not used AI for this contribution.
  • AI assistance was used for this contribution.
  • AI fully generated the code for this contribution, but I've reviewed and understood it before submitting and will respond without AI during review.

Summary

CarPlay Assist played synthesized sine-wave chimes for its feedback tones. It now plays the Home Assistant Voice Preview Edition sounds (CC BY 4.0, Clayton Charles Tapp), so the car sounds like the rest of the Assist hardware:

  • Listening: wake_word_triggered
  • Listening stopped and processing (one cue, they happen at the same instant): mute_switch_off
  • Error: mute_switch_on

The tone player loads the bundled Apple Lossless files instead of generating WAV data, still through the shared Assist audio session so the cues follow the car route and ignore the ring/silent switch. The listening-stopped cue is stopped when TTS playback starts so the response never layers over it and the session can be reconfigured without a player still running. The files were converted losslessly from FLAC to Apple Lossless and had their trailing silence trimmed, the audio is otherwise unchanged.

Screenshots

No visual change.

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

Copilot AI lite review requested due to automatic review settings September 8, 2026 11:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

CarPlayAssistTonePlayer.Tone.resourceName currently lacks a return and will not compile (and one new test is duration-dependent/flaky).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates CarPlay Assist’s audible feedback cues to use bundled Home Assistant Voice Preview Edition sounds (FLAC) instead of synthesized tones, aligning CarPlay’s cue sounds with other Assist hardware while continuing to route audio through the shared Assist audio session.

Changes:

  • Replace generated WAV tone synthesis with bundled Voice Preview Edition FLAC assets, keyed by tone type.
  • Update CarPlay Assist session tone triggers (listening vs listening-stopped) and stop any cue playback before starting TTS playback.
  • Add unit tests to validate bundled tone availability and tone-player completion/interrupt behavior, plus add attribution documentation for the sound assets.
File summaries
File Description
Tests/App/CarPlay/CarPlayAssistTonePlayer.test.swift Adds unit tests for tone resource presence and tone-player completion/stop semantics.
Tests/App/CarPlay/CarPlayAssistSession.test.swift Updates expectations to the new tone names/behavior.
Sources/CarPlay/Templates/QuickAccess/CarPlayAssistTonePlayer.swift Switches tone playback to bundled FLAC files and introduces tone-to-resource mapping.
Sources/CarPlay/Templates/QuickAccess/CarPlayAssistSession.swift Updates which cues are played and stops cues prior to TTS session reconfiguration/playback.
Sources/App/Resources/Sounds/Assist/LICENSE.md Adds attribution/license documentation for the bundled sounds.
HomeAssistant.xcodeproj/project.pbxproj Adds the new license file to the Resources synchronized group exceptions for the App target.
Review details
  • Files reviewed: 6/9 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Sources/CarPlay/Templates/QuickAccess/CarPlayAssistTonePlayer.swift
Comment thread Tests/App/CarPlay/CarPlayAssistTonePlayer.test.swift Outdated
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 2 unused localization strings in the codebase.

Click to see details
Parsing Strings.swift...
Found 2856 L10n strings

Reading all Swift source code...
Read 11605310 characters of Swift code

Checking for unused strings...
Checked 100/2856 strings...
Checked 200/2856 strings...
Checked 300/2856 strings...
Checked 400/2856 strings...
Checked 500/2856 strings...
Checked 600/2856 strings...
Checked 700/2856 strings...
Checked 800/2856 strings...
Checked 900/2856 strings...
Checked 1000/2856 strings...
Checked 1100/2856 strings...
Checked 1200/2856 strings...
Checked 1300/2856 strings...
Checked 1400/2856 strings...
Checked 1500/2856 strings...
Checked 1600/2856 strings...
Checked 1700/2856 strings...
Checked 1800/2856 strings...
Checked 1900/2856 strings...
Checked 2000/2856 strings...
Checked 2100/2856 strings...
Checked 2200/2856 strings...
Checked 2300/2856 strings...
Checked 2400/2856 strings...
Checked 2500/2856 strings...
Checked 2600/2856 strings...
Checked 2700/2856 strings...
Checked 2800/2856 strings...

================================================================================
UNUSED STRINGS REPORT
================================================================================

Found 2 unused strings:


APPINTENTS:
  - L10n.AppIntents.ActiveEntities.Filter.climates
    Key: app_intents.active_entities.filter.climates
    Line: 297
  - L10n.AppIntents.ActiveEntities.Filter.locks
    Key: app_intents.active_entities.filter.locks
    Line: 305

================================================================================
Total unused: 2
================================================================================

================================================================================
Copy-paste these keys into the "Lokalise: Delete Keys" workflow (keys input):
================================================================================
app_intents.active_entities.filter.climates,app_intents.active_entities.filter.locks

To remove them, run the
Lokalise: Delete Keys
workflow — it deletes the keys from Lokalise and opens a PR removing them from
Localizable.strings and regenerating Strings.swift. Copy-paste these keys into the keys input:

app_intents.active_entities.filter.climates,app_intents.active_entities.filter.locks

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Several renamed tone concepts now read inconsistently with their usage (and an existing debug setting name), which will be confusing to maintain and should be reconciled before merging.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

Sources/CarPlay/Templates/QuickAccess/CarPlayAssistSession.swift:551

  • The debug flag playRecordingIndicatorTone now gates a “listening started” sound (.listening). This makes the setting name and its localized label misleading. Consider renaming the setting (and localization key) to match the new semantics so debug UI/options remain understandable.
    Sources/CarPlay/Templates/QuickAccess/CarPlayAssistSession.swift:555
  • playListeningStoppedTone() is used as the generic “processing started” cue (including the text-input path), so the name and underlying Tone.listeningStopped read misleadingly when no listening actually occurred. Consider renaming this concept back to .processing (or similar) and mapping that semantic tone to the Voice PE file name, so call sites remain self-explanatory.
  • Files reviewed: 6/9 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

A couple of in-code names/comments are now misleading after the tone rename (e.g., “recording indicator” vs “listening”), and should be aligned to avoid confusion.

Review details

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

Sources/CarPlay/Templates/QuickAccess/CarPlayAssistSession.swift:550

  • playListeningToneIfNeeded() still gates on playRecordingIndicatorTone, which is confusing now that the tone is explicitly named “listening” (and Tone.startRecording no longer exists). Consider aligning the debug setting name and/or the helper method name to avoid ambiguity about what the toggle controls.
    Tests/App/CarPlay/CarPlayAssistSession.test.swift:248
  • The comment mentions the “recording indicator tone”, but the test now waits for the .listening tone. This makes the test comment inaccurate/misleading.
  • Files reviewed: 6/9 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 tone player is configured to load/play .flac files via AVAudioPlayer, which is likely unsupported on iOS and would break cue playback at runtime.

Review details

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

Sources/CarPlay/Templates/QuickAccess/CarPlayAssistTonePlayer.swift:41

  • AVAudioPlayer generally doesn't support decoding FLAC on iOS (Apple’s docs list AAC/ALAC/MP3/linear PCM, but not FLAC). With resourceExtension = "flac", tone playback is likely to fail at runtime (silent cues / immediate error path).

Consider re-encoding these cue files to a supported format (e.g. .m4a AAC or .caf/ALAC) and updating resourceExtension accordingly (and ensuring the new files are bundled).

  • Files reviewed: 6/9 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The project file currently lists Sounds/Assist/LICENSE.md under a build-file exception set, which likely prevents shipping attribution in the app bundle alongside CC BY sound assets.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 6/9 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread HomeAssistant.xcodeproj/project.pbxproj
@bgoncal
bgoncal marked this pull request as draft September 8, 2026 12:19
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 41.98%. Comparing base (d99a0d6) to head (694a83a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5696      +/-   ##
==========================================
+ Coverage   41.59%   41.98%   +0.38%     
==========================================
  Files        1108     1108              
  Lines       77099    77346     +247     
==========================================
+ Hits        32073    32470     +397     
+ Misses      45026    44876     -150     
Files with missing lines Coverage Δ
...y/Templates/QuickAccess/CarPlayAssistSession.swift 68.36% <100.00%> (+11.51%) ⬆️
...emplates/QuickAccess/CarPlayAssistTonePlayer.swift 89.83% <100.00%> (+87.85%) ⬆️

... and 42 files with indirect coverage changes

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants