Hard pan left or right can cause "Darth vader effect"

Bug #928757 reported by David Henningsson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pulseaudio (Ubuntu)
Fix Released
Undecided
David Henningsson

Bug Description

* Start two input streams
* In pavucontrol, pan one hard left and the other hard right
* Now at least of them starts to get a weird "bad horror movie" effect.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: pulseaudio 1:1.1-0ubuntu6~diwicppa
ProcVersionSignature: Ubuntu 3.2.0-14.23-generic 3.2.3
Uname: Linux 3.2.0-14-generic x86_64
AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
ApportVersion: 1.91-0ubuntu1
Architecture: amd64
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: STAC92xx Analog [STAC92xx Analog]
   Subdevices: 1/1
   Subdevice #0: subdevice #0
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: david 1978 F.... pulseaudio
 /dev/snd/pcmC0D3p: david 1978 F...m pulseaudio
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xd4900000 irq 48'
   Mixer name : 'Intel IbexPeak HDMI'
   Components : 'HDA:111d7605,103c1413,00100402 HDA:80862804,80860101,00100000'
   Controls : 22
   Simple ctrls : 10
CurrentDmesg:
 [ 16.928066] ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
 [ 16.979317] ppdev: user-space parallel port driver
 [ 18.971326] Adding 3998716k swap on /dev/mapper/cryptswap1. Priority:-1 extents:1 across:3998716k
 [ 27.095481] eth0: no IPv6 routers present
Date: Wed Feb 8 11:24:04 2012
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Alpha amd64 (20120103)
SourcePackage: pulseaudio
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 06/29/2010
dmi.bios.vendor: Hewlett-Packard
dmi.bios.version: 68AZZ Ver. F.08
dmi.board.name: 1413
dmi.board.vendor: Hewlett-Packard
dmi.board.version: KBC Version 57.1D
dmi.chassis.type: 10
dmi.chassis.vendor: Hewlett-Packard
dmi.modalias: dmi:bvnHewlett-Packard:bvr68AZZVer.F.08:bd06/29/2010:svnHewlett-Packard:pnHPProBook4520s:pvr:rvnHewlett-Packard:rn1413:rvrKBCVersion57.1D:cvnHewlett-Packard:ct10:cvr:
dmi.product.name: HP ProBook 4520s
dmi.sys.vendor: Hewlett-Packard
modified.conffile..etc.pulse.default.pa: [modified]
mtime.conffile..etc.pulse.default.pa: 2012-01-26T17:38:53.632225

Revision history for this message
David Henningsson (diwic) wrote :
summary: - Hard pan left or right can cause "Bad horror movie effect"
+ Hard pan left or right can cause "Darth vader effect"
Revision history for this message
David Henningsson (diwic) wrote :

Note how it's trying to play back two waves simultaneously; every odd sample coming from one wave and every even sample coming from another.
And sometimes there are gaps where both waves change.

Revision history for this message
David Henningsson (diwic) wrote : [PATCH] Fix "Darth Vader" panning bug
Download full text (10.5 KiB)

For muted channels, we forgot to increment a pointer, so if one
channel was muted but not the other, sound became distorted in a
Darth Vader like way. To test the difference, start two input
streams and pan one of them hard left (or right).

And hey, if you didn't think it sounded like Darth Vader, it's
your imagination that's broken, not mine! ;-)

BugLink: https://bugs.launchpad.net/bugs/928757
Signed-off-by: David Henningsson <email address hidden>
---
 src/pulsecore/sample-util.c | 169 ++++++++++++++++++++-----------------------
 1 files changed, 78 insertions(+), 91 deletions(-)

diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c
index df1d79e..f2017aa 100644
--- a/src/pulsecore/sample-util.c
+++ b/src/pulsecore/sample-util.c
@@ -225,22 +225,21 @@ size_t pa_mix(
                     pa_mix_info *m = streams + i;
                     int32_t v, lo, hi, cv = m->linear[channel].i;

- if (PA_UNLIKELY(cv <= 0))
- continue;
+ if (PA_LIKELY(cv > 0)) {

- /* Multiplying the 32bit volume factor with the
- * 16bit sample might result in an 48bit value. We
- * want to do without 64 bit integers and hence do
- * the multiplication independently for the HI and
- * LO part of the volume. */
+ /* Multiplying the 32bit volume factor with the
+ * 16bit sample might result in an 48bit value. We
+ * want to do without 64 bit integers and hence do
+ * the multiplication independently for the HI and
+ * LO part of the volume. */

- hi = cv >> 16;
- lo = cv & 0xFFFF;
-
- v = *((int16_t*) m->ptr);
- v = ((v * lo) >> 16) + (v * hi);
- sum += v;
+ hi = cv >> 16;
+ lo = cv & 0xFFFF;

+ v = *((int16_t*) m->ptr);
+ v = ((v * lo) >> 16) + (v * hi);
+ sum += v;
+ }
                     m->ptr = (uint8_t*) m->ptr + sizeof(int16_t);
                 }

@@ -269,16 +268,15 @@ size_t pa_mix(
                     pa_mix_info *m = streams + i;
                     int32_t v, lo, hi, cv = m->linear[channel].i;

- if (PA_UNLIKELY(cv <= 0))
- continue;
-
- hi = cv >> 16;
- lo = cv & 0xFFFF;
+ if (PA_LIKELY(cv > 0)) {

- v = PA_INT16_SWAP(*((int16_t*) m->ptr));
- v = ((v * lo) >> 16) + (v * hi);
- sum += v;
+ hi = cv >> 16;
+ lo = cv & 0xFFFF;

+ v = PA_INT16_SWAP(*((int16_t*) m->ptr));
+ v = ((v * lo) >> 16) + (v * hi);
+ sum += v;
+ }
                     m->ptr = (uint8_t*) m->ptr + sizeof(int16_t);
                 }

@@ -308,13 +306,12 @@ size_t pa_m...

Changed in pulseaudio (Ubuntu):
status: New → In Progress
assignee: nobody → David Henningsson (diwic)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:1.1-0ubuntu8

---------------
pulseaudio (1:1.1-0ubuntu8) precise; urgency=low

  [ David Henningsson ]
  * Make sure we switch away from unavailable ports at
    startup (LP: #928914)
  * 0020-Fix-Darth-Vader-panning-bug.patch:
    Fix distorted sound when panned hard left (or right). (LP: #928757)
  * 0618-alsa-mixer-Don-t-use-dangling-pointers-as-port-hashm.patch:
    Fix inability to set port when options were used (LP: #932804)
  * Minimize margins for deferred volumes, as a workaround for volume
    changes being dropped on port change.
  * 0610-Jack-detection-kcontrol-implementation.patch:
    Fix a bug in the headphone path
 -- Luke Yelavich <email address hidden> Fri, 17 Feb 2012 07:28:23 +1100

Changed in pulseaudio (Ubuntu):
status: In Progress → Fix Released
tags: added: blocks-hwcert-enablement
Revision history for this message
Jeff Marcom (jeffmarcom) wrote :

This doesn't seem to be an issue anymore in 12.04.1

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.