Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asound.conf configurability (problem with sound on Dell XPS 13) #5755

Closed
sorokin opened this issue Jan 14, 2015 · 6 comments
Closed

asound.conf configurability (problem with sound on Dell XPS 13) #5755

sorokin opened this issue Jan 14, 2015 · 6 comments

Comments

@sorokin
Copy link
Contributor

sorokin commented Jan 14, 2015

I just recently installed nixos. And I'm new to it. I had a few problems installing nixos on my new laptop Dell XPS 13.

One problem was that I had no sound by default. The problem it that alsa detect 2 sound cards on my laptop: "hw:1,0" -- the real one and "hw:0,0" -- I don't know what it is. Presumable it is HDMI sound, but I'm not sure.

By default, when no /etc/asound.conf present, alsa uses hw:0,0. So I wrote asound.conf to select hw:1,0 as a default sound card.

pcm.!default {
    type plug
    slave.pcm "hw:1,0"
}

ctl.!default {
    type hw
    card 1
}

The second problem was the was no mixing enabled. I had to enable mixing manually:

pcm.!default {
   type plug
   slave.pcm {
      type dmix
      ipc_key 1024
      slave.pcm "hw:1,0"
   }
}

ctl.!default {
    type hw
    card 1
}

I think that is it very useful to allow configuring alsa in configuration.nix.

As a user I would like to have:

  • simple option to select the default card/device
  • simple bool flag to enable dmix. By default this flag should be true as user expects to be able to play sound from many programs simultaneously. Probably when pulseaudio is enabled this flag should default to false, as pulseaudio could do mixing instead of dmix.
  • (for advanced users) ability override settings and write asound.conf directly.

Also I think hardware-configuration.nix should detect Dell XPS 13 and set default sound device to "hw:1,0". Probably even better solution would be if alsa automatically select right sound card as "card 0". But I don't know where to report this bug to.

@bjornfor
Copy link
Contributor

I'm just going to mention that you can configure asound.conf directly from configuration.nix: environment.etc."asound.conf".text = "blah blah";

@bluescreen303
Copy link
Contributor

We should also refrain from explicitly enabling or disabling dmix.
Many sound cards support hardware mixing and don't need dmix. Alsa's default is to only enable dmix for cards that are not capable by themselves.

@rushmorem
Copy link
Contributor

Also note that you can override settings and write asound.conf in configuration.nix through the sound.extraConfig option. For example:

  sound.extraConfig =
    ''
      defaults.pcm.!card 1
      defaults.ctl.!card 1
    '';

@jagajaga
Copy link
Member

jagajaga commented Feb 8, 2015

So did this help?

@acertain
Copy link
Contributor

Setting sound.extraConfig (at least) with pulseaudio enabled will error with

duplicate entry asound.conf -> /nix/store/pxkb4wldsmiwfdkjgdj530h74ls630rl-asound.conf
mismatched duplicate entry /nix/store/f6l3n995rll3cv70kr09hgmzan8wd97z-asound.conf <-> /nix/store/pxkb4wldsmiwfdkjgdj530h74ls630rl-asound.conf

Disabling pulseaudio works as a workaround.

/nix/store/f6l3n995rll3cv70kr09hgmzan8wd97z-asound.conf is from sound.extraConfig
/nix/store/f6l3n995rll3cv70kr09hgmzan8wd97z-asound.conf is from pulseaudio

@jagajaga
Copy link
Member

Sorely. Because the first one is just for alsa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants