You are not logged in.

#1 2013-12-27 17:20:46

bernd_b
Member
Registered: 2013-07-30
Posts: 183

lost with spdif and real time ac3 encode

I have an SPDIF output which I would like to use for multichannel output. Pass through is of course an option as long as I didn't want to apply filter like changing playback speed.

To keep multichannel output even in this case, I tried to use the alsa plugin "a52", which suggest to to real time encoding as suggested, e.g.
here :  https://help.ubuntu.com/community/DigitalAC-3Pulseaudio
or
here:  https://wiki.gentoo.org/wiki/ALSA#Encode_to_A.2F52

Here is my ~/.asoundrc (or /etc/asound.conf which I tried as well):

#Define the soundcard to use
pcm.snd_card {
    type hw
    card 0
    device 0
}

pcm.a52 {
  @args [ CARD ]
  @args.CARD {
    type string
    default 0
  }
  type plug
  slave {
    pcm {
      type a52
      bitrate 448
      channels 6
      card $CARD
    }
  rate 48000 #required somehow, otherwise nothing happens in PulseAudio
  #format S16_LE
  }
}

and indeed, finally

speaker-test -Da52:0 -c6

gives me a multichannel output via SPDIF with the audio-amplifier clearly signifying a multichannel input.

But how to use this with vlc & Co? Current vlc-git doesn't show me any device like "a52". I would have expected that I have to choose a analogue output device and the alsa plugin to encode this to ac3 in real time while outputting the result to SPDIF in parallel. But choosing an analogue device gives me no sound on SPDIF. Choosiing SPDIF output in vlc directly gives me apparently only a stereo signal?!

I certainly do miss something here?

Offline

#2 2013-12-28 10:55:46

bernd_b
Member
Registered: 2013-07-30
Posts: 183

Re: lost with spdif and real time ac3 encode

O.K.,
there is some kind of success:
I added some lines from the conf file of this sister plugin here: http://aepatrakov.narod.ru/index/0-3 to my own conf file:

hint {
        show {
            @func refer
            name defaults.namehint.basic
        }
        description "a52 Encoding through IEC958 (S/PDIF)"
        device $DEV
  }

And indeed, vlc shows now an additional device to be selected.

If I select

"HDA Intel PCH, ALC887-VD Digital  IEC958 (S/PDIF) Digital Audio Output"

I get usual supposed stereo output.

I I select the new "device"

HDA Intel PCH a52 Encoding through IEC958 (S/PDIF)

my audio amplifier indicates multichannel input and plays it.

The channel mapping seems to be correct so far but the sound is very distorted. I fooled around with the bitmap settings and used and commented out the rate 4800 and format S16_LE line, but this changes nothing.

So final words: It works in principal but sound is broken? Anyone got it running sounding nicely and willing to share his settings?

Here is my actual complete ~/.asoundrc:

#Define the soundcard to use
pcm.snd_card {
    type hw
    card 0
    device 0
}

pcm.a52 {
  @args [ CARD ]
  @args.CARD {
    type string
    default 0
  }
  type plug
  slave {
    pcm {
      type a52
      bitrate 640
      channels 6
      card $CARD
    }
  rate 48000 #required somehow, otherwise nothing happens in PulseAudio
  format S16_LE
  }
  hint {
        show {
            @func refer
            name defaults.namehint.basic
        }
        description "a52 Encoding through IEC958 (S/PDIF)"
        device $DEV
  }

}

Offline

#3 2013-12-31 23:37:18

PReP
Member
From: Sweden
Registered: 2010-06-13
Posts: 359
Website

Re: lost with spdif and real time ac3 encode

I do not know if my use-case applies for what you are seeking, but i use SPDIF output (through an optical cable) from my internal motherboard  intel hda soundboard,
to a surround receiver.

I did not need to do any .asound "magic" though, mine simply looks like this:

defaults.pcm.card 0
defaults.pcm.device 0
defaults.ctl.card 0

defaults.pcm.rate_converter "samplerate_best"

pcm.!default {
  type plug;
  slave.pcm "plug:dmix";
}

Which is simply to make my mainboard soundcard the default, and a usual setting to use dmix.

I had two SPDIF outputs in my alsamixer view, i enabled them both,
and then in smplayer for instance, i simply checked "AC3/DTS passtrough through SPDIF",
and "channels by defaullt" to "5.1".
And if it is in smplayer there are probably config settings alike for the core mplayer,
and probably some equivalents for vlc or so i suppose.

It works here and the receiver picks up a DTS DD5.1 or whatever signal when the media carries it,
and for all the non surround material it get's a standard PCM signal to which i could apply any setting i'd like on the reciever.

I do not know if this helps you any in your case?, my idea is that you might not need all the .asound extra settings?

Last edited by PReP (2013-12-31 23:38:22)


. Main: Intel Core i5 6600k @ 4.4 Ghz, 16 GB DDR4 XMP, Gefore GTX 970 (Gainward Phantom) - Arch Linux 64-Bit
. Server: Intel Core i5 2500k @ 3.9 Ghz, 8 GB DDR2-XMP RAM @ 1600 Mhz, Geforce GTX 570 (Gainward Phantom) - Arch Linux 64-Bit
. Body: Estrogen @ 90%, Testestorone @ 10% (Not scientific just out-of-my-guesstimate-brain)

Offline

#4 2014-01-02 14:46:52

bernd_b
Member
Registered: 2013-07-30
Posts: 183

Re: lost with spdif and real time ac3 encode

Yes, we agree that for simple playback or in most of all cases pass through would be the best choice.

If you want to apply options like changing playback speed (which I do to reverse PAL Speed up) then you won't get any audio with passing through the original audio (at least to my knowledge and experience).

But whatever I do, the a52 plugin gives me unstable results choosing as output device directly via vlc and make pulseaudio crash.

The good news:
Too my surprise, the dca-plugin I linked to in my initial post works very well together with pulseaudio. I need three sessions until I got success by chance but now it is stable so far. There is even a PKGBUILD in AUR.

Another alternative would be ac3jack (http://essej.net/ac3jack/), a plugin for the jack-sound server, but I do not get it compiled even with the help of the patches of the gentoo pro-audio overlay (ac3jack-2.0.3-compile-fix.patch)

Last edited by bernd_b (2014-01-02 14:47:37)

Offline

Board footer

Powered by FluxBB