Mailing List Archive

ALSA and SPDIF Out For nForce2 Motherboards
Hi,

Not sure if this has been posted on this list before. But for the
benefit of all or the newbies, I've managed to get audio out through my
MSI K7N2 Delta ILSR motherboard's SPDIF co-axial connector.

Follow Jarod's guide carefully. Just before you execute the
/usr/bin/aplay /usr/share/sounds/KDE_Startup.wav command, execute the
following (either as root or as mythtv user):

# /usr/bin/aplay -l

Here's the output for the aplay -l for my machine:

**** List of PLAYBACK Hardware Devices ****
card 0: nForce2 [NVidia nForce2], device 0: Intel ICH [NVidia nForce2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: nForce2 [NVidia nForce2], device 2: Intel ICH - IEC958 [NVidia
nForce2 - IEC958]
Subdevices: 1/1
Subdevice #0: subdevice #0

As you can see, my SPDIF is on device 2. Now, go modify your .asoundrc
file (this file lives in /home/mythtv/) for your mythtv user as follows:

pcm.nforce-hw {
type hw
card 0
}

pcm.!default {
type plug
slave.pcm "nforce"
}

pcm.nforce {
type dmix
ipc_key 1234
slave {
pcm "hw:0,2"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
}

ctl.nforce-hw {
type hw
card 0
}

Note the line with pcm "hw:0,2", this is what you want to tell ALSA to
direct your audio via device 2.

Save your .asoundrc file and continue with excuting the /usr/bin/aplay
/usr/share/sounds/KDE_Startup.wav. You should be able to hear the sound
played through the SPDIF. Alternatively, you might want to run this
command to test the stereo output:
$ /usr/bin/aplay /usr/share/sounds/KDE_Startup_new.wav

Jarod, you might want to include the above steps into your guide. Most
of the above info are taken from the ALSA project website, see this link
(
http://www.alsa-project.org/alsa-doc/doc-php/template.php?company=Nvidia&card=nForce&chip=NM2360&module=intel8x0
) for the nForce configuration.

Cheers
KianTeck

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Mike Denver wrote:

>Nothing special in .asoundrc
>
Good. The plug plugin would add whole new layers of confusion.

>just the following
>pcm.intel8x0 {
>type hw
>card 0
>}
>
>ctl.intel8x0 {
>type hw
>card 0
>}
>
>
Which means you do _not_ have a device called nforce. (For future
reference, you have one called "intel8x0" and by changing both
occurences of that word in .asoundrc, you would be renaming it.).
Therefore, we'll just to specify a hardware name.

>I tried alsa:hw0,1 and alsa:hw0,2
>
>
In Myth, use all caps "ALSA"--i.e. ALSA:hw:0,1 . Note also there is a
colon between "hw" and "0,1". Once you do that, assuming you've wired
the S/PDIF correctly, you should hear your audio in all its digital glory.

>when I go to tv, with 0,1 video comes on but no sound, with 0,2 mythfrontend
>shuts down. With every other setting except /dev/dsp (which then works in
>analoge) the TV module hangs. I'm suppose to be putting these setting
>directly in the mythconverg database right? so that when I select general
>settings I have alsa:hw0,1 in the audiooutputdevice field right? Just
>checking.
>
>I know I'm getting close I can feel it!
>
>
Sounds right to me, but then again, my Myth box doesn't have S/PDIF
output, so I haven't tried it myself.
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
RE: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Hi Mike

I struggled to work out what to put here also, but in the end discovered
that using -ac alsa9:nforce works nicely in mplayer, and ALSA:nforce
works in Myth. This is using the same mapping as you use below, and the
.asoundrc file that was posted to the list a while back.

However, now I have a problem in that the sample rate that my tv card is
using to capture audio (SAA7134) is 32kHz which the digital output
interface can't support (get a message saying requested 3200Hz, got
0Hz). I get no sound at all when using 48kHz - maybe the SAA7134 doesn't
support this audio sample rate?

Hope this helps you, and if anyone has any ideas on how to overcome the
32/48 kHz problem mentioned I'd love to hear from you :-)

Cheers
Derek.

-----Original Message-----
From: mythtv-users-bounces@mythtv.org
[mailto:mythtv-users-bounces@mythtv.org] On Behalf Of Mike Denver
Sent: Sunday, April 11, 2004 4:26 AM
To: mythtv-users@mythtv.org
Subject: [mythtv-users] ALSA and SPDIF Out For nForce2 Motherboards

aplay -l gives me:
**** List of PLAYBACK Hardware Devices **** card 0: nForce2 [NVidia
nForce2], device 0: Intel ICH [NVidia nForce2]
Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: nForce2 [NVidia
nForce2], device 2: Intel ICH - IEC958 [NVidia
nForce2 - IEC958] Subdevices: 1/1 Subdevice #0: subdevice #0 I've tried
"ALSA:hw:0,1" "ALSA:hw:0,2" "ALSA:intel8x0" none seem to do anything.
Then I tried Chris' suggestion. I added "options snd-pcm-oss adsp_map=2"
to modules.conf no luck there ether. My modules.conf order is a little
different than most examples I see is this a problem?
# --- ALSACONF verion 1.0.4 ---
alias char-major-116 snd
alias char-major-14 soundcore
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
alias snd-card-0 snd-intel8x0
alias sound-slot-0 snd-intel8x0
options snd_pcm_oss adsp_map=2


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Sorry for the length of the post, but I'm trying to clear up all
confusion on ALSA's .asoundrc and which ALSA device to use for S/PDIF
output from Myth. The small posts I've made didn't seem to provide
enough information, so I'm going all out on this one. That entails a
lot of "how it works" and a very long--but very flexible--.asoundrc.
(Oh, and by the way, thanks to those who asked these questions, I've
finally cleared up _all_ my confusion about how to create a proper
.asoundrc. :)

Derek Watson wrote:

>I struggled to work out what to put here also, but in the end discovered
>that using -ac alsa9:nforce works nicely in mplayer, and ALSA:nforce
>works in Myth. This is using the same mapping as you use below, and the
>.asoundrc file that was posted to the list a while back.
>
>
I'm assuming you mean the .asoundrc posted by chua_kanteck (
http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?username=chua_kianteck@yahoo.co.uk;guest=2852963&t=search_engine
). To be inclusive, I'm posting another copy so we can pick it apart:

pcm.nforce-hw {
type hw
card 0
}

pcm.!default {
type plug
slave.pcm "nforce"
}

pcm.nforce {
type dmix
ipc_key 1234
slave {
pcm "hw:0,2"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
}

ctl.nforce-hw {
type hw
card 0
}

>However, now I have a problem in that the sample rate that my tv card is
>using to capture audio (SAA7134) is 32kHz which the digital output
>interface can't support (get a message saying requested 3200Hz, got
>0Hz). I get no sound at all when using 48kHz - maybe the SAA7134 doesn't
>support this audio sample rate?
>
>Hope this helps you, and if anyone has any ideas on how to overcome the
>32/48 kHz problem mentioned I'd love to hear from you :-)
>
>
Now, it may seem like I'm going on and on about this (
http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=119104;search_string=spdif%20nforce%20.asoundrc;guest=2852963&t=search_engine#119104
andhttp://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=118593;search_string=stuttering%20asoundrc%20nforce;guest=2852963&t=search_engine#118593
), but that's only because it seems my warnings are going unheeded--*the
dmix plugin is evil!!!* (Or, more precisely, dmix is evil when used
incorrectly. Apologies to any ALSA developers for the drama. ;)

You'll notice that the .asoundrc above defines a virtual device (or
"alias") called "nforce-hw" and another called "nforce". The
"nforce-hw" device is connected directly to "hw:0,0" and the "nforce"
device uses the dmix plugin to perform direct software mixing of audio
streams (i.e. takes two inputs and provides one output), but it _only_
supports audio at a fixed frequency (by default 48000Hz) format (S16),
channels (2), and period_time (125000) (see
http://www.alsa-project.org/alsa-doc/alsa-lib/pcm_plugins.html#pcm_plugins_dmix

). However, by defining a slave device, one can modify these defaults.
In the .asoundrc given, the modified frequency is 44100Hz--good for
CD's. Unfortunately, bad for DVD's, bad for MythTV 32KHz channels, bad
for MythTV 48KHz channels, bad for some QuickTime and some AVI files,
etc. That's why your sound doesn't work with "ALSA:nforce"--the audio
format is wrong.

Note that the .asoundrc also defines a virtual device called "default"
(using pcm.!default to override the "default" definition of "default").
This device uses the "plug" (automatic conversion) plugin to
automatically convert the sample rate, channels, and format as
appropriate. chua_kanteck has, therefore, told ALSA that if no device
is specified (or if a device named "default" is specified), it should
use the plug plugin to convert the audio in for output on the S/PDIF device.

Assuming S/PDIF is on device 2 as above, you should be able to send a
signal directly to the hardware by specifying "ALSA:hw:0,2" to Myth and
"alsa9:hw:0,2" to MPlayer. Unfortunately, though, the signals are not
necessarily the right format, so we'll need to do converstion. Note,
however, that on some nForce2 boards S/PDIF is device 1 (and possibly
some other device). If this is the case with your board (run "aplay -l"
to find out), replace all occurences of "device 2" with "device 1" and
(for completeness sake) all occurences of "hw:0,2" in the comments with
"hw:0,1".

Therefore, I recommend the following .asoundrc. Feel free to change the
alias names (note that spdif--among other names--is reserved, though).
I used analog, mixed-analog, digital, and mixed-digital because they
aren't reserved, they don't have special characters, and they're
descriptive. If using multiple sound cards, you might want to add
something to specify that this is nForce analog, etc.

To use the .asoundrc below with Myth, specify "ALSA:analog" for analog
output, "ALSA:digital" for S/PDIF output, "ALSA:mixed-analog" for
software-mixed analog output, or "ALSA:mixed-digital" for software-mixed
S/PDIF output. The mixed output will allow you to hear sounds generated
by other programs using the mixed output device on your Myth box while
watching TV, DVD's, etc. The non-mixed output will block other sounds
so you won't be interrupted by beeps, clicks, etc. while watching a
recording--but, unfortunately, after the recording finishes (and the
ALSA device is released), the other sounds--having been queued up--will
play back one after the other (it's not a pleasant sound, and is often
much louder than the recording). Note, also, that the rate conversion
to 48000Hz used by the mixed output may affect the audio quality
(especially for low-bitrate audio).

Note that I've included a control device (ctl.name) for each virtual
device. The standard way to find a control device is to prepend "ctl."
to the audio device name, so we define one just in case an application
tries to find the control device. Most of the time, this is unnecessary
since your program won't access the control device--especially on the
devices you won't use directly--but when using certain programs (like
JACK, for example) a control device is required, so it makes sense to
define one and doesn't hurt to define one even for the devices you won't
use directly.

Finally, I included a commented out section that allows you to change
the default output device used by ALSA. Uncomment the definition of
"pcm.!default" at the top of the file, but be sure to only uncomment one
"slave.pcm" line (i.e. uncomment four lines).

To test the output devices, execute the command:
aplay -D devicename /path/to/audio/file.au

replacing devicename with one of default, analog, mixed-analog, digital,
or mixed-digital. aplay doesn't support many formats, so an au file is
probably the easiest one to test with. If you need one, download
ftp://ftp.kernel.org/pub/linux/kernel/SillySounds/english.au and you can
hear Linus pronounce Linux (from 1994).

HTH.

Mike

The (I hope it's the definitive) .asoundrc for nForce2

# Override the default output used by ALSA.
# If you do not override the default, your default
# device is identical to the (unmixed) analog device
# shown below. If you prefer mixed and/or digital
# output, uncomment the appropriate four lines below
# (only one slave.pcm line).
#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"
#}

# Alias for analog output on the nForce2 (hw:0,0)
# - This is identical to the device named "default"--which
# always exists and refers to hw:0,0 (unless overridden)
# - Therefore, we can specify "hw:0,0", "default", or "analog"
# to access analog output on the nForce2
pcm.analog {
type plug
slave.pcm "analog-hw"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.analog {
type hw
card 0
}

# Alias for (rate-converted) mixed analog output on the
# nForce2 (hw:0,0)
# - This will accept audio input--regardless of rate--and
# convert to the rate required for the dmix plugin
# (in this case 48000Hz)
pcm.mixed-analog {
type plug
slave.pcm "dmix-analog"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.mixed-analog {
type hw
card 0
}

# Alias for (rate-converted) digital (S/PDIF) output on the
# nForce2 (hw:0,2)
# - This will accept audio input--regardless of rate--and
# convert to the rate required for the S/PDIF hardware
# (in this case 48000Hz)
pcm.digital {
type plug
slave.pcm "digital-hw"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.digital {
type hw
card 0
}

# Alias for mixed (rate-converted) digital (S/PDIF) output on the
# nForce2 (hw:0,2)
# - This will accept audio input--regardless of rate--and
# convert to the rate required for the S/PDIF hardware
# (in this case 48000Hz)
pcm.mixed-digital {
type plug
slave.pcm "dmix-digital"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.mixed-digital {
type hw
card 0
}

# The following devices are not useful by themselves. They
# require specific rates, channels, and formats. Therefore,
# you probably do not want to use them directly. Instead use
# of of the devices defined above.

# Alias for analog output on the nForce2 (hw:0,0)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.analog-hw {
type hw
card 0
# The default value for device is 0, so no need to specify
}

# Control device (mixer, etc.) for the nForce2 card
ctl.analog-hw {
type hw
card 0
}

# Alias for digital (S/PDIF) output on the nForce2 (hw:0,2)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.digital-hw {
type hw
card 0
device 2
}

# Control device (mixer, etc.) for the nForce2 card
ctl.digital-hw {
type hw
card 0
}

# Direct software mixing plugin for analog output on
# the nForce2 (hw:0,0)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.dmix-analog {
type dmix
ipc_key 1234
slave {
pcm "analog-hw"
period_time 0
period_size 1024
buffer_size 4096
rate 48000
}
}

# Control device (mixer, etc.) for the nForce2 card
ctl.dmix-analog {
type hw
card 0
}

# Direct software mixing plugin for digital (S/PDIF) output
# on the nForce2 (hw:0,2)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.dmix-digital {
type dmix
ipc_key 1235
slave {
pcm "digital-hw"
period_time 0
period_size 1024
buffer_size 4096
rate 48000
}
}

# Control device (mixer, etc.) for the nForce2 card
ctl.dmix-digital {
type hw
card 0
}


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
RE: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Thanks Mike... much clearer :-)

I now get audio output via SPDIF using ALSA:digital, but have terrible
sync and jitter problems when doing so. I get a constant stream of
"Audio buffer overflow, audio data lost!" messages and the video stops
and starts every 1-2 seconds. The audio actually sounds mostly ok, it's
continuous except for occasional hiccups, but is way out of sync with
the video.

I've seen a number of posts about ALSA problems, and wonder if it's just
another example and if anyone has overcome these issues?

Derek.

-----Original Message-----
From: Michael T. Dean [mailto:mtdean@thirdcontact.com]
Sent: Sunday, April 11, 2004 8:37 PM
To: Discussion about mythtv
Cc: Derek Watson; mdenver@bak.rr.com
Subject: Re: [mythtv-users] ALSA and SPDIF Out For nForce2 Motherboards

Sorry for the length of the post, but I'm trying to clear up all
confusion on ALSA's .asoundrc and which ALSA device to use for S/PDIF
output from Myth. The small posts I've made didn't seem to provide
enough information, so I'm going all out on this one. That entails a
lot of "how it works" and a very long--but very flexible--.asoundrc.
(Oh, and by the way, thanks to those who asked these questions, I've
finally cleared up _all_ my confusion about how to create a proper
.asoundrc. :)

<-- snip -->
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Derek Watson wrote:

>Thanks Mike... much clearer :-)
>
>I now get audio output via SPDIF using ALSA:digital, but have terrible
>sync and jitter problems when doing so. I get a constant stream of
>"Audio buffer overflow, audio data lost!" messages and the video stops
>and starts every 1-2 seconds. The audio actually sounds mostly ok, it's
>continuous except for occasional hiccups, but is way out of sync with
>the video.
>
>
Just a wild guess, but are you sure your mythtv was built with ALSA
support. There's a section in mythtv's settings.pro:

# Native ALSA support
#CONFIG += using_alsa
#ALSA_LIBS = -lasound

Uncomment the CONFIG and ALSA_LIBS when building mythtv and see if that
helps. May not help, but that's all I can think of.

Mike
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Hey Michael,

Michael T. Dean wrote:

> Sorry for the length of the post, but I'm trying to clear up all
> confusion on ALSA's .asoundrc and which ALSA device to use for S/PDIF
> output from Myth. The small posts I've made didn't seem to provide
> enough information, so I'm going all out on this one. That entails a
> lot of "how it works" and a very long--but very flexible--.asoundrc.
> (Oh, and by the way, thanks to those who asked these questions, I've
> finally cleared up _all_ my confusion about how to create a proper
> .asoundrc. :)
>
Wonderful job in writing a definative .asoundrc. I've followed your
.asoundrc setup. But I'm still not able to get any sound out of my
SPDIF in mythtv except with *aplay /usr/share/sounds/KDE_Startup.wav*


------------------ <snip>----------------------

>
> #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"
> #}

------------------ <snip>----------------------


I've changed the above to something like this:
------------------ <snip>----------------------
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"
}
------------------ <snip>----------------------

I've even changed the "Audio outout device" in mythtv to "ALSA:digital"
but without any success. Anything else that I need to do?

Thanks
KianTeck
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Just to update:

From the mythfrontend, this is what it says when I tried to switch over
to watch live TV:

--------------<snip>---------------
Opening ALSA audio device 'digital'.
ALSA lib pcm_hw.c:1057:(snd_pcm_hw_open) open /dev/snd/pcmC0D2p failed:
Device or resource busy
Playback open error: Device or resource busy
2004-04-17 23:28:31 Using XV port 105
--------------<snip>---------------

Any help is appreciated.

Thanks
KianTeck
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
KianTeck wrote:

> From the mythfrontend, this is what it says when I tried to switch
> over to watch live TV:
>
> --------------<snip>---------------
> Opening ALSA audio device 'digital'.
> ALSA lib pcm_hw.c:1057:(snd_pcm_hw_open) open /dev/snd/pcmC0D2p
> failed: Device or resource busy
> Playback open error: Device or resource busy
> 2004-04-17 23:28:31 Using XV port 105
> --------------<snip>---------------

That seems to indicate that some other program is using your sound
device. Since you've set a default of "unmixed" digital, only one
process can use the sound at a time. It seems Myth won't do playback if
it cannot get access to the sound device (which is exactly what it
should do).

Therefore, try "mixed" digital as your default. Uncomment this line
instead:

## Uncomment the following to use mixed digital by default
# slave.pcm "dmix-digital"

Note, you will need to restart the program that is currently using your
sound before this will take effect (because it is still using it
exclusively). The easiest way to ensure this happens is probably to
reboot after changing your .asoundrc.

Good luck,
Mike
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Michael T. Dean wrote:

> KianTeck wrote:
>
>> From the mythfrontend, this is what it says when I tried to switch
>> over to watch live TV:
>>
>> --------------<snip>---------------
>> Opening ALSA audio device 'digital'.
>> ALSA lib pcm_hw.c:1057:(snd_pcm_hw_open) open /dev/snd/pcmC0D2p
>> failed: Device or resource busy
>> Playback open error: Device or resource busy
>> 2004-04-17 23:28:31 Using XV port 105
>> --------------<snip>---------------
>
>
> That seems to indicate that some other program is using your sound
> device. Since you've set a default of "unmixed" digital, only one
> process can use the sound at a time. It seems Myth won't do playback
> if it cannot get access to the sound device (which is exactly what it
> should do).
>
> Therefore, try "mixed" digital as your default. Uncomment this line
> instead:
>
> ## Uncomment the following to use mixed digital by default
> # slave.pcm "dmix-digital"
>
> Note, you will need to restart the program that is currently using
> your sound before this will take effect (because it is still using it
> exclusively). The easiest way to ensure this happens is probably to
> reboot after changing your .asoundrc.
>
Did as advised: commented out the slave.pcm "digital" and removed the
comment for slave.pcm "dmix-digital". I then made the change in
MythTV from "ALSA:digital" to "ALSA:dmix-digital" for the "Audio output
device". Rebooted the machine but still no joy. I'm able to get sound
out via the analog output if I change "Audio output device" back to
default of "/dev/dsp".

Please help. This ALSA to SPDIF is making me going crazy.

Thanks
KianTeck

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
KianTeck wrote:

> Did as advised: commented out the slave.pcm "digital" and removed the
> comment for slave.pcm "dmix-digital". I then made the change in
> MythTV from "ALSA:digital" to "ALSA:dmix-digital" for the "Audio
> output device". Rebooted the machine but still no joy. I'm able to
> get sound out via the analog output if I change "Audio output device"
> back to default of "/dev/dsp".

That's the problem. The section that I just had you change was the
section that defined a device called "default" (not called
"dmix-digital"). In other words, the default device is the device used
when no device is specified (i.e. a program uses the ALSA API but
doesn't request a specific device) or when the "default" device is
requested (i.e. for Myth, "ALSA:default").

I suppose I should have included a nice comment at the top of the
.asoundrc listing all the valid devices defined within. Anyway, the
only devices you should ever use are:

analog
mixed-analog
digital
mixed-digital
default

Note that if you leave the entire definition of "pcm.!default"
commented, default will be identical to analog. If you redefine default
by uncommenting the 4-line definition of "pcm.!default" default will be
identical to the device associated with the uncommented slave definition
(mixed-analog, digital, or mixed-digital from top to bottom as shown in
the .asoundrc I posted at
http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=119212&t=search_engine#119212
).

All other names in the .asoundrc--including "dmix-digital" are for
internal use only--they are virtual devices created as aliases to allow
reuse within the file.

So, try using "ALSA:digital" or "ALSA:mixed-digital" and see how it
works. (Or you could use "ALSA:default"--if you leave your .asoundrc as
is (based on the change you just made), this will be the same as using
"ALSA:mixed-digital")

Mike

BTW, that also means that there wasn't necessarily another program using
your audio device. Therefore, you can try both "ALSA:digital" and
"ALSA:mixed-digital" and use whichever you prefer. I recommend testing
by watching some TV and causing the computer to play other noises (i.e.
ssh to the computer and issue an aplay) to see how sound behaves. If
using "digital," the sounds will "queue up" (most likely causing the
application waiting for sound--here aplay--to block), but if using
"mixed-digital," the sounds will play (so the applications won't block).

Also, when you finish watching TV with unmixed output, you'll hear all
the sounds that got queued up--on my system, they play back much louder
than my videos, so it's quite scary to stop a playing video. Because of
that (and because the other sounds usually mean something), I'm using
mixed output (analog in my case because I'm hooked directly to the
speakers).
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Michael T. Dean wrote:

> That's the problem. The section that I just had you change was the
> section that defined a device called "default" (not called
> "dmix-digital"). In other words, the default device is the device
> used when no device is specified (i.e. a program uses the ALSA API but
> doesn't request a specific device) or when the "default" device is
> requested (i.e. for Myth, "ALSA:default").
>
> I suppose I should have included a nice comment at the top of the
> .asoundrc listing all the valid devices defined within. Anyway, the
> only devices you should ever use are:
>
> analog
> mixed-analog
> digital
> mixed-digital
> default
>
> Note that if you leave the entire definition of "pcm.!default"
> commented, default will be identical to analog. If you redefine
> default by uncommenting the 4-line definition of "pcm.!default"
> default will be identical to the device associated with the
> uncommented slave definition (mixed-analog, digital, or mixed-digital
> from top to bottom as shown in the .asoundrc I posted at
> http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=119212&t=search_engine#119212
> ).
>
> All other names in the .asoundrc--including "dmix-digital" are for
> internal use only--they are virtual devices created as aliases to
> allow reuse within the file.
>
> So, try using "ALSA:digital" or "ALSA:mixed-digital" and see how it
> works. (Or you could use "ALSA:default"--if you leave your .asoundrc
> as is (based on the change you just made), this will be the same as
> using "ALSA:mixed-digital")
>
> Mike


No joy again. This is part of my .asoundrc as advised:
------------------ <snip>----------------------
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"
}
------------------ <snip>----------------------

I changed the "Audio Output device" in mythtv to "ALSA:mixed-digital"
and tried to watch live TV again. This is what the mythfrontend says:
------------------ <snip>----------------------
Opening ALSA audio device 'mixed-digital'.
Unable to set hw params for playback: Invalid argument
Error setting audio params: Invalid argument
------------------ <snip>----------------------

I get the same deal too, as above, if I change the "Audio output device"
in mythtv to "ALSA:default". Anyway, I do not get the "Device or
Resource busy" message in both the above settings now.

Setting .asoundrc in mixed digital, while live TV is running, and
issuing "aplay /usr/share/sounds/KDE_Startup.wav" (via ssh) run
immediately without any queuing.

I also noticed TWO other settings in mythtv audio setting (Setup |
General | Audio) "Mixer Device = /dev/mixer" and "Mixer Controls =
PCM". Do I need to change any of one of these 2 values?

>
>
> BTW, that also means that there wasn't necessarily another program
> using your audio device. Therefore, you can try both "ALSA:digital"
> and "ALSA:mixed-digital" and use whichever you prefer. I recommend
> testing by watching some TV and causing the computer to play other
> noises (i.e. ssh to the computer and issue an aplay) to see how sound
> behaves. If using "digital," the sounds will "queue up" (most likely
> causing the application waiting for sound--here aplay--to block), but
> if using "mixed-digital," the sounds will play (so the applications
> won't block).
>
> Also, when you finish watching TV with unmixed output, you'll hear all
> the sounds that got queued up--on my system, they play back much
> louder than my videos, so it's quite scary to stop a playing video.
> Because of that (and because the other sounds usually mean something),
> I'm using mixed output (analog in my case because I'm hooked directly
> to the speakers).
> _______________________________________________

I believe setting to "ALSA:mixed-digital" in mythtv should be what I
want just to avoid surprises/shock at the end of a video session. ;-)

KianTeck

_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Hi,

Anybody got solutions for the following problem?

Thanks
KianTeck

KianTeck wrote:

> Michael T. Dean wrote:
>
>> That's the problem. The section that I just had you change was the
>> section that defined a device called "default" (not called
>> "dmix-digital"). In other words, the default device is the device
>> used when no device is specified (i.e. a program uses the ALSA API
>> but doesn't request a specific device) or when the "default" device
>> is requested (i.e. for Myth, "ALSA:default").
>>
>> I suppose I should have included a nice comment at the top of the
>> .asoundrc listing all the valid devices defined within. Anyway, the
>> only devices you should ever use are:
>>
>> analog
>> mixed-analog
>> digital
>> mixed-digital
>> default
>>
>> Note that if you leave the entire definition of "pcm.!default"
>> commented, default will be identical to analog. If you redefine
>> default by uncommenting the 4-line definition of "pcm.!default"
>> default will be identical to the device associated with the
>> uncommented slave definition (mixed-analog, digital, or mixed-digital
>> from top to bottom as shown in the .asoundrc I posted at
>> http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=119212&t=search_engine#119212
>> ).
>>
>> All other names in the .asoundrc--including "dmix-digital" are for
>> internal use only--they are virtual devices created as aliases to
>> allow reuse within the file.
>>
>> So, try using "ALSA:digital" or "ALSA:mixed-digital" and see how it
>> works. (Or you could use "ALSA:default"--if you leave your .asoundrc
>> as is (based on the change you just made), this will be the same as
>> using "ALSA:mixed-digital")
>>
>> Mike
>
>
>
> No joy again. This is part of my .asoundrc as advised:
> ------------------ <snip>----------------------
> 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"
> }
> ------------------ <snip>----------------------
>
> I changed the "Audio Output device" in mythtv to "ALSA:mixed-digital"
> and tried to watch live TV again. This is what the mythfrontend says:
> ------------------ <snip>----------------------
> Opening ALSA audio device 'mixed-digital'.
> Unable to set hw params for playback: Invalid argument
> Error setting audio params: Invalid argument
> ------------------ <snip>----------------------
>
> I get the same deal too, as above, if I change the "Audio output
> device" in mythtv to "ALSA:default". Anyway, I do not get the "Device
> or Resource busy" message in both the above settings now.
>
> Setting .asoundrc in mixed digital, while live TV is running, and
> issuing "aplay /usr/share/sounds/KDE_Startup.wav" (via ssh) run
> immediately without any queuing.
>
> I also noticed TWO other settings in mythtv audio setting (Setup |
> General | Audio) "Mixer Device = /dev/mixer" and "Mixer Controls =
> PCM". Do I need to change any of one of these 2 values?
>
>>
>>
>> BTW, that also means that there wasn't necessarily another program
>> using your audio device. Therefore, you can try both "ALSA:digital"
>> and "ALSA:mixed-digital" and use whichever you prefer. I recommend
>> testing by watching some TV and causing the computer to play other
>> noises (i.e. ssh to the computer and issue an aplay) to see how sound
>> behaves. If using "digital," the sounds will "queue up" (most likely
>> causing the application waiting for sound--here aplay--to block), but
>> if using "mixed-digital," the sounds will play (so the applications
>> won't block).
>>
>> Also, when you finish watching TV with unmixed output, you'll hear
>> all the sounds that got queued up--on my system, they play back much
>> louder than my videos, so it's quite scary to stop a playing video.
>> Because of that (and because the other sounds usually mean
>> something), I'm using mixed output (analog in my case because I'm
>> hooked directly to the speakers).
>> _______________________________________________
>
>
> I believe setting to "ALSA:mixed-digital" in mythtv should be what I
> want just to avoid surprises/shock at the end of a video session. ;-)
>
> KianTeck
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users@mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>


_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
KianTeck wrote:

> No joy again.
>
> I changed the "Audio Output device" in mythtv to "ALSA:mixed-digital"
> and tried to watch live TV again. This is what the mythfrontend says:
> ------------------ <snip>----------------------
> Opening ALSA audio device 'mixed-digital'.
> Unable to set hw params for playback: Invalid argument
> Error setting audio params: Invalid argument
> ------------------ <snip>----------------------
>
> I get the same deal too, as above, if I change the "Audio output
> device" in mythtv to "ALSA:default". Anyway, I do not get the "Device
> or Resource busy" message in both the above settings now.

Are you certain your MythTV was compiled with native ALSA support?
There's a section in mythtv's settings.pro:

# Native ALSA support
#CONFIG += using_alsa
#ALSA_LIBS = -lasound

Uncomment the CONFIG and ALSA_LIBS lines when building mythtv and see if
that helps (unless you're positive it's been compiled that way). May
not help, but...

> Setting .asoundrc in mixed digital, while live TV is running, and
> issuing "aplay /usr/share/sounds/KDE_Startup.wav" (via ssh) run
> immediately without any queuing.
>
> I also noticed TWO other settings in mythtv audio setting (Setup |
> General | Audio) "Mixer Device = /dev/mixer" and "Mixer Controls =
> PCM". Do I need to change any of one of these 2 values?

Shouldn't be necessary. AFAIK, S/PDIF output is line-level output that
requires a decoder and an amplifier, so you can only adjust volume
externally (on the receiver you're using as a decoder). However, the
.asoundrc has defined control devices even for the digital and
mixed-digital devices, so if your software tries to use it, it's
available (just probably doesn't do anything).

Since you previously said aplay outputs through S/PDIF, your ALSA setup
is correct. (At the time, you were using unmixed digital output as the
default, but the only change we've made since then makes mixed digital
the default. You might want to verify that aplay still works with
S/PDIF, though. Use "aplay" and "aplay -D mixed-digital" to test.)
Therefore, it's probably either the way your MythTV was compiled or an
error (i.e. typo or something) in your Myth database.

You can also try specifying ALSA output without specifying the device
(since you've set your default to mixed digital--i.e. "ALSA"). Don't
know if Myth supports ALSA without an explicit device, but it's worth a try.

Good luck,
Mike
_______________________________________________
mythtv-users mailing list
mythtv-users@mythtv.org
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Michael T. Dean wrote:

> KianTeck wrote:
>
>> No joy again.
>>
>> I changed the "Audio Output device" in mythtv to "ALSA:mixed-digital"
>> and tried to watch live TV again. This is what the mythfrontend says:
>> ------------------ <snip>----------------------
>> Opening ALSA audio device 'mixed-digital'.
>> Unable to set hw params for playback: Invalid argument
>> Error setting audio params: Invalid argument
>> ------------------ <snip>----------------------
>>
>> I get the same deal too, as above, if I change the "Audio output
>> device" in mythtv to "ALSA:default". Anyway, I do not get the
>> "Device or Resource busy" message in both the above settings now.
>
>
> Are you certain your MythTV was compiled with native ALSA support?
> There's a section in mythtv's settings.pro:
>
> # Native ALSA support
> #CONFIG += using_alsa
> #ALSA_LIBS = -lasound
>
> Uncomment the CONFIG and ALSA_LIBS lines when building mythtv and see
> if that helps (unless you're positive it's been compiled that way).
> May not help, but...


I installed my MythTV using "apt-get install mythtv-suite" as detailed
in Jarod's guide. So, I cannot be certain if it was compiled with
native ALSA support. How can I confirm it?

>
>> Setting .asoundrc in mixed digital, while live TV is running, and
>> issuing "aplay /usr/share/sounds/KDE_Startup.wav" (via ssh) run
>> immediately without any queuing.
>>
>> I also noticed TWO other settings in mythtv audio setting (Setup |
>> General | Audio) "Mixer Device = /dev/mixer" and "Mixer Controls =
>> PCM". Do I need to change any of one of these 2 values?
>
>
> Shouldn't be necessary. AFAIK, S/PDIF output is line-level output
> that requires a decoder and an amplifier, so you can only adjust
> volume externally (on the receiver you're using as a decoder).
> However, the .asoundrc has defined control devices even for the
> digital and mixed-digital devices, so if your software tries to use
> it, it's available (just probably doesn't do anything).
>
> Since you previously said aplay outputs through S/PDIF, your ALSA
> setup is correct. (At the time, you were using unmixed digital output
> as the default, but the only change we've made since then makes mixed
> digital the default. You might want to verify that aplay still works
> with S/PDIF, though. Use "aplay" and "aplay -D mixed-digital" to
> test.) Therefore, it's probably either the way your MythTV was
> compiled or an error (i.e. typo or something) in your Myth database.

------------------ <snip>----------------------
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"
}
------------------ <snip>----------------------

ok, so with mixed-digital still at my default in .asoundrc, I tried both
the "aplay -D mixed-digital" and "aplay", I can get sound through the
SPDIF. But still not able to get sound through SPDIF in MythTV.

However, reviewing through this thread (way back to the Apr 10), I did
noticed a reply by Chris. After following his instructions in adding
the "options snd-pcm-oss adsp_map=2" to /etc/modules.conf and changing
MythTV to use /dev/adsp, I can get sound through SPDIF. I am I right in
saying this is using the oss emulation?

KianTeck
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Friday 23 April 2004 09:01, KianTeck wrote:
> Michael T. Dean wrote:
> > Uncomment the CONFIG and ALSA_LIBS lines when building mythtv and see
> > if that helps (unless you're positive it's been compiled that way).
> > May not help, but...
>
> I installed my MythTV using "apt-get install mythtv-suite" as detailed
> in Jarod's guide. So, I cannot be certain if it was compiled with
> native ALSA support. How can I confirm it?

Like this. Native ALSA support is enabled in Axel's Myth rpms. ;-)

- --
Jarod C. Wilson, RHCE
jcw@wilsonet.com

Got a question? Read this first...
     http://catb.org/~esr/faqs/smart-questions.html
MythTV, Fedora Core & ATrpms documentation:
     http://wilsonet.com/mythtv/
MythTV Searchable Mailing List Archive
     http://www.gossamer-threads.com/archive/MythTV_C2/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAiU7Rln8CX+oYdJURAjDqAKCDkRub3VUlVFlyurgyvZ6mZyE2wQCfQUKU
sP2hgbSXZmQG+JkNpY42Q+c=
=/4Fn
-----END PGP SIGNATURE-----
Re: ALSA and SPDIF Out For nForce2 Motherboards [ In reply to ]
Hey Jarod,

Thanks for helping to confirm that.

Cheers
KianTeck