Open Bug 1550373 Opened 6 years ago Updated 2 years ago

Buzzing noise when changing volume while the audio is playing

Categories

(Core :: Audio/Video, defect, P3)

Desktop
Linux
defect

Tracking

()

People

(Reporter: sefeng, Unassigned)

Details

Attachments

(3 files)

I am using Linux and running Firefox 66.0.3

Please play the attached file in Firefox.

While the audio is playing, changing the volume would cause the audio start buzzing.

This issues seems only happen on Linux, and I don't see the same issue on Chrome. Actually, Chrome does it smart, it turned off the volume entirely during the volume is changing.

I feel this could be a Linux thing because I experience the same issue when I play the file in a music player locally.

I noticed this url returns 403 (However it works fine on my personal machine). I'll update the bug.

Flags: needinfo?(sefeng)
Attached audio test_file.mp3

Added a test file that can reproduce the problem.

Flags: needinfo?(sefeng)
OS: Unspecified → Linux
Hardware: Unspecified → Desktop

Based on this getting more actionable only in comment 2, Nico - could you triage this?

Flags: needinfo?(na-g)

Sean, does your linux desktop environment make an indicator noise when you change your volume? I suspect we are configuring the pulse audio output to a 48Khz sample rate, and when the system plays a sound it reverts the device to its default sample rate which is probably 44.1Khz.

The pulse audio config is usually in /etc/pulse/daemon.conf. You may want to make a copy of that before proceeding. Would you be willing to try looking for the line ;default-sample-rate = 44100 and adding a new line default-sample-rate = 48000 under it? (Note the lack of ; at the beginning.) Then you can restart your machine, and test again.

Flags: needinfo?(na-g) → needinfo?(sefeng)

Hi Nico, I tried the that, it didn't work. I still hear the same noise, and I don't think it is indicator noise. I just tried to play the same audio on Brave Browser, and it didn't produce this buzzing noise, so I feel it is our problem...

Flags: needinfo?(sefeng)

FWIW I cannot reproduce this on Ubuntu 18.04. Sean, can you share more specifics about your machine setup? Would you be able to record the buzzing noise as it happens to you?

Paul, does this ring any bells to you?

Flags: needinfo?(sefeng)
Flags: needinfo?(padenot)

Also, are you changing system volume or media element volume?

Sean, would you mind giving us the following info:

  • the result of grep "flat-volume" /etc/pulse/daemon.conf on the affected system.
  • the result of pactl list on the affected system

in addition to Andreas' question above (system or application volume).

Flags: needinfo?(padenot)
Attached video noise.webm
Flags: needinfo?(sefeng)

the result of grep "flat-volume" /etc/pulse/daemon.conf on the affected system: https://pastebin.com/MmVy04bH
the result of pactl list on the affected system: https://pastebin.com/GwtAfWCq

I was changing media element volume.

In terms of the setup, I didn't do anything special, I was running PopOS which was based on Ubuntu 19.04.

I attached a video to show what I heard.

Please feel free to ask me to provide more info.

Can you flip with the pref media.cubeb.sandbox to false and retry ?

Still the same issue.

If that still happens after restart it's a bug in pulse. Maybe we should just stop trying to use their volume API altogether.

It became even worse after I did a restart withmedia.cubeb.sandbox set to false. I heard the noises regularly and I didn't event need to adjust volume.

Do we know what Chromium does? It works perfectly for me in Brave Browser.

Attached video left_right.ogg

I aligned the samples in audacity, the noisy sample is the right channel, and the clean sample is the left channel. You can see that there is a significant sync drift in only 11 seconds of playout.,

Yeah it's under-runs, thanks for confirming it Nico. This might be because we lock the pulse main loop and wait for the volume operation to complete, in the pulse backend.

I'll try to get you a build today to check things, as I can't repro.

Chromium applies the volume on the client side (i.e. in the Chromium process), instead of using the PulseAudio API. This works, but the following scenario:

  • Play with volume to 1.0
  • Pause
  • Set volume to 0.0
  • Play

results in an audible burst of audio after muting (unlike using the PulseAudio API, where the gain is applied in the PulseAudio mixer). This is what we do is flat-volume is enabled, because it has other problems.

When I played the music in Brave, it didn't pause the audio and didn't produce any noises, so it sounds like they made some adjustments?

No they simply do the volume in their process. I don't know why Chrome pauses the media.

It seems that this issue is not reproducible for everyone, so I am going to make it as P3. Free feel to re-prioritize it.

Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: