Skip to content

feat(audio): implement volume change audio notifications - #558

Open
romanstingler wants to merge 1 commit into
MalpenZibo:mainfrom
romanstingler:feature/audio-beep
Open

feat(audio): implement volume change audio notifications#558
romanstingler wants to merge 1 commit into
MalpenZibo:mainfrom
romanstingler:feature/audio-beep

Conversation

@romanstingler

@romanstingler romanstingler commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

Based on the discussion in #525 and the follow-up conversation.

After we agreed to move away from spawning external processes (pw-cat), I first looked into rodio but that would pull in libasound2-dev as an additional system dependency, which I wanted to avoid to keep the dependency footprint small.

Instead I switched to libpulse-simple-binding which reuses the already required libpulse.so, so no new system library is needed while still giving us "real" audio playback.

What changed from the original approach:

  • The beep is now a short embedded PCM sample (assets/bell.pcm) played directly via PulseAudio's simple API.
    (I tried to synthesize this one but it is too complex and sounds really off otherwise).
  • Playback runs on a single long-lived background thread holding one Pulse connection, so repeated beeps don't each pay a fresh connection handshake.
  • Rate-limiting is built in: a beep only plays if the volume changed by at least 4% and at least 150ms passed since the last one, preventing overlapping sounds (no more PID tracking hacks).
  • Triggered on slider drags, scroll wheel, mute toggles, and IPC volume keys, for both sink and source.
  • audio_feedback is configurable in [settings] (default: true), and hot-reloadable.
    @MalpenZibo your call on the default value

Docs updated accordingly.

closes #525

@MalpenZibo

Copy link
Copy Markdown
Owner

I was thinking that now that we were able to reduce the number of dependencies we could evaluate to use rodio.

We should probably need to add some dependency in the package and nix config to be able to compile.

So we could proceed by step. If this solution is acceptable let's merge and see, then if it's used and adding rodio is not a pain in the ass we can proceed adding a "real" audio support

@romanstingler
romanstingler marked this pull request as ready for review April 30, 2026 19:15
@romanstingler

Copy link
Copy Markdown
Collaborator Author

agree, we can add this one and if there is more demand we can just rework it.
rebased

@MalpenZibo

Copy link
Copy Markdown
Owner

Does this still make sense?

@romanstingler

Copy link
Copy Markdown
Collaborator Author

@MalpenZibo I think people still want this
if you would like I can re-implement this using rodio.

@MalpenZibo

Copy link
Copy Markdown
Owner

@romanstingler ok! let's try

@romanstingler
romanstingler force-pushed the feature/audio-beep branch 2 times, most recently from 7bf32f0 to 072605f Compare August 10, 2026 20:05
@romanstingler

Copy link
Copy Markdown
Collaborator Author

@MalpenZibo ready to test

if let Some(service) = self.service.as_mut() {
if let Some(value) = message.value() {
let _ = service.command(AudioCommand::SourceVolume(value));
self.audio_feedback.play(value);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Feedback on source volume change seems unusual.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature request] Audio slider beep

3 participants