Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Distorted sound when playing via HDMI

Graphical Environments, Managers, Multimedia & Desktop questions.
Post Reply
Message
Author
undesign
Posts: 108
Joined: 2015-05-27 09:03
Has thanked: 8 times
Been thanked: 8 times

Distorted sound when playing via HDMI

#1 Post by undesign »

I have Dell 9020m system and:
- the sound is distorted when playing via HDMI (monitor with speakers) OR simply stops after a minute or two
- when playing via the normal (analog) interface (via external speakers) the sound is normal
- the initial Windows installation worked perfectly, so it is not a hardware/cable issue

At the beginning, there was no sound via HDMI interface and immediately I commute to HDMI sound the YT video (for instance) started to play very fast (like 4x at least). I did some research and now I manage to have distorted sound and the pulseaudio crashes after a while anyway.


/etc/pulse/daemon.conf looks like this:

Code: Select all

resample-method = ffmpeg
enable-remixing = yes
flat-volumes = no
default-sample-rate = 48000
avoid-resampling = yes ; without this there is no sound and the image is played very slow
default-fragments = 3
default-fragment-size-msec = 10
I've played with the two latest values, all I got was some variation of the distorsion.


/etc/pulse/default.pa looks like this:

Code: Select all

.fail
load-module module-device-restore
load-module module-stream-restore
load-module module-card-restore
load-module module-augment-properties
load-module module-switch-on-port-available
.ifexists module-udev-detect.so
load-module module-udev-detect tsched=0
.else
load-module module-detect tsched=0
.endif
.ifexists module-jackdbus-detect.so
.nofail
load-module module-jackdbus-detect channels=2
.fail
.endif
.ifexists module-bluetooth-policy.so
load-module module-bluetooth-policy
.endif
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix
.ifexists module-gsettings.so
.nofail
load-module module-gsettings
.fail
.endif
load-module module-default-device-restore
load-module module-always-sink
load-module module-intended-roles
load-module module-suspend-on-idle
.ifexists module-console-kit.so
load-module module-console-kit
.endif
.ifexists module-systemd-login.so
load-module module-systemd-login
.endif
load-module module-position-event-sounds
load-module module-role-cork
load-module module-filter-heuristics
load-module module-filter-apply
tsched=0 parameter actually enabled the sound (although in a distorted way).
In both cases, I eliminated the comments.


The audio configuration is:

Code: Select all

Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor HD Audio vendor: Dell driver: snd_hda_intel v: kernel bus ID: 00:03.0 
Device-2: Intel 8 Series/C220 Series High Definition Audio vendor: Dell driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
Sound Server: ALSA v: k5.10.0-9-amd64
Hardware is a Realtek HDA Codec ALC3234.

From the log files:

Code: Select all

Nov 11 13:16:52 9020m pulseaudio[18572]: Freeing output 11 "Peak detect"
Nov 11 13:16:52 9020m pulseaudio[18572]: Freeing input 8 "AudioStream"
Nov 11 13:16:52 9020m pulseaudio[18572]: Restoring device for stream sink-input-by-application-name:Firefox.
Nov 11 13:16:52 9020m pulseaudio[18572]: Trying to change sample spec
Nov 11 13:16:52 9020m pulseaudio[18572]: Cannot update sample spec, monitor source is RUNNING
Nov 11 13:16:52 9020m pulseaudio[18572]: Restoring volume for sink input sink-input-by-application-name:Firefox.
Nov 11 13:16:52 9020m pulseaudio[18572]: Forcing resampler 'copy', because of fixed, identical sample rates.
Nov 11 13:16:52 9020m pulseaudio[18572]: Created input 9 "AudioStream" on alsa_output.pci-0000_00_03.0.hdmi-stereo with sample spec float32le 2ch 48000Hz and channel map front-left,front-right
Nov 11 13:16:52 9020m pulseaudio[18572]:     media.name = "AudioStream"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.name = "Firefox"
Nov 11 13:16:52 9020m pulseaudio[18572]:     native-protocol.peer = "UNIX socket client"
Nov 11 13:16:52 9020m pulseaudio[18572]:     native-protocol.version = "34"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.id = "1221"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.user = "user"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.host = "9020m"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.binary = "firefox-esr"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.language = "en_US.UTF-8"
Nov 11 13:16:52 9020m pulseaudio[18572]:     window.x11.display = ":0"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.machine_id = "9b464708930941bdb5d1cc725d87a4dd"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.session_id = "1"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.icon_name = "firefox-esr"
Nov 11 13:16:52 9020m pulseaudio[18572]:     module-stream-restore.id = "sink-input-by-application-name:Firefox"
Nov 11 13:16:52 9020m pulseaudio[18572]: Requested tlength=200.00 ms, minreq=25.00 ms
Nov 11 13:16:52 9020m pulseaudio[18572]: Final latency 200.02 ms = 134.69 ms + 2*25.00 ms + 15.33 ms
Nov 11 13:16:52 9020m pulseaudio[18572]: Storing volume/mute/device for stream sink-input-by-application-name:Firefox.
Nov 11 13:16:52 9020m pulseaudio[18572]: Cannot update sample spec, monitor source is RUNNING
Nov 11 13:16:52 9020m pulseaudio[18572]: Trying to change sample spec
Nov 11 13:16:52 9020m pulseaudio[18572]: Cannot update sample spec, SOURCE_IS_RUNNING, will keep using s16le and 48000 Hz
Nov 11 13:16:52 9020m pulseaudio[18572]: [b]Using stereo to mono remapping[/b]
Nov 11 13:16:52 9020m pulseaudio[18572]: Created output 12 "Peak detect" on alsa_output.pci-0000_00_03.0.hdmi-stereo.monitor with sample spec float32le 1ch 25Hz and channel map mono
Nov 11 13:16:52 9020m pulseaudio[18572]:     media.name = "Peak detect"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.name = "PulseAudio Volume Control"
Nov 11 13:16:52 9020m pulseaudio[18572]:     native-protocol.peer = "UNIX socket client"
Nov 11 13:16:52 9020m pulseaudio[18572]:     native-protocol.version = "34"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.id = "org.PulseAudio.pavucontrol"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.icon_name = "audio-card"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.version = "4.0"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.id = "16616"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.user = "user"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.host = "9020m"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.binary = "pavucontrol"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.language = "en_US.UTF-8"
Nov 11 13:16:52 9020m pulseaudio[18572]:     window.x11.display = ":0"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.machine_id = "9b464708930941bdb5d1cc725d87a4dd"
Nov 11 13:16:52 9020m pulseaudio[18572]:     application.process.session_id = "1"
Nov 11 13:16:52 9020m pulseaudio[18572]:     module-stream-restore.id = "source-output-by-application-id:org.PulseAudio.pavucontrol"
Nov 11 13:16:52 9020m pulseaudio[18572]: Final latency 55.33 ms = 40.00 ms + 15.33 ms
Nov 11 13:17:02 9020m pulseaudio[18572]: Synced.
The last lines coincide with the sound stop. At that moment Firefox is not able to load any video (there is a loop displaying the spinning circle).
Another question is why the sound is mapped from stereo to mono? The display has two speakers.

Please help.

undesign
Posts: 108
Joined: 2015-05-27 09:03
Has thanked: 8 times
Been thanked: 8 times

Re: Distorted sound when playing via HDMI

#2 Post by undesign »

Another log message:

Code: Select all

Nov 11 13:26:33 9020m pulseaudio[807]: GetManagedObjects() failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Nov 11 13:28:21 9020m pulseaudio[807]: ALSA woke us up to write new data to the device, but there was actually nothing to write.
Nov 11 13:28:21 9020m pulseaudio[807]: Most likely this is a bug in the ALSA driver 'snd_hda_intel'. Please report this issue to the ALSA developers.
Nov 11 13:28:21 9020m pulseaudio[807]: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.

undesign
Posts: 108
Joined: 2015-05-27 09:03
Has thanked: 8 times
Been thanked: 8 times

Re: Distorted sound when playing via HDMI

#3 Post by undesign »

Meanwhile I experimented more and currently I'm in quite stable setup.

Conclusions:
- if the sample rate of the source does not match with the settings, then the sound will gradually lose sync. Somehow pulseaudio "realize" that and will start to correct. For the user this means it will hear distortions. Then the cycle continues.
- this is happening also, if the sample rate of the source match the source, but apparently random
- sometimes, pulse crashes randomly every 1 - 5 minutes. Very annoying.
- if the configuration is (too) wrong, then pulseaudio server will crash in a matter of minutes

...and questions:
- is there a way to automatically match the sample rate of the source? Currently is set to 48000 as default and 44100 as alternative
- is there a way to include more sample rates (eg: 32k). For sure this will be the case in the future.
- is there a sampling method / algorithm that is more reliable

Segfault
Posts: 993
Joined: 2005-09-24 12:24
Has thanked: 5 times
Been thanked: 17 times

Re: Distorted sound when playing via HDMI

#4 Post by Segfault »

Sorry, I have no answers. Just happened to see this and remembered how digital audio was supposed to work. The idea was to pass through digitized sound without any processing. Because every resampling is loss of quality. All adjustments were supposed to be in the analog side, after DAC. (I've never used PA, and I never will.) The only problem with Firefox is without PA it sends sound to default output, there is no way to configure it within Firefox. Chromium for instance has a command line switch which allows sending audio to desired output in the system, not limited to default. For me the culprit here is PA, as you might have guessed already ...

User avatar
sunrat
Administrator
Administrator
Posts: 6382
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 115 times
Been thanked: 456 times

Re: Distorted sound when playing via HDMI

#5 Post by sunrat »

I used to mess around with PA settings but most don't make much difference. The only one I change now is:

Code: Select all

resample-method = soxr-vhq
Pretty sure ffmpeg is not commonly used as resample-method. One thing I do recall from testing way back is that avoid-resampling = yes created serious problems especially when more than one source was active. I never used HDMI sound so that may be a different ball park.
Sound from a browser playing YT videos is never going to match HiRes local files but has improved somewhat since they now use OggOpus as default at 48k.
Do you get issues playing local music files or is it just YouTube?
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

undesign
Posts: 108
Joined: 2015-05-27 09:03
Has thanked: 8 times
Been thanked: 8 times

Re: Distorted sound when playing via HDMI

#6 Post by undesign »

Segfault wrote: 2021-12-08 01:24 The only problem with Firefox is without PA it sends sound to default output, there is no way to configure it within Firefox. Chromium for instance has a command line switch which allows sending audio to desired output in the system, not limited to default. For me the culprit here is PA, as you might have guessed already ...
I use Firefox as my default browser and I do not want to change that. Even if Chrome is able to specify the sound output in the command line, this doesn't change a thing, because I still want to be able to change this from the GUI interface.
Indeed, this seems to be a software issue, since the same hardware worked flawlessly on Windows.
Last edited by undesign on 2021-12-08 11:32, edited 1 time in total.

undesign
Posts: 108
Joined: 2015-05-27 09:03
Has thanked: 8 times
Been thanked: 8 times

Re: Distorted sound when playing via HDMI

#7 Post by undesign »

sunrat wrote: 2021-12-08 05:58 I used to mess around with PA settings but most don't make much difference. The only one I change now is:

Code: Select all

resample-method = soxr-vhq
Pretty sure ffmpeg is not commonly used as resample-method. One thing I do recall from testing way back is that avoid-resampling = yes created serious problems especially when more than one source was active. I never used HDMI sound so that may be a different ball park.
Sound from a browser playing YT videos is never going to match HiRes local files but has improved somewhat since they now use OggOpus as default at 48k.
Do you get issues playing local music files or is it just YouTube?
I put in the file the option suggested by you, but I will test it in a few weeks, since now the system is attached to a normal monitor (without speakers).
This issue happens with all media, even with those that are already sampled at 48k (as my phone videos for instance).

undesign
Posts: 108
Joined: 2015-05-27 09:03
Has thanked: 8 times
Been thanked: 8 times

Re: Distorted sound when playing via HDMI

#8 Post by undesign »

So... There seems to be a bit better when watching movies with sound sampled at 48 kHz, but when watching online TV stations, the situation varies from ok to continuous distortions/hick-ups. CPU spikes are also present.

On YT the status is ok-ish, there are some small resync/hick-ups, but generally it is usable.

Other ideas?

Post Reply