This Time Self-Hosted
dark mode light mode Search

Multichannel output

And so back I am discussing my problems with multichannel output with ALSA. Seems like my odissey will last more than I foresee.

So it seems like either I was under drug usage when I was sure that speaker-test is able to send 6 channels output, or via82xx did play trick with me, and encoded it somehow on the fly before sending it through opto out, as it just seems technically impossible to get 6ch PCM output through optical output. Anyway, the point is that it doesn’t work and probably no other card, without using on the fly encoding in AC3, will give me that result.

So, no reason to waste money on a new soundcard, and I’m trying alternatives. The first alternative that came to my mind was to use the a52 plugin for ALSA, present in alsa-plugins, that allows to encode on the fly to AC3 to send to the amplifier, which would decode and play over the 5 channels. Even if it’s a lossy-to-lossy compression most of the time, it shouldn’t be much of a problem on its own. The problem is that, well, it simply wouldn’t work, as it segfaulted inside FFmpeg code. A quick look around told me that ALSA developers need to start reading documentation of the libraries they use, as they weren’t initialising libavcodec at all. Two-liner patch and I’m back on the road. (for who’s wondering, the patch is applied now in alsa-plugins-1.0.14_rc1-r2, while the ffmpeg useflag that was present before has been removed in all previous ebuilds, to avoid users hitting the bug).

So, with on-the-fly ac3 decoding, the situation is a bit better, I can actually play a 6-channel wave file through aplay, and it plays on the rear channels just as well, which is good. But of course, talking about ALSA, it couldn’t be that painless. So let’s see what the problems are.

First of all, when encoding to ac3 you’re using the S/PDIF output in exclusive dedicated way, (if you have a VIA card, this means that the IEC958 Playback AC97-SPSA control in the mixer is set to the higher level, rather than the lower you need to play stereo sound through it), meaning you cannot do neither hardware nor software (dmix) mixing, like if you were using iec958 (because in fact it is using the same output method); for this reason you still need a software mixing daemon like PulseAudio to be able to play more than one multichannel stream at once. This is also true for soundcards that have hardware mixing, like emu10k1- or emu10k2-based cards.

The second problem is tied to PulseAudio, that as I said would be needed to be able to play more than one stream at once. «Would», because it simply won’t work at the current status. As ALSA does not provide a CTL plugin for a52, but only a PCM, the virtual device wouldn’t have a mixer (it’s right), and somehow this leads to the crash of PulseAudio it seems (the crash is, of course, in alsa-lib code). I’ll have a «good» time trying to get a hold of this, I’m afraid.

Now of course, being finally able to have 5.1 output, and having some 5.1 audio samples, is quite interesting for me, as I can test them with xine (and FFplay) so that it can finally play WavPack 5.1 🙂

Comments 2
  1. ooh, that looks like it should work around some of my AC3 problems. (see the two bugs I have filed in the alsa tracker, one for the snd-aoa, and one for snd-intel8x0).

  2. hello,i’m trying the same with a52 output plugin. But i got only choppy playback with mplayer (-ao alsa:device=myac3enc) or noisy playback with vlc. No other player can use my asoundrc pcm controls.pcm.!surround51 { type a52 card 0 channels 6 bitrate 384}pcm.ac3enc { type a52 bitrate 448 channels 6}Did you really have good (no crackles or choppy) playback? Which player do you use?

Leave a Reply to Markus SchulzCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.