public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Setting basic ALSA defaults
@ 2012-04-25 18:58 Stroller
  2012-04-25 19:49 ` ny6p01
  2012-04-25 21:29 ` Stroller
  0 siblings, 2 replies; 4+ messages in thread
From: Stroller @ 2012-04-25 18:58 UTC (permalink / raw
  To: gentoo-user

Hi guys,

I've got a a little nettop which I'm trying to set up for XBMC. As I don't normally use Linux on the desktop, but primarily for headless servers, this has been a little bit of a journey for me, but I now have X11 and the nVidia drivers working, and basic audio playback.

So this particular system (eMachines 1401) defaults to the headphone output, and I've learned that to get it to output over HDMI I have to run:
     aplay -vvD plug:hdmi file.wav

I also, then, have to enter alsamixer and unmute the "S/PDIF 1" output (that seems to be muted by default on this system) and audio starts coming through on the TV.

So I want to set, of course, HDMI as the default output, so I created an /etc/asound.conf and put the following in it:

  pcm.!default {
        type hw
        card 0
        device 3
  }

  ctl.!default {
        type hw           
        card 0
        device 3
  }


This is great! Now when I run aplay I can omit the "-D $devicename" flag and everything's good.

Now I have to admit, I figured out the above more or less by trial and error (that, for instance, I can't describe the output as "card 0,3", but I have to have the separate device line), and the "pcm" and "ctl" parts, and the structure I just copied of the documentation at the ALSA website. I don't find that documentation very clear.

So this is problematic the next time I reboot, because all of a sudden, now alsamixer doesn't work. In fact, I can demonstrate that the problem is related directly to this file:

# alsamixer 
cannot open mixer: Invalid argument
# rm /etc/asound.conf 
# alsamixer                                                              
# echo $?
0
# 

So could anyone possibly explain this for me, please?

I'm liable to have another question or two in a moment, but I'd initially just really love to understand why the alsa documentation says to have separate pcm.!default and ctl.!default definitions (instead of a single "everything.!default) and why alsamixer has now broke.

Many thanks in advance for any help you can offer,

Stroller.









^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] Setting basic ALSA defaults
  2012-04-25 18:58 [gentoo-user] Setting basic ALSA defaults Stroller
@ 2012-04-25 19:49 ` ny6p01
  2012-04-25 21:14   ` Stroller
  2012-04-25 21:29 ` Stroller
  1 sibling, 1 reply; 4+ messages in thread
From: ny6p01 @ 2012-04-25 19:49 UTC (permalink / raw
  To: gentoo-user

On Wed, Apr 25, 2012 at 07:58:54PM +0100, Stroller wrote:
> Hi guys,
> 
> I've got a a little nettop which I'm trying to set up for XBMC. As I don't normally use Linux on the desktop, but primarily for headless servers, this has been a little bit of a journey for me, but I now have X11 and the nVidia drivers working, and basic audio playback.
> 
> So this particular system (eMachines 1401) defaults to the headphone output, and I've learned that to get it to output over HDMI I have to run:
>      aplay -vvD plug:hdmi file.wav
> 
> I also, then, have to enter alsamixer and unmute the "S/PDIF 1" output (that seems to be muted by default on this system) and audio starts coming through on the TV.
> 
> So I want to set, of course, HDMI as the default output, so I created an /etc/asound.conf and put the following in it:
> 
>   pcm.!default {
>         type hw
>         card 0
>         device 3
>   }
> 
>   ctl.!default {
>         type hw           
>         card 0
>         device 3
>   }
> 
> 
> This is great! Now when I run aplay I can omit the "-D $devicename" flag and everything's good.
> 
> Now I have to admit, I figured out the above more or less by trial and error (that, for instance, I can't describe the output as "card 0,3", but I have to have the separate device line), and the "pcm" and "ctl" parts, and the structure I just copied of the documentation at the ALSA website. I don't find that documentation very clear.
> 
> So this is problematic the next time I reboot, because all of a sudden, now alsamixer doesn't work. In fact, I can demonstrate that the problem is related directly to this file:
> 
> # alsamixer 
> cannot open mixer: Invalid argument
> # rm /etc/asound.conf 
> # alsamixer                                                              
> # echo $?
> 0
> # 
> 
> So could anyone possibly explain this for me, please?
> 
> I'm liable to have another question or two in a moment, but I'd initially just really love to understand why the alsa documentation says to have separate pcm.!default and ctl.!default definitions (instead of a single "everything.!default) and why alsamixer has now broke.
> 
> Many thanks in advance for any help you can offer,
> 
> Stroller.

Just a shot in the dark here, Stroller, but I once had a problem with using
a mixer app (not alsamixer, which worked). I couldn't get it to start, and
it kept on giving an error like your's above for alsamixer. The problem was
that the kernel module, snd-mixer-oss was not loading by default, and when I
loaded that module, all was good. HTH.

Terry




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] Setting basic ALSA defaults
  2012-04-25 19:49 ` ny6p01
@ 2012-04-25 21:14   ` Stroller
  0 siblings, 0 replies; 4+ messages in thread
From: Stroller @ 2012-04-25 21:14 UTC (permalink / raw
  To: gentoo-user


On 25 April 2012, at 20:49, ny6p01@gmail.com wrote:
> ...
> Just a shot in the dark here, Stroller, but I once had a problem with using
> a mixer app (not alsamixer, which worked). I couldn't get it to start, and
> it kept on giving an error like your's above for alsamixer. The problem was
> that the kernel module, snd-mixer-oss was not loading by default, and when I
> loaded that module, all was good. HTH.

Thanks for the suggestion, but that didn't work.

I had to recompile my kernel for the new module, then reboot:


# alsamixer 
cannot open mixer: Invalid argumentxmbc ~ # lsmod | grep -i snd_mix                                                
# lsmod | grep -i snd    
snd_hda_codec_hdmi     23052  1 
snd_hda_codec_realtek   311454  1 
snd_hda_intel          23052  1 
snd_hda_codec          77939  3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel
snd_hwdep               6540  1 snd_hda_codec
snd_pcm                81875  4 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec
snd_timer              20907  1 snd_pcm
snd                    64619  8 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer
soundcore               6858  1 snd
snd_page_alloc          8021  2 snd_hda_intel,snd_pcm
# modprobe -v snd-mixer-oss                                              
insmod /lib/modules/3.0.3/kernel/sound/core/oss/snd-mixer-oss.ko 
# alsamixer                                                              
cannot open mixer: Invalid argument
# 

I didn't really expect it to work, to be honest, as the difference seems to be entirely in the file.

If I start the music playing in one console using `aplay -vv file.wav` (i.e. the /etc/asound.conf file is present and tells aplay to use HDMI out) then move to another terminal window and run `alsamixer` then I get this "cannot open mixer: Invalid argument" error. If I then delete /etc/asound.conf, alsamixer works perfectly and I can mute and unmute the S/PDIF.

Stroller.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] Setting basic ALSA defaults
  2012-04-25 18:58 [gentoo-user] Setting basic ALSA defaults Stroller
  2012-04-25 19:49 ` ny6p01
@ 2012-04-25 21:29 ` Stroller
  1 sibling, 0 replies; 4+ messages in thread
From: Stroller @ 2012-04-25 21:29 UTC (permalink / raw
  To: gentoo-user


On 25 April 2012, at 19:58, Stroller wrote:
> ...
> So this is problematic the next time I reboot, because all of a sudden, now alsamixer doesn't work. In fact, I can demonstrate that the problem is related directly to this file:
> 
> # alsamixer 
> cannot open mixer: Invalid argument
> # rm /etc/asound.conf 
> # alsamixer                                                              
> # echo $?
> 0
> # 
> 
> So could anyone possibly explain this for me, please?

Ok, fixed this.

`alsamixer -c 0` makes it work.

I was sure I tried this before, and it didn't work. Confusion is compounded here, because I'm using my laptop, working by SSH, and if I leave the nettop for too long the TV screen blanks; this onboard audio requires the nVidia drivers to be loaded, and this screen blanking also causes the audio to stop. I keep forgetting to notice this! 

If anyone could explain how I make card 0 the default for alsamixer, too, then I'd be very grateful. That question leads on to… 

> I'm liable to have another question or two in a moment, but I'd initially just really love to understand why the alsa documentation says to have separate pcm.!default and ctl.!default definitions (instead of a single "everything.!default) 

TIA,

Stroller.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-25 21:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-25 18:58 [gentoo-user] Setting basic ALSA defaults Stroller
2012-04-25 19:49 ` ny6p01
2012-04-25 21:14   ` Stroller
2012-04-25 21:29 ` Stroller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox