You are not logged in.

#1 2016-09-10 08:44:03

bergqvistjl
Member
Registered: 2011-01-05
Posts: 55

How to change my default ALSA device so that it still bitstreams?

I have a single card on my system which consists of 4 devices. The bottom one is the only one that outputs audio, yet the top one is I presume the default, and so programs default to that, which doesn't give me any audio.

What's is the best way to change it so that the default device is Card 0 Dev 9? The alsa wiki on here doesn't make it clear at all.

When I run aplay -l, I have the following outout:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

When I run aplay -L, I get this output:
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    PulseAudio Sound Server
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=1
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=2
    HDA NVidia, HDMI 0
    HDMI Audio Output
hdmi:CARD=NVidia,DEV=3
    HDA NVidia, HDMI 0
    HDMI Audio Output

Last edited by bergqvistjl (2016-09-10 10:18:18)

Offline

#2 2016-09-10 09:29:46

bergqvistjl
Member
Registered: 2011-01-05
Posts: 55

Re: How to change my default ALSA device so that it still bitstreams?

Well i've created an .asoundrc file with this:
defaults.pcm.card 0
defaults.pcm.device 9
defaults.ctl.card 0

Which has fixed the firefox problem, but now it's broken other applications. Previously (where I was able to manually select what was my 4th device from within the applications) they would bitstream the audio track (whatever it was at) to my AV reciever, now they don't and it's all sent as a 48khz PCM stream hmm

So how can I have my default device set to the correct one WITHOUT it sending everything out as a 48khz PCM stream? (i.e so it bistreams the raw audio out instead)

Last edited by bergqvistjl (2016-09-10 10:09:53)

Offline

#3 2016-09-10 20:06:59

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: How to change my default ALSA device so that it still bitstreams?

So how can I have my default device set to the correct one WITHOUT it sending everything out as a 48khz PCM stream? (i.e so it bistreams the raw audio out instead)

One way to make sure that the audio data is not dithered/resampled/altered is to send the stream directly to the Card=0, Device=9 device when using ALSA is by adding the bang symbol ("!") to that .asoundrc file (and optionally use names instead of numbers):

defaults.pcm.!card NVidia
defaults.pcm.!device 9
defaults.pcm.!ctl NVidia

But you (and any future readers) should be aware that the above will not allow multiple audio streams to be played simultaneously, and/or if you attempt to play an audio stream that the hardware can't handle, then ALSA will produce an error because that configuration removes all ALSA plugins (like "dmix" and "plug") from the picture. (Hint: You can add things back by modifying the configuration file)

One reason I bring that up is that my USB DAC can only handle signed 32 bit little endian audio, and good luck finding files like that occurring naturally in the wild.

A way to determine what type of streams the audio hardware accepts is to look at the contents of the /proc/asound/card*/codec* file, paying attention to the "rates", "bits", and "formats" fields. [But in the case of my USB DAC, that info is in the /proc/asound/card*/stream* file]

The Gentoo folks have some good info about this topic (especially ALSA S/PDIF and HDMI tuning) at:

   https://wiki.gentoo.org/wiki/ALSA

Here's the ALSA plugin documentation mothership:

   http://www.alsa-project.org/alsa-doc/al … ugins.html

Offline

Board footer

Powered by FluxBB