Bug 86676 - Audio skips and repeats when increasing volume in applications
Summary: Audio skips and repeats when increasing volume in applications
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-25 01:17 UTC by Yomi
Modified: 2018-07-30 10:28 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Yomi 2014-11-25 01:17:34 UTC
Whenever I increase the volume in any application sometimes the audio skips and/or repeats until the volume reaches the new percentage. Interfaces related to volume end up ignoring input until the new volume is reached. Any video playing at the time will also pause until the new volume is reached. 

It's intermittent. There doesn't seem to be a way for me to reliably reproduce it.

Output from pulseaudio -vvvv is here : https://gist.github.com/Yomi0/91e3fc04d9744a790020

Is there any more information I need to provide? 

Arch Linux 3.17.3-1-ARCH

Name           : pulseaudio
Version        : 5.0-1
Build Date     : Mon 03 Mar 2014 03:31:31 PM EST
Install Date   : Sun 24 Aug 2014 04:46:54 PM EDT

Name           : alsa-lib
Version        : 1.0.28-1
Build Date     : Wed 18 Jun 2014 02:00:01 AM EDT
Install Date   : Fri 22 Aug 2014 03:22:22 PM EDT

Name           : alsa-plugins
Version        : 1.0.28-2
Build Date     : Mon 15 Sep 2014 02:54:49 PM EDT
Install Date   : Tue 23 Sep 2014 01:12:48 PM EDT

Name           : alsa-utils
Version        : 1.0.28-1
Build Date     : Wed 18 Jun 2014 02:08:32 AM EDT
Install Date   : Sun 24 Aug 2014 04:44:00 PM EDT
Comment 1 Raymond 2014-11-25 11:34:31 UTC
you have to provide pulseaudio log with  log time by uncomment log time in deamon.conf
Comment 2 Yomi 2014-11-27 22:36:09 UTC
Took a bit, but I got it. 

https://gist.github.com/Yomi0/7c3158577999fd2447cf

Anything else?
Comment 3 Raymond 2014-11-28 03:04:47 UTC
(   0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-output (Analog Output), direction=1, priority=99, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=87, min_dB=-116.25, max_dB=0
(   0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Element Master, direction=1, switch=1, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x7ffffffffffff, n_channels=1, override_map=yes
(   0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Element Headphone, direction=1, switch=1, volume=3, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2, override_map=no
(   0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Element Speaker, direction=1, switch=1, volume=2, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x6, n_channels=2, override_map=no
(   0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Element PCM, direction=1, switch=0, volume=1, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x3600000000f66, n_channels=2, override_map=yes
(   0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Line Out, alsa_name='Line Out Jack', detection unavailable
(   0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Jack Line Out Phantom, alsa_name='Line Out Phantom Jack', detection unavailable
(   0.113|   0.000) I: [pulseaudio] alsa-sink.c: Successfully enabled deferred volume.
(   0.114|   0.000) I: [pulseaudio] alsa-sink.c: Hardware volume ranges from -116.25 dB to 0.00 dB.
(   0.114|   0.000) I: [pulseaudio] alsa-sink.c: Fixing base volume to 0.00 dB
(   0.114|   0.000) I: [pulseaudio] alsa-sink.c: Using hardware volume control. Hardware dB scale supported.
(   0.114|   0.000) I: [pulseaudio] alsa-sink.c: Using hardware mute control.
(   0.114|   0.000) D: [pulseaudio] alsa-util.c: snd_pcm_dump():
(   0.114|   0.000) D: [pulseaudio] alsa-util.c: Soft volume PCM
(   0.114|   0.000) D: [pulseaudio] alsa-util.c: Control: PCM Playback Volume
(   0.114|   0.000) D: [pulseaudio] alsa-util.c: min_dB: -51
(   0.114|   0.000) D: [pulseaudio] alsa-util.c: max_dB: 0
(   0.114|   0.000) D: [pulseaudio] alsa-util.c: resolution: 256

softvol plugin is -51dB to 0 dB,  

as hp and speaker are different path and you cannot add dB range of hp and speaker

a) the vitrual master playback volume and hp playback volume
b) the virtual master playback volume and speaker volume

the dB range of these two paths are -116.25 +51 = -55.25 dB to 0dB


what are the stepsize of the hp and speaker playback volume controls? the stepsize of hda codecs are multiple of 0.25dB


seem always use software volume as the hardware volume alone cannot set to -5.81 dB




   6.182|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Requested volume: front-left: 52428 /  80% / -5.81 dB,   front-right: 52428 /  80% / -5.81 dB
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Got hardware volume: front-left: 52761 /  81% / -5.65 dB,   front-right: 52761 /  81% / -5.65 dB
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Calculated software volume: front-left: 65122 /  99% / -0.17 dB,   front-right: 65122 /  99% / -0.17 dB (accurate-enough=yes)
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Volume going down to 52428 at 4188579532
Comment 4 Raymond 2014-11-28 03:14:40 UTC
   0.114|   0.000) D: [pulseaudio] alsa-util.c:   stream       : PLAYBACK
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   access       : MMAP_INTERLEAVED
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   format       : S16_LE
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   subformat    : STD
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   channels     : 2
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   rate         : 44100
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   exact rate   : 44100 (44100/1)
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   msbits       : 16
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   buffer_size  : 88192
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   period_size  : 44096
(   0.114|   0.000) D: [pulseaudio] alsa-util.c:   period_time  : 999909

as pulseaudio use a buffer of about two seconds, the mean that every volume change will need pulseaudio rewind,  recalculated the audio and write back
Comment 5 Yomi 2014-12-01 13:47:14 UTC
You need me to find the stepsize of hp and speaker playback volume? 
How?
Comment 6 Raymond 2014-12-01 16:39:32 UTC
Node 0x02 [Audio Output] wcaps 0x1d: Stereo Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Device: name="ALC269VB Analog", type="Audio", device=0
  Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
  Amp-Out vals:  [0x57 0x57]



 no of steps is 87 and  stepsize is 0.75 


87 * 0.75 = 65.25

Alsactl output
!!-------------

--startcollapse--
state.Intel {
	control.1 {
		iface MIXER
		name 'Headphone Playback Volume'
		value.0 87
		value.1 87
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 87'
			dbmin -6525
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
Comment 7 Raymond 2014-12-02 01:29:10 UTC
0.113|   0.000) D: [pulseaudio] alsa-mixer.c: Path analog-output (Analog Output), direction=1, priority=99, probed=yes, supported=yes, has_mute=yes, has_volume=yes, has_dB=yes, min_volume=0, max_volume=87, min_dB=-116.25, max_dB=0

if it always keep pcm softvol to 0dB , why add the dB range of pcm softvol but not the steps to analog output path
Comment 8 Raymond 2014-12-02 04:50:06 UTC
   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Volume going down to 52428 at 4188579532
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 1990463 usec
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Requested to rewind 352768 bytes.
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Limited to 352268 bytes.
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: before: 88067
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: after: 88067
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Rewound 352268 bytes.
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Processing rewind...
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: latency = 1358
(   6.183|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Volume change to 52428 at 4186582562 was written 6642 usec late
(   8.187|   2.003) D: [alsa-sink-ALC269VB Analog] sink-input.c: Have to rewind 352268 bytes on render memblockq.
(   8.187|   0.000) D: [alsa-sink-ALC269VB Analog] source.c: Processing rewind...
(   8.187|   0.000) D: [pulseaudio] core-subscribe.c: Dropped redundant event due to change event.
(   8.192|   0.004) D: [pulseaudio] protocol-native.c: Client mpv changes volume of sink input mpv - [HorribleSubs] Fate Stay Night - Unlimited Blade Works - 01v2 [720p].mkv.
(  11.219|   3.027) D: [alsa-sink-ALC269VB Analog] protocol-native.c: Requesting rewind due to end of underrun.
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Requested to rewind 352768 bytes.
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Limited to 14512 bytes.
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: before: 3628
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: after: 3628
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Rewound 14512 bytes.
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Processing rewind...
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: latency = 1326
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] sink-input.c: Have to rewind 14512 bytes on render memblockq.
(  11.219|   0.000) D: [alsa-sink-ALC269VB Analog] source.c: Processing rewind...
(  12.302|   1.082) D: [pulseaudio] protocol-native.c: Client mpv changes volume of sink input mpv - [HorribleSubs] Fate Stay Night - Unlimited Blade Works - 01v2 [720p].mkv.
(  12.302|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Requested volume: front-left: 51118 /  78% / -6.47 dB,   front-right: 51118 /  78% / -6.47 dB
(  12.302|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Got hardware volume: front-left: 51264 /  78% / -6.40 dB,   front-right: 51264 /  78% / -6.40 dB
(  12.302|   0.000) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Calculated software volume: front-left: 65349 / 100% / -0.07 dB,   front-right: 65349 / 100% / -0.07 dB (accurate-enough=yes)
(  12.302|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Volume going down to 51118 at 4192781310
(  12.302|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 72898 usec
(  12.302|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 72854 usec
(  12.302|   0.000) I: [pulseaudio] module-stream-restore.c: Storing volume/mute/device for stream sink-input-by-media-role:video.
(  12.302|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 72429 usec
(  12.303|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 72383 usec
(  12.303|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 72345 usec
(  12.303|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 72305 usec
(  12.303|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 71788 usec
(  12.303|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 71696 usec
(  12.303|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 71650 usec
(  12.303|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 71609 usec
(  12.304|   0.000) D: [alsa-sink-ALC269VB Analog] sink.c: Next volume change in 70985 usec
(  12.375|   0.071) D: [alsa-sink-ALC269VB Analog] sink.c: Volume change to 51118 at 4192781310 was written 54 usec late
(  14.380|   2.005) D: [alsa-sink-ALC269VB Analog] alsa-sink.c: Written HW volume did not match with the request: front-left: 51118 /  78% / -6.47 dB,   front-right: 51118 /  78% / -6.47 dB (request) != front-left: 50580 /  77% / -6.75 dB,   front-right: 50580 /  77% / -6.75 dB
Comment 9 Yomi 2014-12-27 19:46:46 UTC
I'm a little confused. 
Is there a command you need to me execute to provide more information?
Comment 10 Yomi 2014-12-27 23:16:17 UTC
I got this from the alsa-info.sh script...

https://gist.github.com/Yomi0/e581ca6d513fd0f532f7
Comment 11 Raymond 2014-12-28 16:31:00 UTC
http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/conf/cards/HDA-Intel.conf;hb=HEAD

do it help if you remove softvol plugin from front device ?

may need reboot and check whether the softvol volume control is really removed


-Intel.pcm.front.0 {
	@args [ CARD ]
	@args.CARD {
		type string
	}
	type asym
	playback.pcm {
-		type softvol
-		slave.pcm {
-			type hw
-			card $CARD
-			subdevice 0
-		}
-		control {
-			name "PCM Playback Volume"
-			card $CARD
-		}
+		type hw
+		card $CARD
	}
	capture.pcm {
		type hw
		card $CARD
	}
}
Comment 12 Yomi 2015-01-14 17:08:04 UTC
That seems to work, but then if I open pavucontrol, HDMI won't appear as an audio output.
Comment 13 Yomi 2015-01-14 19:49:48 UTC
(In reply to Yomi from comment #12)
> That seems to work, but then if I open pavucontrol, HDMI won't appear as an
> audio output.

It also seems to mess around with the volume of outputs.
Comment 14 GitLab Migration User 2018-07-30 10:28:00 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/439.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.