2.1 surround support (userspace)

Bug #1286021 reported by David Henningsson
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
alsa-lib (Ubuntu)
Fix Released
Undecided
David Henningsson
Trusty
Confirmed
Undecided
Unassigned
pulseaudio (Ubuntu)
Fix Released
Undecided
David Henningsson
Trusty
Confirmed
Undecided
Unassigned

Bug Description

2.1 surround should work as seamlessly as other surround options, such as 4.0, 5.1 and 7.1 work today.

Alsa-lib and pulseaudio patches for 14.04 can be tested here:

https://launchpad.net/~diwic/+archive/surround21

Changed in alsa-lib (Ubuntu):
status: New → In Progress
assignee: nobody → David Henningsson (diwic)
Changed in pulseaudio (Ubuntu):
status: New → Triaged
assignee: nobody → David Henningsson (diwic)
summary: - 2.1 surround support in userspace
+ 2.1 surround support (userspace)
description: updated
Changed in pulseaudio (Ubuntu):
status: Triaged → In Progress
Changed in alsa-lib (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Giuseppe Iuculano (giuseppe-iuculano) wrote :

Do you have updated packages to try?

Revision history for this message
David Henningsson (diwic) wrote :

Today's status:

 - alsa-lib patches for adding the surround21:x name is upstream. There has not been an upstream release of alsa-lib since.
 - pulseaudio patches are not yet upstream. But I found that the problem might be more complex than first expected.

 1) It's easy just to add another "Surround 2.1" profile to PulseAudio. This is just a matter of me resending that patch, we can probably add it to upstream PulseAudio even though there is no upstream release of alsa-lib.

However, this will just add Surround 2.1 support for stuff that already is 2.1 in source material (well, 5.1 will be downmixed to 2.1, but normal stereo will not be upmixed, so no sound will be heard on the subwoofer).

 2) To automatically upmix stereo material to 2.1 (so sound can be heard on the subwoofer), we can set the key enable-lfe-remixing=yes in /etc/pulse/daemon.conf. However, this is a very trivial upmixing where the result sent to the subwoofer is just the same as the average of the left and right channel.

This might still be a valid approach if the subwoofer hardware has a lowpass filter in hardware (or possibly, hardcoded in secret registers on the codec).

 3) A more elegant approach would be to only send LFE sounds to the subwoofer when upmixing - and only send the remaining non-LFE audio to the front speakers. However this requires someone to actually write a lowpass filter, as I don't think we have such an implementation in upstream PulseAudio currently.

Revision history for this message
David Henningsson (diwic) wrote :

 > Do you have updated packages to try?

Good point. I won't have time to update them today. Please remind me in a few weeks if I haven't done it by then.

Revision history for this message
Raymond (superquad-vortex2) wrote :

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1316305

do you mean surround21 not yet available in Ubuntu 14.04 LTS ?

Profili:
  input:analog-stereo: Stereo analogico input (sinks: 0, sources: 1, priority. 60)
  output:analog-stereo: Stereo analogico output (sinks: 1, sources: 0, priority. 6000)
  output:analog-stereo+input:analog-stereo: Duplex stereo analogico (sinks: 1, sources: 1, priority. 6060)
  output:analog-surround-40: Surround analogico 4.0 output (sinks: 1, sources: 0, priority. 700)
  output:analog-surround-40+input:analog-stereo: Surround analogico 4.0 output + Stereo analogico input (sinks: 1, sources: 1, priority. 760)
  output:analog-surround-21: Surround analogico 2.1 output (sinks: 1, sources: 0, priority. 800)
  output:analog-surround-21+input:analog-stereo: Surround analogico 2.1 output + Stereo analogico input (sinks: 1, sources: 1, priority. 860)
  off: Spento (sinks: 0, sources: 0, priority. 0)
 Profilo attivo: output:analog-surround-21+input:analog-stereo

http://www.maxx.com/asus/

refer to those user guides, look like bass is done by software instead of hardware as user can specify cutoff frequency

Revision history for this message
Raymond (superquad-vortex2) wrote :

when subwoofer is connected to mono pin complex

the following patch force these kind of configuration to use 4 channel mode instead of copy front mode

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_codec.c?id=cd4035e814b04c009ece9939396d06370c53ed44

do it need fix to ensure multi channels was used when all of these speakers pin complexes are stereo (e.g. those lapptop with internal 5.1 spekers) and use copy front mode when of the speaker pin complex is mono ?

Revision history for this message
Raymond (superquad-vortex2) wrote :

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/871808

https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1040873

those Asus laptop only use alc663 codec , as one of the volume control is used by headphone and it won't support 5.1

https://bugzilla.kernel.org/show_bug.cgi?id=65091

http://www.asus.com/Notebooks_Ultrabooks/N550JV/

New N Series laptops are the first with a quad-speaker array.
And for deep bass, you get the bundled external SonicMaster subwoofer,

Revision history for this message
Raymond (superquad-vortex2) wrote :

http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/profile-sets/default.conf

do you mean those surround-41 or surround-50 profiles are also unusable for the same reason as surround-21 profile ?

Revision history for this message
Raymond (superquad-vortex2) wrote :
Revision history for this message
David Henningsson (diwic) wrote :

 > Do you have updated packages to try?

Just pushed updated packages, happy testing!

Revision history for this message
Giuseppe Iuculano (giuseppe-iuculano) wrote :

David,

unfortunately this doesn't work on my notebook, no sound after upgrade. I'm going to attack log.

Revision history for this message
Giuseppe Iuculano (giuseppe-iuculano) wrote :
Revision history for this message
Giuseppe Iuculano (giuseppe-iuculano) wrote :
Revision history for this message
Giuseppe Iuculano (giuseppe-iuculano) wrote :
Revision history for this message
Raymond (superquad-vortex2) wrote :
Download full text (4.3 KiB)

device become busy instead of channel not supported when testing profiles which need more than 4 channels

101| 0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile output:analog-surround-41
( 0.101| 0.000) D: [pulseaudio] alsa-mixer.c: Checking for playback on Analog Surround 4.1 (analog-surround-41)
( 0.101| 0.000) D: [pulseaudio] alsa-util.c: Trying surround41:0 with SND_PCM_NO_AUTO_FORMAT ...
( 0.101| 0.000) I: [pulseaudio] (alsa-lib)pcm_route.c: Found no matching channel map
( 0.101| 0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device surround41:0: Invalid argument
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Caching failure to open output:analog-surround-41
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-41+input:analog-mono - will not be able to open output:analog-surround-41
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-41+input:analog-stereo - will not be able to open output:analog-surround-41
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-41+input:iec958-stereo - will not be able to open output:analog-surround-41
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile output:analog-surround-50
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Checking for playback on Analog Surround 5.0 (analog-surround-50)
( 0.102| 0.000) D: [pulseaudio] alsa-util.c: Trying surround50:0 with SND_PCM_NO_AUTO_FORMAT ...
( 0.102| 0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC0D0p' failed (-16)
( 0.102| 0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device surround50:0: Device or resource busy
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Caching failure to open output:analog-surround-50
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-50+input:analog-mono - will not be able to open output:analog-surround-50
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-50+input:analog-stereo - will not be able to open output:analog-surround-50
( 0.102| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-50+input:iec958-stereo - will not be able to open output:analog-surround-50
( 0.103| 0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile output:analog-surround-51
( 0.103| 0.000) D: [pulseaudio] alsa-mixer.c: Checking for playback on Analog Surround 5.1 (analog-surround-51)
( 0.103| 0.000) D: [pulseaudio] alsa-util.c: Trying surround51:0 with SND_PCM_NO_AUTO_FORMAT ...
( 0.103| 0.000) I: [pulseaudio] (alsa-lib)pcm_hw.c: open '/dev/snd/pcmC0D0p' failed (-16)
( 0.103| 0.000) I: [pulseaudio] alsa-util.c: Error opening PCM device surround51:0: Device or resource busy
( 0.103| 0.000) D: [pulseaudio] alsa-mixer.c: Caching failure to open output:analog-surround-51
( 0.103| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-51+input:analog-mono - will not be able to open output:analog-surround-51
( 0.103| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-surround-51+input:a...

Read more...

Revision history for this message
Raymond (superquad-vortex2) wrote :

 ( 0.101| 0.000) I: [pulseaudio] (alsa-lib)pcm_route.c: Found no matching channel map

seem still not using latest alsa lib

http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=015c34bf1540a97f8920bf9e3bdff0e80293a053;hp=dbe6d7f86902dbbe2ff276b7a6524c084893772f

Revision history for this message
Raymond (superquad-vortex2) wrote :

pulseaudio assume surround21 is four channels since buffer time is half of stereo

why alsa lib surround21 did not specity any channel ?

http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=48f1b308cc66152eb6db66742dd0d08d888cda8d;hp=5c4cd46810cef8850b037fca9e38ffd43b0bff22

2.1 speaker set is different from 5.1 speaker set

070| 0.000) D: [pulseaudio] alsa-util.c: Trying front:0 with SND_PCM_NO_AUTO_FORMAT ...
( 0.071| 0.000) D: [pulseaudio] alsa-util.c: Managed to open front:0
( 0.071| 0.000) D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 371 ms
( 0.071| 0.000) D: [pulseaudio] alsa-util.c: Set buffer size first (to 3528 samples), period size second (to 441 samples).
( 0.071| 0.000) D: [pulseaudio] alsa-mixer.c: Profile output:analog-stereo+input:analog-stereo supported.
( 0.071| 0.000) D: [pulseaudio] alsa-mixer.c: Skipping profile output:analog-stereo+input:iec958-stereo - will not be able to open input:iec958-stereo
( 0.071| 0.000) D: [pulseaudio] alsa-mixer.c: Looking at profile output:analog-surround-21
( 0.071| 0.000) D: [pulseaudio] alsa-mixer.c: Checking for playback on Analog Surround 2.1 (analog-surround-21)
( 0.071| 0.000) D: [pulseaudio] alsa-util.c: Trying surround21:0 with SND_PCM_NO_AUTO_FORMAT ...
( 0.072| 0.000) D: [pulseaudio] alsa-util.c: Managed to open surround21:0
( 0.072| 0.000) D: [pulseaudio] alsa-util.c: Maximum hw buffer size is 185 ms
( 0.094| 0.021) D: [pulseaudio] alsa-util.c: Set buffer size first (to 3528 samples), period size second (to 441 samples).
( 0.094| 0.000) D: [pulseaudio] alsa-mixer.c: Profile output:analog-surround-21 supported.

Revision history for this message
Raymond (superquad-vortex2) wrote :

>However, this will just add Surround 2.1 support for stuff that already is 2.1 in source material (well, 5.1 will be downmixed to 2.1, but normal stereo will not be upmixed, so no sound will be heard on the subwoofer).

Does it mean that test with 5.1 downmix to surround21 ?

speaker-test -c6 -t wav -d -D pulse

Revision history for this message
David Henningsson (diwic) wrote :

> pulseaudio assume surround21 is four channels

For PulseAudio, surround21 is now three channels. It's mapped to four channels in alsa-lib, exactly which four channels is based on chmap information from the kernel.

> Does it mean that test with 5.1 downmix to surround21 ?

Yes I believe 5.1 would be downmixed to 2.1.

Revision history for this message
David Henningsson (diwic) wrote :

Giuseppe Iuculano, thanks for testing. This patch should fix the device busy error that Raymond found in your logs:

http://mailman.alsa-project.org/pipermail/alsa-devel/2014-May/077157.html

I'm currently waiting for upstream review of this patch.

Revision history for this message
David Henningsson (diwic) wrote :

Upstream accepted the patch and I've just uploaded a new package to the ppa. Can you help test it (when it has finished building)?
Thanks!

Changed in pulseaudio (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
HPO (hpo) wrote :

Those upstream patches seem to have been late for utopic... At least, I still don't get 2.1 on utopic - whereas trusty with your ppa was fine.

Any chance you would update your ppa for utopic one last time?

Thanks!

Revision history for this message
Raymond (superquad-vortex2) wrote :

you have to post the pulseudio log when using 2.1 profile if it still not working

http://git.alsa-project.org/?p=alsa-lib.git;a=blob_plain;f=src/conf/cards/HDA-Intel.conf;hb=HEAD

seem those 4.0, 5.1 and 7.1 of hda-intel are using front of hda-intel which has softvol plugin

HDA-Intel.pcm.surround40.0 cards.HDA-Intel.pcm.front.0
HDA-Intel.pcm.surround51.0 cards.HDA-Intel.pcm.front.0
HDA-Intel.pcm.surround71.0 cards.HDA-Intel.pcm.front.0

Changed in alsa-lib (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
David Henningsson (diwic) wrote :

Status update:

For alsa-lib, the surround21:x name is in 1.0.28, and 1.0.28 has been released into utopic.

For pulseaudio, not much has happened. The patch to use the "surround21:x" name is in PulseAudio git ( http://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer/profile-sets/default.conf?id=3f140f9022ef0b59b3684edd25e2202a65989669 ) but there has been no upstream release of PulseAudio since this patch went in.

There has been some upstream discussions about how to best implement an LFE filter, but nobody has finished writing one yet. ( http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-September/021824.html )

Revision history for this message
David Henningsson (diwic) wrote :

@HPO,

Since alsa-lib 1.0.28 is in utopic, you can just to modify /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf and add this section:

[Mapping analog-surround-21]
device-strings = surround21:%f
channel-map = front-left,front-right,lfe
paths-output = analog-output analog-output-speaker analog-output-desktop-speaker
priority = 8
direction = output

(Restart PulseAudio for changes to take effect.)

Revision history for this message
Raymond (superquad-vortex2) wrote :
Download full text (4.2 KiB)

https://bugs.freedesktop.org/show_bug.cgi?id=85446#c10

does 2.1 really work since pulseaudio probe front device, the softvol create a two channels pcm softvol but 2.1 try to create a 6 channel pcm softvol

0.170| 0.000) D: [pulseaudio] alsa-util.c: Route conversion PCM
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: Transformation table:
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: 0 <- 0
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: 1 <- 1
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: 2 <- none
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: 3 <- none
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: 4 <- none
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: 5 <- 2
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: Its setup is:
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: stream : PLAYBACK
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: access : MMAP_INTERLEAVED
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: format : S16_LE
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: subformat : STD
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: channels : 3
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: rate : 44100
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: exact rate : 44100 (44100/1)
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: msbits : 16
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: buffer_size : 88200
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: period_size : 44100
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: period_time : 1000000
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: tstamp_mode : ENABLE
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: period_step : 1
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: avail_min : 87612
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: period_event : 0
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: start_threshold : -1
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: stop_threshold : 6206523236469964800
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: silence_threshold: 0
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: silence_size : 0
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: boundary : 6206523236469964800
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: Slave: Soft volume PCM
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: Control: PCM Playback Volume
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: min_dB: -51
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: max_dB: 0
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: resolution: 256
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: Its setup is:
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: stream : PLAYBACK
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: access : MMAP_INTERLEAVED
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: format : S16_LE
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: subformat : STD
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: channels : 6
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: rate : 44100
( 0.170| 0.000) D: [pulseaudio] alsa-util.c: exact rate : 44100 (44100/1)
( 0.170| 0.000)...

Read more...

Revision history for this message
Raymond (superquad-vortex2) wrote :

as front device create two channels softvol pcm playback volume

it is bug of softvol plugin to create 6 channels pcm softvol without any notification of the change of the number of channel in softvol control

beside pulseaudio doesn't. like multi channel volume control

https://bugs.freedesktop.org/show_bug.cgi?id=85446#c1

control.68 {
  iface MIXER
  name 'PCM Playback Volume'
  value.0 255
  value.1 255
  comment {
   access 'read write user'
   type INTEGER
   count 2
   range '0 - 255'
   tlv '0000000100000008ffffec1400000014'
   dbmin -5100
   dbmax 0
   dbvalue.0 0
   dbvalue.1 0
  }
 }

Revision history for this message
Mike (michael-vm) wrote :

I followed the instructs at https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1286021/comments/24, but I do not see an option for "Analog Surround 2.1 Output" in the Ubuntu Sound Settings with 14.10.

How do I switch to that mode?

Revision history for this message
David Henningsson (diwic) wrote :

@Mike, maybe your sound card drivers do not show a subwoofer speaker? It's hard to tell without knowing your hardware (i e alsa-info: https://wiki.ubuntu.com/Audio/AlsaInfo )

Revision history for this message
Mike (michael-vm) wrote :

@diwic: I'm using a rather new Haswell CPU, here're the results of that script: http://www.alsa-project.org/db/?f=59c503080b0462b64f7111518c89e909cb773046

Revision history for this message
Mike (michael-vm) wrote :

Just want to let you know that this is fixed for me in Vivid.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 1:6.0-0ubuntu9

---------------
pulseaudio (1:6.0-0ubuntu9) wily; urgency=medium

  * 0312-lfe-filter-test-Use-S16NE-format.patch:
    Fix build failure on powerpc

 -- David Henningsson <email address hidden> Thu, 28 May 2015 11:02:48 +0200

Changed in pulseaudio (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in alsa-lib (Ubuntu Trusty):
status: New → Confirmed
Changed in pulseaudio (Ubuntu Trusty):
status: New → Confirmed
Revision history for this message
Test (3560holy) wrote (last edit ):

I'm using Ubuntu 22.04.4 LTS.
I have a problem with 2.1 sound on Realtek High Definition Audio (2.1):

00:03.0 Audio device: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller (rev 06)
 Subsystem: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
 Kernel driver in use: snd_hda_intel
 Kernel modules: snd_hda_intel
--
00:1b.0 Audio device: Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller (rev 05)
 Subsystem: ASUSTeK Computer Inc. 8 Series/C220 Series Chipset High Definition Audio Controller
 Kernel driver in use: snd_hda_intel
 Kernel modules: snd_hda_intel

When I select 2.1 sound the subwoofer does not work
https://nimb.ws/b20R5ud
https://nimb.ws/HNpTe7G

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.