Repository navigation
Separate volumes for music, replies, sounds, timers and calls (#32) - #47
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setting separate_volumes (off by default: one volume, as stock). On, music (the `volume` setting: media player, Sendspin, phone over Bluetooth, play_media), voice replies and announcements, the Echo's sounds, timers and Drop In calls each have a volume 0..100, or follow the music's some points above or below it (<kind>_linked, <kind>_offset -100..100; calls follow it by default, as before). How (Echo Dot 2, docs/re-platform.md): the mixer has MainVolume (Music, Earcon, Voip), TTSVolume (TTS) and AlarmVolume; libasp adds up to +14.5 dB at 90..100 from its own volume, which follows whichever of MainVolume and TTSVolume was set last. So both stay at the loudest kind and each kind is turned down in its PCM by the measured curve (vol_db): audio_music_gain, audio_tts_gain, audio_call_gain, the earcon thread for sounds, timers and the Drop In ringtone. Timers are back on the Earcon stream (Alarm topped out 12 dB under). HA's play_media is music although it plays on the TTS stream; the media player's announcement flag (tts.speak) makes it speech. On a Bluetooth speaker with absolute volume the speaker is set to the loudest kind (a2dp_speaker_volume) and its own buttons move the music. Settings page: a Volume card (one volume / separate; a slider per kind, "Own volume | Follow music", the line under the name says what it plays at; Calls only with Drop In). HA: the media player is the music; numbers Assistant, Sounds, Timer, Call volume while a kind has its own (Call only with Drop In). Volume keys move what plays: a call, a reply (ring in cyan, ring.c's hassmic_assist_NN), a ringing timer, else the music. Exports carry the switches and offsets, never a volume. Also: state/volume.music keeps the music volume while separate (written from volume_sync's tick, outside core_lock), read at start only while state/config says separate; settings_peek takes the last valid line, as loading does; switches are applied before the rest of any file. Measured on the Dot 2 against stock at the same number: replies, media, sounds and timers within 0.3 dB (own volumes) and within 0.8 dB (following the music, fresh references in a noisier room); Voip has Music's curve, 6.5 dB under it at every volume (call mode, stock too). Not measured: the Dot 3's and Echo 2's curves (they use the Dot 2's), a real Bluetooth speaker, a call between two real Echos. Tests: tests/fake_ha_volumes.py (HASSMIC_FAKE_MIXER, HASSMIC_FAKE_SPEAKER: one volume, separate, linked, keys, HA numbers, restarts and stale files, Bluetooth speaker, page, exports), fake_ha_dropin.py (ringtone at the sounds volume via HASSMIC_EARCONS, call volume and keys during a call), fake_ha_ring.py (the cyan steps). make unit, every test of CLAUDE.md and the STUBS=1 builds of all three models pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #32.
What
A new setting, Separate volumes (off by default: one volume, as stock). Switched on, five kinds of audio each get a volume 0–100 %, or follow the music volume some points above or below it ("Follow music"):
media_player.play_mediatts.speakon the media playerHow
The mixer only has MainVolume (Music, Earcon, Voip), TTSVolume (TTS) and AlarmVolume, and libasp boosts the whole output at 90–100 according to whichever of MainVolume/TTSVolume was set last. So both are kept at the loudest kind and every quieter kind is turned down in its own PCM by the Echo's measured volume curve (
vol_db). Details and measurements:docs/re-platform.md,PLAN.md.Measured (Echo Dot 2)
Tested
make unit, every test listed in CLAUDE.md,STUBS=1builds of donut, biscuit and radar.tests/fake_ha_volumes.py; additions tofake_ha_dropin.pyandfake_ha_ring.py.Not tested on hardware: the Echo Dot 3's and Echo 2's curves (they use the Dot 2's), a real Bluetooth speaker, a real call between two Echos.
🤖 Generated with Claude Code