17

I installed Ubuntu 18.04 in my HP Pavilion laptop but the audio is stuttering when I play YouTube or offline audio. I have tried changes in PulseAudio and Alsamixer but nothing seems to work.

When I type:

:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC3241 Analog [ALC3241 Analog]
  Subdevices: 1/1

This is what I get.

I have tried the following but none of it seems to work:

3
  • 7
    Are you using laptop with Realtek RTL8188EE wireless network adapter? Because there is a bug in kernel which causes audio stutter if your wifi enabled and you are not connected to any wifi network. Aug 14, 2018 at 18:55
  • Thanks Nick! I was having the same issue with my HP Pavillion G7 1277dx. But it appears it's not necessarily Realtek because I was experiencing this issue with upgraded wifi card (Broadcom BCM4313).
    – x0a
    Dec 30, 2018 at 6:56
  • In my case, disabling "Simple monitor" (monitoring widget) worked.
    – m7a6
    May 20, 2019 at 23:17

4 Answers 4

19

In my case (ubuntu 18.04 on alienware m15 laptop) the sound stuttered and glitched randomly with any sound source. Disabling the Wi-Fi is not an option for me, I have stumbled upon a blog post that suggests the problem is in pulseaudio's realtime-scheduling setting, solution from there helped me fix the problem:

  1. Turn off realtime scheduling - edit /etc/pulse/daemon.pa (I had /etc/pulse/daemon.conf):
; realtime-scheduling = yes
realtime-scheduling = no
  1. Restart pulseaudio:
pulseaudio --kill
pulseaudio --start

Original solution from https://fitzcarraldoblog.wordpress.com/2017/04/20/stuttering-audio-in-linux-pulseaudio-strikes-again/

1
  • 4
    Thank you! This worked for me on Ubuntu 20.04 LTS, Surface Book 2. May 23, 2020 at 4:56
6

This turns out to be a bug as suggested by GoodGuyNick in the question's comments. The workaround is to disable Wi-Fi when not in use.

Are you using laptop with Realtek RTL8188EE wireless network adapter? Because there is a bug in kernel which causes audio stutter if your wifi enabled and you are not connected to any wifi network.

2

With help from other suggested solutions, I compared an older system that I have that was working well. The working system is one that started out as Ubuntu 14.04 and was upgraded to 16.04 and ultimately to 18.04, while the system that would not play movie audio without skipping (2-3 seconds on 2-3 seconds off – over and over) was a clean install of Ubuntu 18.04.

Having the two systems to compare and contrast was a great troubleshooting aid and when I compared the results of the command “mplayer -identify -frames 0 {name-of-m4-file.mp4}” the thing that jumped out at me was a reference to libavcodec shown below:

Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 57.107.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)

I searched and found the following information and this is what corrected my problem: How To Install libavcodec-dev Package on Ubuntu Detailed Instructions:

  1. Run update command to update package repositories and get latest package information.
    sudo apt-get update -y
  2. Run the install command with -y flag to quickly install the packages and dependencies.
    sudo apt-get install -y libavcodec-dev
  3. Check the system logs to confirm that there are no related errors.

This corrected my skipping audio problems temporarily but the real solution for me was found at https://ubuntuforums.org/showthread.php?t=766860&p=4816308#post4816308

1

Thank you for sharing the links. I was able to fix it to some extent. I edited the following file: /etc/modprobe.d/alsa-base.conf and added this string: options snd-hda-intel position_fix=1

Then I edited this file: /etc/pulse/default.pa At first I changed this string: load-module module-udev-detect to this: load-module module-udev-detect tsched=0 It helps in some cases. Later I changed it to: load-module module-udev-detect tsched=1

After changing these files apply: pulseaudio -k pulseaudio --start After that everything works more or less good with the default settings.

In my case the issue is related to the equalizer. When I enable it, the sound starts playing with the double speed. Several years ago I had this problem(with 2x speed) but restarting pulseaudio or rebooting helped me. Now it is 100% reproduced every time. I think, it might be related to the kernel, latency or something else.

2
  • Tried this. It didn't work.
    – Sam
    Aug 15, 2018 at 5:50
  • Have you tried switching to a different audio source? prnt.sc/ozc6q0
    – gearcoded
    Aug 29, 2019 at 20:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .