You are not logged in.

#1 2019-12-17 22:06:34

Moonbane
Member
From: Köln, Germany
Registered: 2014-07-21
Posts: 13

A52 plugin with alsa-plugins >1.1.6

I'm unable to get the a52 plugin (optical passtrough for 5.1) to work with the alsa-plugins newer than 1.1.6. I currently keep it downgraded to 1.1.6-2. Works fine. Current version is 1.2.1, I'm not sure, how long I can keep using the old plugins.

The last bug report was https://bugs.archlinux.org/task/60586?p … sa-plugins

I tried to build ffmpeg myself and enabled swresample but I never seem to get the digital surround sinks.

So what am I missing? Thanks for your thoughts!

my .asoundrc

pcm.a52 {
  @args [CARD]
  @args.CARD {
    type string
  }
  type rate
  slave {
    pcm {
      type a52
      bitrate 448
      channels 6
      card $CARD
    }
  rate 48000 #required somehow, otherwise nothing happens in PulseAudio
  }
}
# Use PulseAudio by default
pcm.!default {
  type pulse
  fallback "sysdefault"
  hint {
    show on
    description "Default ALSA Output (currently PulseAudio Sound Server)"
  }
}

ctl.!default {
  type pulse
  fallback "sysdefault"
}

Offline

#2 2019-12-18 00:42:54

latalante1
Member
Registered: 2018-08-30
Posts: 110

Re: A52 plugin with alsa-plugins >1.1.6

Moonbane wrote:

I tried to build ffmpeg myself and enabled swresample but...

Archlinux ffmpeg contains swresample.

Completely dirty, but without problems builds with the plugin you are interested in (a52).

git clone git://git.alsa-project.org/alsa-plugins.git
cd alsa-plugins
sed -i 's|libavresample|libswresample|g; s|-lavresample|-lswresample|g' configure.ac
sed -i 's|^./configure |./configure --sysconfdir=/etc --prefix=/usr --disable-lavrate|' ./gitcompile
./gitcompile
sudo make DESTDIR=/tmp/alsa-plugins-inst install

Last edited by latalante1 (2019-12-18 14:33:11)

Offline

#3 2019-12-18 12:21:11

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,794

Re: A52 plugin with alsa-plugins >1.1.6

Bugreport and other thread suggests nobody has verified whether the problem is in alsa-plugins or in pulseaudio .

Moonbane, are you willing to remove pulseaudio* for testing purposes and run  a pure alsa system  ?

* libpulse needs to stay to keep programs that expect pulse to be present happy.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#4 2019-12-18 14:32:34

latalante1
Member
Registered: 2018-08-30
Posts: 110

Re: A52 plugin with alsa-plugins >1.1.6

https://git.archlinux.org/svntogit/pack … d288b68c8c

I don't know what this plugin is used for?
I think every more advanced player mpv, vlc, mplayer will do it just as well.

Last edited by latalante1 (2019-12-18 14:37:52)

Offline

#5 2019-12-18 15:27:22

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,794

Re: A52 plugin with alsa-plugins >1.1.6

Check the dependencies of the players, they all use ffmpeg for the heavy lifting.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#6 2019-12-18 17:59:19

Moonbane
Member
From: Köln, Germany
Registered: 2014-07-21
Posts: 13

Re: A52 plugin with alsa-plugins >1.1.6

Tried a little around today. First, all versions of ffmpeg seem to work with the alsa-plugins <=1.1.6. Tried building alsa-plugins from abs - no joy. But - after latalante1 explanation it seems to be a configuration issue. the PKGBUILD contains:

optdepends=('libpulse: PulseAudio plugin'
            'jack: Jack plugin'
            #'ffmpeg: libavcodec resampling plugin, a52 plugin'
            'libsamplerate: libsamplerate resampling plugin'
            'speex: libspeexdsp resampling plugin')

so there is no libswresample. but libavcodec should be dropped? Why then does it work with 1.1.6?

Offline

#7 2019-12-18 19:14:30

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,863

Re: A52 plugin with alsa-plugins >1.1.6

Because that still built the a52 plugin, there seems to have been some bug that lead to the removal of the a52 plugin, check the package history and the two commits mentioning flysprays: https://git.archlinux.org/svntogit/pack … sa-plugins

Offline

#8 2019-12-21 00:00:04

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Re: A52 plugin with alsa-plugins >1.1.6

latalante1 wrote:

I don't know what this plugin is used for?

The plugin can be used to create a persistent (virtual) 5.1 output device; avoiding the need to configure individual clients for ac3 passthrough.

In the past I have managed this by downgrading to a custom-built alsa-plugins and adding it to IgnorePkg in pacman.conf, but I haven't been able to clean-chroot build 1.1.6 lately:

/bin/sh ../libtool  --tag=CC   --mode=link gcc -Wall -g -DAVCODEC_HEADER="<libavcodec/avcodec.h>" -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -module -avoid-version -export-dynamic -no-undefined -Wl,--no-undefined -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -o libasound_module_rate_lavcrate.la -rpath /usr/lib/alsa-lib rate_lavcrate.lo -lasound  -lavcodec -lavutil  -lasound 
libtool: link: gcc -shared  -fPIC -DPIC  .libs/rate_lavcrate.o   -lavcodec -lavutil -lasound  -g -march=x86-64 -mtune=generic -O2 -Wl,--no-undefined -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z -Wl,relro -Wl,-z -Wl,now   -Wl,-soname -Wl,libasound_module_rate_lavcrate.so -o .libs/libasound_module_rate_lavcrate.so
/usr/bin/ld: .libs/rate_lavcrate.o: in function `pcm_src_free':
/build/alsa-plugins/src/alsa-plugins-1.1.6/rate-lavc/rate_lavcrate.c:70: undefined reference to `av_resample_close'
/usr/bin/ld: .libs/rate_lavcrate.o: in function `pcm_src_init':
/build/alsa-plugins/src/alsa-plugins-1.1.6/rate-lavc/rate_lavcrate.c:96: undefined reference to `av_resample_init'
/usr/bin/ld: .libs/rate_lavcrate.o: in function `pcm_src_convert_s16':
/build/alsa-plugins/src/alsa-plugins-1.1.6/rate-lavc/rate_lavcrate.c:186: undefined reference to `av_resample'
/usr/bin/ld: /build/alsa-plugins/src/alsa-plugins-1.1.6/rate-lavc/rate_lavcrate.c:194: undefined reference to `av_resample_compensate'
/usr/bin/ld: /build/alsa-plugins/src/alsa-plugins-1.1.6/rate-lavc/rate_lavcrate.c:194: undefined reference to `av_resample_compensate'

It should be possible to build ffmpeg with libavresample (there's an AUR package for the lib as well), and build asla-plugins against it to get the a52 plugin, however...?

EDIT: seems like ffmpeg builds libavresample, but not libavrate. Something's missing?

Last edited by quequotion (2019-12-21 00:18:17)

Offline

#9 2019-12-21 09:54:26

latalante1
Member
Registered: 2018-08-30
Posts: 110

Re: A52 plugin with alsa-plugins >1.1.6

The only correct solution is to interest ALSA developers in this problem. I see that someone is already trying for it. There is even a patch already porting this additional plugin (rate) for libswresample.
https://mailman.alsa-project.org/piperm … 59428.html

Another solution is to build static, very tightly stripped (of unnecessary things) ffmpeg (--enable-avresample) and use it to compile alsa-plugins (--with-libav-includedir, --with-libav-libdir). Never, never replace the system ffmpeg with other "vulnerable" versions. For such unusual needs, temporary ffmpeg should be built with a different prefiix than the system one.

Last edited by latalante1 (2019-12-21 10:27:22)

Offline

#10 2019-12-21 16:05:38

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Re: A52 plugin with alsa-plugins >1.1.6

I was able to get back to 5.1 surround by clean-chroot building alsa-plugins (1.2.1-1) against libavresample from AUR and ffmpeg from [extra]:

$ git clone https://aur.archlinux.org/libavresample
$ cd libavresample/
$ makechrootpkg -c -r $CHROOT
# pacman -U --asdeps libavresample-4.1.3-1-x86_64.pkg.tar.xz
$ cd ../
$ git clone git://git.archlinux.org/svntogit/packages.git --{single-,}branch {packages/,}alsa-plugins
$ cd alsa-plugins/trunk/
$ makechrootpkg -c -r $CHROOT -I ../../libavresample/libavresample-4.1.3-1-x86_64.pkg.tar.xz
# pacman -U alsa-plugins-1.2.1-1-x86_64.pkg.tar.xz

Then building and installing IdleGandalf's alsa-lib:

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,15 +1,21 @@
 # Contributor: judd <jvinet@zeroflux.org>
 
 pkgname=alsa-lib
-pkgver=1.2.1.2
+pkgver=1.2.1.9
 pkgrel=2
 pkgdesc="An alternative implementation of Linux sound support"
 arch=('x86_64')
 url="https://www.alsa-project.org"
 depends=('glibc' 'alsa-topology-conf' 'alsa-ucm-conf')
+makedepends=('git')
 license=('LGPL')
-source=(ftp://ftp.alsa-project.org/pub/lib/$pkgname-$pkgver.tar.bz2)
-sha512sums=('e8286fd55f63ee0d95513279d0885c287533de89b7af6c338413dec5d38ba4f5a15da1a4a4ce36e052614e4b730e3778782dab9979d82958283be17b48604913')
+source=("$pkgname-$pkgver"::git+https://git.harting.dev/IdleGandalf/alsa-lib.git)
+sha512sums=('SKIP')
+
+prepare() {
+  cd $pkgname-$pkgver
+  autoreconf -fvi
+}
 
 build() {
   cd "$srcdir/$pkgname-$pkgver"

This works with the classic configuration.

Last edited by quequotion (2019-12-28 14:49:23)

Offline

#11 2019-12-21 16:13:19

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,959

Re: A52 plugin with alsa-plugins >1.1.6

That's a terrible PKGBUILD patch. Please don't use it.

Offline

#12 2019-12-21 16:36:40

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Re: A52 plugin with alsa-plugins >1.1.6

Scimmia wrote:

That's a terrible PKGBUILD patch.

Sloppy copy and paste missed a few lines (fixed); but also $pkgver is spoofed as a quick dirty workaround.
A proper package would need a pkgver(); and probably a different $pkgname (suggestions welcome).

Last edited by quequotion (2019-12-28 14:51:51)

Offline

#13 2019-12-27 20:55:56

Moonbane
Member
From: Köln, Germany
Registered: 2014-07-21
Posts: 13

Re: A52 plugin with alsa-plugins >1.1.6

Can't check it - currently away over the holidays and on my laptop. But this looks promising smile

Offline

#14 2020-03-29 03:19:30

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Re: A52 plugin with alsa-plugins >1.1.6

Sorry if this is considered a necro-bump.

I fixed up that PKGBUILD and uploaded it to AUR: alsa-lib-a52pcm.

Offline

#15 2020-07-31 12:14:28

AntiK
Member
Registered: 2016-03-07
Posts: 19

Re: A52 plugin with alsa-plugins >1.1.6

Hi,

first of all thank you very much, quequotion for the patched alsa-lib!
I spent the whole night trying to get this running.

I just want to inform you, that there is a little problem with the a52 alsa plugin in my setup.
While the plugin loads fine and I'm able to use it with alsa, pulseaudio refuses to list the sink.
I found out, that pulseaudio recognizes the sink, if I disable my HDMI audio with:

options snd-hda-intel enable=0,1

Maybe this is because it wouldn't make sense to use the plugin with HDMI anyway, but I have a second device where it totally makes sense.
Disabling HDMI is fine for me, since I don't need the HDMI output anyway.

Do you think this will be fixed in the alsa-lib of the official repo soon, or will the plugin be abandoned forever?

Offline

#16 2020-08-24 15:53:58

T-bond
Member
Registered: 2020-01-12
Posts: 14
Website

Re: A52 plugin with alsa-plugins >1.1.6

Unfortunately, I could not get the AUR package to work.
Even tried to  build the libavresample (AUR) package, with the current ffmpeg version (4.3.1), but that not helped.

Also tried AntiK's suggestion, but as far as I can tell, it does not work in ALSA neither.

@AntiK have you done anything else other than the described steps in the AUR package's content, and your suggestion?

If not, I will try to find some useful error message one day.

Offline

#17 2020-08-24 22:47:55

AntiK
Member
Registered: 2016-03-07
Posts: 19

Re: A52 plugin with alsa-plugins >1.1.6

@T-Bond I only did the steps described in the aur package. The only difference was the newer version numbers of the packages and I had to remove the official alsa-lib package (without the packages which require it of course).

Did you setup your .asoundrc properly?

Offline

#18 2020-09-04 17:16:21

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Re: A52 plugin with alsa-plugins >1.1.6

AntiK wrote:

While the plugin loads fine and I'm able to use it with alsa, pulseaudio refuses to list the sink.
I found out, that pulseaudio recognizes the sink, if I disable my HDMI audio with:

options snd-hda-intel enable=0,1

I think this quirkiness may be specific to your chip, and I suspect that various chips have various similar quirks.

In my case, pulseaudio recognizes the sink without doing so, but I found the setup to be more stable and easier to configure by similarly disabling HDMI, which I also have no use for. However, the way I do this is somewhat different from your way:

options snd_hda_intel enable_msi=1 enable=1,0 powersave=0
install snd-hda-codec-hdmi /bin/false
blacklist snd-hda-codec-hdmi

Note that disabling HDMI is not the only thing these options do: I also disable powersave to prevent the loss of ~0.5s of audio each time the card has to be woken up, and I don't remember at the moment why I explicitly enabled msi; this is likely overkill. I'm also overkill disabling hdmi (if I recall, my inital reason for doing so was so that the iec958 card would always be first).

Do you think this will be fixed in the alsa-lib of the official repo soon, or will the plugin be abandoned forever?

In theory, the plugin is supposed to work with libswresample and none of this trouble should be necessary. In practice, it does not and I have not seen that anyone has figured out quite why it does not. I do hope that will change, since it leaves such a great many users out in the cold with no surround sound support.

T-bond wrote:

Unfortunately, I could not get the AUR package to work.

I assure you it works if you follow the directions given in the pinned comment. If you could be more specific about what did not work, perhaps I could help. Note that none of those steps are optional, and that they must be done in the order given. It's not pretty, but it's all we've got.

Last edited by quequotion (2020-09-04 17:20:24)

Offline

#19 2020-09-04 20:18:18

AntiK
Member
Registered: 2016-03-07
Posts: 19

Re: A52 plugin with alsa-plugins >1.1.6

quequotion wrote:

Note that disabling HDMI is not the only thing these options do: I also disable powersave to prevent the loss of ~0.5s of audio each time the card has to be woken up, and I don't remember at the moment why I explicitly enabled msi; this is likely overkill. I'm also overkill disabling hdmi (if I recall, my inital reason for doing so was so that the iec958 card would always be first)

Thanks for the detailed response.
I didn't recognize any audio loss. But I had some popping sound whenever the card is waken up. I did fix this by configuring pulse to keep the sink always active, so it never suspends.

Offline

#20 2020-09-27 23:30:02

T-bond
Member
Registered: 2020-01-12
Posts: 14
Website

Re: A52 plugin with alsa-plugins >1.1.6

AntiK wrote:

@T-Bond I only did the steps described in the aur package. The only difference was the newer version numbers of the packages and I had to remove the official alsa-lib package (without the packages which require it of course).

Did you setup your .asoundrc properly?

Sorry for the rate reply. I hasn't got enough time to play with it.
I also removed the alsa-lib before installing the new one.
And also changed the alsa-lib-a52pcm version to 1.2.3. (And the .xz extensions to zst)
But unfortunately it still not works.

I made a clean install of Arch today, and hoped for the best. But things did not changed.
These are the steps I made today (and when I tried it previously)

pacman -S devtools sudo binutils
# Add yourself to sudoers
export CHROOT=$HOME/.chroot
mkdir -p $CHROOT
mkarchroot $CHROOT/root base-devel

pacman -Rdd alsa-lib # removes alsa-lib but keeps the dependent packages


#Follow the pinned comment: https://aur.archlinux.org/packages/alsa-lib-a52pcm/
git clone https://aur.archlinux.org/libavresample
cd libavresample/
makechrootpkg -c -r $CHROOT
sudo pacman -U --asdeps libavresample-4.2.2-1-x86_64.pkg.tar.zst
cd ../
git clone git://git.archlinux.org/svntogit/packages.git --{single-,}branch {packages/,}alsa
plugins
cd alsa-plugins/trunk/
makechrootpkg -c -r $CHROOT -I ../../libavresample/libavresample-4.2.2-1-x86_64.pkg.tar.zst
sudo pacman -U alsa-plugins-1:1.2.2-2-x86_64.pkg.tar.zst
cd ../../
git clone https://aur.archlinux.org/alsa-lib-a52pcm
cd alsa-lib-a52pcm/
makechrootpkg -c -r $CHROOT
sudo pacman -U --overwrite '*' --asdeps alsa-lib-a52pcm-1.2.3-1-x86_64.pkg.tar.zst

printf "pcm.a52 {
    @args [CARD]
        @args.CARD {
            type string
        }
    type rate
    slave {
        pcm {
            type a52
            bitrate 448
            channels 6
            card $CARD
        }
       rate 48000
    }
}" > ~/.asoundrc
quequotion wrote:

I assure you it works if you follow the directions given in the pinned comment. If you could be more specific about what did not work, perhaps I could help. Note that none of those steps are optional, and that they must be done in the order given. It's not pretty, but it's all we've got.

I think, I followed the steps correctly (but correct me if I am wrong, I am doing this for the first time).
I am also thankful that you created this AUR package.
The thing wich does not works is that, after I install the package, setup .asoundrc and reboot, I still got stereo output.
I am checking with: `pacmd list-sinks` but only got:

ports:
   iec958-stereo-output: Digital Output (S/PDIF) (priority 0, latency offset 0 usec, available: unknown)
   properties:

I also checked in alsamixer and unmuted the S/PDIF outputs, but it did not make any change as I can tell.

Unfortunately I don't know where to go from here. Or which log should I check for more information.
I hope you can help, as I would like to listen to my 5.1 which I got for this purpose smile And if you need any more info, I will try my best to provide it to you.

Offline

#21 2020-09-28 06:27:46

AntiK
Member
Registered: 2016-03-07
Posts: 19

Re: A52 plugin with alsa-plugins >1.1.6

@T-Bond Can you give us the output of

aplay -L

Does the a52 device show up there?

Offline

#22 2020-09-28 09:41:52

T-bond
Member
Registered: 2020-01-12
Posts: 14
Website

Re: A52 plugin with alsa-plugins >1.1.6

@AntiK i didn't noticed it before, but it was there:

a52:CARD=HDMI
    HDA ATI HDMI
    Plugin to convert multichannel stream to A52 (AC3) bitstream
surround51:CARD=Generic,DEV=0
    HD-Audio Generic, ALC1220 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
iec958:CARD=Generic,DEV=0
    HD-Audio Generic, ALC1220 Digital
    IEC958 (S/PDIF) Digital Audio Output
a52:CARD=Generic
    HD-Audio Generic
    Plugin to convert multichannel stream to A52 (AC3) bitstream

I removed everything from the output which was not A52 or just simple HDMI output.

I don't know if it helps but these are the packages I installed on my system:

base linux linux-firmware btrfs-progs man-db man-pages amd-ucode mesa libva-mesa-driver libva-utils vulkan-radeon fish ark okular dolphin konsole spectacle kdeconnect partitionmanager plasma-disks
discover packagekit-qt5
firefox xdg-desktop-portal-gtk gnome-settings-daemon xdg-desktop-portal xdg-desktop-portal-kde plasma-browser-integration
kinfocenter kscreen ksysguard user-manager plasma-pa plasma-desktop  noto-fonts-emoji plasma-wayland-session nano openssh
networkmanager plasma-nm nextcloud-client keepassxc git transmission-qt

And I have a msi x570 gaming pro mobo.

I tried to test with a 6 channel audio `aplay -vv somefile.wav`, but I can only hear it in stereo.

Offline

#23 2020-09-28 14:58:42

AntiK
Member
Registered: 2016-03-07
Posts: 19

Re: A52 plugin with alsa-plugins >1.1.6

@T-bond Try

speaker-test -c 6 -D a52:Generic

Does this output surround sound?
PS: you find speaker-test in the alsa-utils package.

Offline

#24 2020-09-28 15:40:13

quequotion
Member
From: Oita, Japan
Registered: 2013-07-29
Posts: 813
Website

Re: A52 plugin with alsa-plugins >1.1.6

T-bond wrote:

pacman -Rdd alsa-lib

This doesn't seem necessary; installing alsa-lib-a52pcm should replace alsa-lib (pacman will ask you if this is okay).

sudo pacman -U --overwrite '*' --asdeps alsa-lib-a52pcm-1.2.3-1-x86_64.pkg.tar.zst

Why do you add "--overwrite '*'" here?

Anyway, if you're seeing "a52:CARD=Generic", I think your plugin is available.

I tried to test with a 6 channel audio `aplay -vv somefile.wav`, but I can only hear it in stereo.

There may be one last thing to do: switch to the surround profile in pulseaudio.

You can find the name or index number of that profile on the command line:

pacmd list-sinks

And then provide its name or index number to set it (in place of $A52SURROUNDSINK):

pacmd set-default-sink $A52SURROUNDSINK

However, you might prefer to do this with pavucontrol, which provides a point-and-click method on its furthest right tab:

"Configuration" -> "Profile:" -> "Digital Surround 5.1...".

Pulseaudio should remember your selection.

A third option is to set it in /etc/pulse/default.pa, which should ensure that it remains set (for as long as the underlying packages are in working order).

Last edited by quequotion (2020-09-28 15:54:48)

Offline

#25 2020-09-28 17:01:01

T-bond
Member
Registered: 2020-01-12
Posts: 14
Website

Re: A52 plugin with alsa-plugins >1.1.6

AntiK wrote:

@T-bond Try

speaker-test -c 6 -D a52:Generic

Does this output surround sound?
PS: you find speaker-test in the alsa-utils package.

Wo. It works. Thank you very much! smile)))

@quequotion When I first tried to replace alsa-lib with alsa-lib-a52pcm pacman said that it couldn't replace some of the files.
Thats why the overwrite is there. But at some point when I was experimenting with it, I figured out that removing alsa-lib at first hand, could also solve the 'issue'. But forgot to remove the overwrite.
I know it replaces it (as it provides alsa-lib), but I thought maybe I just missed something in the PKGBUILD, and it should replace something which is not getting replaced as pacman says.

Unfortunately pulseaudio not sees it. Only the stereo output is available. (I checked with the 'pacmd list-sinks' command)
I am also using KDE's Pulse Audio applet where I can see the sinks, and change and test them. But it does not appear there (I think because PA doesn't sees the output in the first hand).
I think it should appear there, as it used to, before the package got broken.
And before your AUR package I manually patched the packages, and then it was visible there too, and I could change it.
So, next up to figure out, why PA does not lists the sink. sad

Edit: I guess I will try to disable my HDMI output as well. And check if it works. But I am using my HDMI as a secondary output, when I don't want to turn on my Home Theatre system, to just listen for 1 video. But first, let me see if it fixes the issue. The worst case, I will use my HTS for everything. It is better than 2.0

Last edited by T-bond (2020-09-28 17:08:07)

Offline

Board footer

Powered by FluxBB