[mythtv-users] RE: Configuring SPDIF digital out. -- new weirdnesses

Marius Schrecker marius at schrecker.org
Mon Dec 19 04:51:01 EST 2005


> On 17/12/05, Marius Schrecker <marius at schrecker.org> wrote:
>> > I might suggest that all alsa utilities, alsactl, and everything else
>> is
>> > NOT required
>> > to use digital out with MythTV.  I'm using MythTV 0.18.1 on Gentoo and
>> I
>> > only
>> > have the necessary alsa drivers compiled in the kernel. I've never
>> used
>> > alsamixer
>> > or alsactl, or installed/emerged alsa-utils, alsamixer, aplay, or
>> anything
>> > else
>> > alsa related. I'm not starting any alsa services during startup. The
>> only
>> > thing I did is:
>> >
>> > Enable alsa support and driver in the kernel.
>> > Put .asoundrc in my home directory.
>> > Set MythTV as follows:
>> >   -Enable AC3
>> >   -Device = "ALSA:digital"
>> >   -Mixer = "digital"
>> >
>> > and that's it.  I also have all the other mythplugins working by
>> setting
>> > their device
>> > to ALSA:digital. Is my setup unique, or are people doing more than
>> need to
>> > to get digital audio working?
>> >
>>
>> The simpler the better. I don't care how little is installed as long as
>> I
>> can get digital output, so far no go, everything looks as if it should
>> be
>> working, just no sound :(
>>
>> I'd love to know how to test spdiff out as simply as possible, if I can
>> bypass aplay then so much the better!
>> Can I stream a 48KHz file straight to spdiff out?
>
> You can use aplay -D <pcmdevice> and then send it out of your spdif
> whilst testing. You can get a list of all PCM devices by running aplay
> -L - choose one that your SPDIF is aliased to (commonly spdif) and see
> if you get any sound.
>
> The digital sound HOWTO really does explain everything you should need
> to do to get SPDIF output - the one hurdle is commonly determining
> which controls in the mixer need to be set to allow this. In my most
> basic asoundrc file (which sounds everything by default to my SPDIF) I
> have used:
>
> pcm.!default {
> type hw
> card 0
> device 1
> }
>
> The card/device to specify can be determined using `aplay -l` - for my
> system my SPDIF was given as device 1 - yours may be different. Note
> that this device expects 48kHz audio - if it's not the same format it
> may play back too slow/fast or not at all. The excellent asoundrc in
> the HOWTO uses the plug and dmix plugins to allow on-the-fly rate
> conversion.
>
> Nick
>
Thanks everyone for keeping this thread alive.
Digital sound is now working this morning but NOT as expected (please read
on), after upgrading alsa-base to the latest version from Debian, removing
arts from the system (startup was not enabled in KDE, but I discovered
that artsd was running), and doing a new depmod after removing the oss API
related modules. I didn't have time to test this yesterday as domestic
Christmas duties are crampinmg my MythTV style ;-).

As I mentioned, I did this before with the same hardware, following the
Digital Sound Howto, and it was no problem at-all. I connected the
computer to the surround amp, fiddled with a couple of sliders in
alsamixer and we were watching our first Myth movie within about 30
seconds using ALSA:diital as the output device.

Here's what I've done now:

Kernel (2.6.14):
Sound Card Suport: <M>
 ALSA:<M>
  Sequencer: <M> ("SND_SEQUENCER")
   sequencer dummy client: <M> ("SND_SEQ_DUMMY")
  OSS Mixer API: <M> ("SND_MIXER_OSS")
  OSS PCM: <M> ("SND_PCM_OSS")
  OSS Sequencer: <*>("SND_SEQUENCER_OSS") (No option for module compile)
  RTC Timer support <M> ("SND_RTCTIMER")
   Use RTC as default sequencer timer <*> ("SND_SEQ_RTCTIMER_DEFAULT")
  Verbose printk <NOT SET>
  Debug  <NOT SET> (perhaps I should enable this amnd look at the output??)
 generic devices:
  Dummy soundcard <M> ("SND_DUMMY")
  Virtual MIDI soundcard <M> ("SND_VIRMIDI")
  MOTU MidiTimePiece AV multiport MIDI <M> ("SND_MTPAV")
  UART16550 serial MIDI driver <M> ("SND_SERIAL_U16550")
  Generic MPU- UART driver <M> ("SND_MPU401")
 PCI devices:
  Intel /SIS/nVidia/AMD/ALI AC97 Controller <M> ("SND_INTEL8X0") ONLY
 USB devices : NONE
 OSS: NOT CONFIGURED

This is the same config as before (2.6.13 rc6 git4), with the following
exceptions for new code:

SND_AC97_CODEC did not exist, now <M>
SND_AC97_BUS did not exist, now <M>
SND_HWDEP was <M>, no longer exists
SND_SEQ_RTCTIMER_DEFAULT did not exist, now <*>
SND_ICE1724 was <M> by mistake, no longer configured
SND_USB_AUDIO was <M>, no longer set
SND_USB_USX2Y was <M>, no longer set

loaded sound modules are as follows:
$ lsmod |grep snd
snd_intel8x0           29596  1
snd_ac97_codec         93472  1 snd_intel8x0
snd_ac97_bus            1856  1 snd_ac97_codec
snd_pcm                80392  2 snd_intel8x0,snd_ac97_codec
snd_timer              20548  1 snd_pcm
snd                    46564  6 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer
soundcore               7264  1 snd
snd_page_alloc          8648  2 snd_intel8x0,snd_pcm

(I took out the oss mixer and oss pcm stuff for a clean alsa system and
did a depmod in case this was screwing me up)

I have modified /etc/modultils/alsa-base and changed:

options snd-intel8x0m index=-2
to
options snd-intel8x0m index=0

(don't know what this does, but others have done it, so thought I should
do the same)

Otherwise I'm using the stock alsa-base file which is very long with
catchalls for all cards, maybe I should edit this file for clarity and
only keep the snd-intel8X0 stuff??

.asoundrc:

 I've checked the devices with aplay -l:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: CK804 [NVidia CK804], device 0: Intel ICH [NVidia CK804]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: CK804 [NVidia CK804], device 2: Intel ICH - IEC958 [NVidia CK804 -
IEC958]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

 As I see it this confirms that device 2 is the spdiff device and I can
use the sample nForce 2/4 .asoundrc from the Digital sound Howto. I won't
post the whole file again, but I have set the default device to digital
by uncommenting the following lines:

pcm.!default {
  type plug
## Uncomment the following to use mixed analog by default
#  slave.pcm "dmix-analog"
## Uncomment the following to use unmixed digital by default
  slave.pcm "digital-hw"
## Uncomment the following to use mixed digital by default
#  slave.pcm "dmix-digital"
}

Earlier tests, prior to today suggested that .asoundrc was being parsed
correctly, as the devices configured in .asoundrc were all found and
"played" without stdout errors. mixed-analog and analog also gave me sound
to analog speakers, whilst digital and mixed-digital gave me silence.

Today this has changed:
I still get no stdout errors, and digital devices still give me silence,
but   -D analog and -D mixed analog give me sound from BOTH analog and
spdiff outputs!!

Here's my stdout from aplay -vD analog english.au:


$ aplay -vD analog english.au
Playing Sparc Audio 'english.au' : Mu-Law, Rate 8000 Hz, Mono
Plug PCM: Mu-Law conversion PCM (S16_LE)
Its setup is:
stream       : PLAYBACK
access       : RW_INTERLEAVED
format       : MU_LAW
subformat    : STD
channels     : 1
rate         : 8000
exact rate   : 8000 (8000/1)
msbits       : 8
buffer_size  : 2730
period_size  : 682
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 682
xfer_align   : 682
start_threshold  : 2728
stop_threshold   : 2730
silence_threshold: 0
silence_size : 0
boundary     : 357826560
Slave: Rate conversion PCM (48000, sformat=S16_LE)
Its setup is:
stream       : PLAYBACK
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 1
rate         : 8000
exact rate   : 8000 (8000/1)
msbits       : 16
buffer_size  : 2730
period_size  : 682
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 682
xfer_align   : 682
start_threshold  : 2728
stop_threshold   : 2730
silence_threshold: 0
silence_size : 0
boundary     : 357826560
Slave: Route conversion PCM (sformat=S16_LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream       : PLAYBACK
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 1
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 16
buffer_size  : 16380
period_size  : 4095
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 4095
xfer_align   : 4095
start_threshold  : 16380
stop_threshold   : 16380
silence_threshold: 0
silence_size : 0
boundary     : 2146959360
Slave: Hardware PCM card 0 'NVidia CK804' device 0 subdevice 0

Its setup is:
stream       : PLAYBACK
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 2
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 16
buffer_size  : 16380
period_size  : 4095
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 4095
xfer_align   : 4095
start_threshold  : 16380
stop_threshold   : 16380
silence_threshold: 0
silence_size : 0
boundary     : 2146959360

As you can see the slave device is correcly card 0 device 0 (analog), so
why am I getting output from spdiff??

then
$ aplay -vD digital english.au
Playing Sparc Audio 'english.au' : Mu-Law, Rate 8000 Hz, Mono
Plug PCM: Mu-Law conversion PCM (S16_LE)
Its setup is:
stream       : PLAYBACK
access       : RW_INTERLEAVED
format       : MU_LAW
subformat    : STD
channels     : 1
rate         : 8000
exact rate   : 8000 (8000/1)
msbits       : 8
buffer_size  : 2730
period_size  : 682
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 682
xfer_align   : 682
start_threshold  : 2728
stop_threshold   : 2730
silence_threshold: 0
silence_size : 0
boundary     : 357826560
Slave: Rate conversion PCM (48000, sformat=S16_LE)
Its setup is:
stream       : PLAYBACK
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 1
rate         : 8000
exact rate   : 8000 (8000/1)
msbits       : 16
buffer_size  : 2730
period_size  : 682
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 682
xfer_align   : 682
start_threshold  : 2728
stop_threshold   : 2730
silence_threshold: 0
silence_size : 0
boundary     : 357826560
Slave: Route conversion PCM (sformat=S16_LE)
Transformation table:
0 <- 0
1 <- 0
Its setup is:
stream       : PLAYBACK
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 1
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 16
buffer_size  : 16380
period_size  : 4095
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 4095
xfer_align   : 4095
start_threshold  : 16380
stop_threshold   : 16380
silence_threshold: 0
silence_size : 0
boundary     : 2146959360
Slave: Hardware PCM card 0 'NVidia CK804' device 2 subdevice 0

Its setup is:
stream       : PLAYBACK
access       : MMAP_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 2
rate         : 48000
exact rate   : 48000 (48000/1)
msbits       : 16
buffer_size  : 16380
period_size  : 4095
period_time  : 85312
tick_time    : 4000
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 4095
xfer_align   : 4095
start_threshold  : 16380
stop_threshold   : 16380
silence_threshold: 0
silence_size : 0
boundary     : 2146959360

routes correctly to device 2 but gives me total silence.

My current mixer settings (from alsamixer console mode) are:

Master: 71%
Master Mono: Mute
PCM: 100%
...
IEC958:PCM
IEC958 Playback AC97-SPSA : 0%
IEC958 Playback AC97-SPSA Capture : 0%
Capture: 100%
Mix: Capture set
External Amplifier: Set

Now here's some info from variious /proc/ files gathered by alsamixer:
                                                                                      #
&#9474;        &#9474;/proc/asound/version:                               
                                     #         &#9474;
&#9474;        &#9474;====================                                
                                     #         &#9474;
&#9474;        &#9474;Advanced Linux Sound Architecture Driver Version
1.0.10rc3 (Mon Nov 07 13:30:21 2005 UTC).#         &#9474;
&#9474;        &#9474;                                                    
                                     #         &#9474;
&#9474;        &#9474;/proc/asound/cards:                                 
                                     #         &#9474;
&#9474;        &#9474;===================                                 
                                     #         &#9474;
&#9474;        &#9474;0 [CK804          ]: NFORCE - NVidia CK804          
                                     #         &#9474;
&#9474;        &#9474;                     NVidia CK804 with ALC850 at
0xfebfd000, irq 7                        #         &#9474;
&#9474;        &#9474;                                                    
                                     &#9618;         &#9474;
&#9474;        &#9474;/proc/asound/devices:                               
                                     &#9618;         &#9474;
&#9474;        &#9474;=====================                               
                                     &#9618;         &#9474;
&#9474;        &#9474; 18: [0- 2]: digital audio playback                 
                                     &#9618;         &#9474;
&#9474;        &#9474; 25: [0- 1]: digital audio capture                  
                                     &#9618;         &#9474;
&#9474;        &#9474; 16: [0- 0]: digital audio playback                 
                                     &#9618;         &#9474;
&#9474;        &#9474; 24: [0- 0]: digital audio capture                  
                                     &#9618;         &#9474;
&#9474;        &#9474;  0: [0- 0]: ctl                                    
                                     &#9618;         &#9474;
&#9474;        &#9474; 33:       : timer                                  
                                     &#9618;         &#9474;
                                                                              &#9618;








&#9474;
&#9474;        &#9474;/proc/asound/oss/devices:                           
                                     &#9618;         &#9474;
&#9474;        &#9474;=========================                           
                                                                          
                                                 &#9618;         &#9474;
&#9474;        &#9474;/proc/asound/timers:                                
                                     &#9618;         &#9474;
&#9474;        &#9474;====================                                
                                     &#9618;         &#9474;
&#9474;        &#9474;G0: system timer : 4000.000us (10000000 ticks)      
                                     &#9618;         &#9474;
&#9474;        &#9474;P0-0-0: PCM playback 0-0-0 : SLAVE                  
                                     &#9618;         &#9474;
&#9474;        &#9474;P0-0-1: PCM capture 0-0-1 : SLAVE                   
                                     #         &#9474;
&#9474;        &#9474;P0-1-1: PCM capture 0-1-1 : SLAVE                   
                                     #         &#9474;
&#9474;        &#9474;P0-2-0: PCM playback 0-2-0 : SLAVE                  
                                     #         &#9474;
&#9474;        &#9474;                                                    
                                     #         &#9474;
&#9474;        &#9474;/proc/asound/pcm:                                   
                                     #         &#9474;
&#9474;        &#9474;=================                                   
                                     #         &#9474;
&#9474;        &#9474;00-00: Intel ICH : NVidia CK804 : playback 1 :
capture 1                                  #         &#9474;
&#9474;        &#9474;00-01: Intel ICH - MIC ADC : NVidia CK804 - MIC ADC
: capture 1                           #         &#9474;
&#9474;        &#9474;00-02: Intel ICH - IEC958 : NVidia CK804 - IEC958 :
playback 1

What does the output from /proc/asound/devices mean? It looks as if both
Card 0 device 2 and card 0 device 0 are set as digital output devices??

Baffled

Marius


More information about the mythtv-users mailing list