Linux, ALSA, and external DACs

Discussion in 'Computer Audiophile: Software, Configs, Tools' started by Xen, Dec 17, 2015.

Tags:
  1. Xen

    Xen Friend

    Pyrate
    Joined:
    Sep 30, 2015
    Likes Received:
    207
    Trophy Points:
    43
    Location:
    Houston, TX
    I just spent a good 3 hours getting my Linux machine to output to Gungnir Multibit in both exclusive and mixer modes.

    My setup is
    Linux ALSA --> USB --> Gungnir Multibit --> AV Receiver --> HE560
    Windows 7 --> Soundblaster Z --> TOSLINK --> Gungnir Multibit --> AV Receiver --> HE560

    For Windows, I was up and running pretty quick. I just needed to toggle "Play stereo mix to digital output" to get SBX Pro Studio to output 3D sound into the Gungnir Multibit. I can set exclusive mode through Foobar.

    For Linux, DeadBeef makes exclusive mode easy. I was playing FLACs through Gungnir Multibit in minutes. The problem was ALSA. I could either get 1 sound stream to go through Gungnir Multibit OR dmix through the onboard DAC. I was not able to get my old asoundrc file to use dmix correctly. Without dmix, web-browser (e.g. youtube) sound and clementine would be silent. mpv and alsaplayer would work, but only 1 at a time.

    Code:
    $aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 0: PCH [HDA Intel PCH], device 0: ALC898 Analog [ALC898 Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 1: ALC898 Digital [ALC898 Digital]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: Device [Schiit USB Audio Device], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    
    So the Gungnir Multibit was detected and attached as card 1, device 0. This meant "hw: 1,0" in ALSA syntax. After fruitless attempts at writing an asoundrc, I went googling and tried many different how-to's. The one that worked is this one: http://www.alsa-project.org/main/index.php/Asoundrc#dmix
     
  2. OJneg

    OJneg The Most Insufferable

    Pyrate BWC
    Joined:
    Sep 25, 2015
    Likes Received:
    3,923
    Trophy Points:
    113
    Location:
    Grand Rapids, MI
    I'm going to need to try this with my USB-connected DAC later. I would expect a device that works natively with Mac machines to also do so with Linux ones?
     
  3. IndySpeed

    IndySpeed Friend

    Pyrate
    Joined:
    Nov 19, 2015
    Likes Received:
    120
    Trophy Points:
    43
    Location:
    Indianapolis
    Home Page:

    Is there a reason why you are using an asoundrc file? In my DeaDBeeF setup, I just use the Sound Tab and change it to the "ALSA output plugin" and select the "Schiit USB Audio Gen 2, USB Audio IEC958 (S/PDIF) Digital Audio Output". I don't even have to use the alsamixer program to change the volume level to 0.0dB with this Schiit. I do though change the plugin configuration for ALSA to turn off ALSA resampling.
     
  4. sorrodje

    sorrodje Carla Bruni's other lover - Friend

    Staff Member Pyrate MZR
    Joined:
    Sep 27, 2015
    Likes Received:
    2,812
    Trophy Points:
    113
    Location:
    Dijon / Burgundy / France / EU
    It does with my linux machines at least. I can use pulseaudio or ALSA directly without any kind of special configuration with esoteric commands. I just have to select the good soundcard in the right place (sound config or in the player itself) . As much as I love to get into conf and commands for My server, I can't stand that for my home Laptop.
     
  5. Xen

    Xen Friend

    Pyrate
    Joined:
    Sep 30, 2015
    Likes Received:
    207
    Trophy Points:
    43
    Location:
    Houston, TX
    That implements DeadBeef's exclusive mode, meaning only DeadBeef can output through the USB and into the Gungnir Multibit. Great for when doing critical listening, but bad for needing to hear some music while doing other things and testing this or that. I needed to use asoundrc so that all sounds would be able to go through the USB and into the Gungnir Multibit as long as DeadBeef was not playing.

    For me, Linux is my main PC. I need to be able to hear browser videos playing and that requires dmix, at least in my system because idiotic flash (pepper or adobe) just uses the default sound"card 0", which is HDA Intel as implemented by a RealTek ALC889. Gungnir Multibit is attached as "card 1". The only way to fix this would be play with kernel module load order and ensure Gungnir Multibit loaded first so it can claim "card 0". Dunno about you, but I want EVERYTHING going through Gungnir Multibit!! |\/|
     
  6. Xen

    Xen Friend

    Pyrate
    Joined:
    Sep 30, 2015
    Likes Received:
    207
    Trophy Points:
    43
    Location:
    Houston, TX
    Yes, if you just plan on using a good media player like DeadBeef, then its just plug and play. Linux instantly recognized my Gungnir Multibit when I powered the Gungnir Multibit up. Automatically loaded the required driver for USB Audio 2. Opened up DeadBeef and it had Schiit listed in its preferences for exclusive mode. Selected it and was playing music within minutes of unboxing and cabling.

    I needed something a bit more fancy as I wanted all of my Linux box's sound to go through the Gungnir Multibit unless I specified going through the Realtek.
     
  7. OJneg

    OJneg The Most Insufferable

    Pyrate BWC
    Joined:
    Sep 25, 2015
    Likes Received:
    3,923
    Trophy Points:
    113
    Location:
    Grand Rapids, MI
    I mainly want to use my Linux-based laptop as a recording dealio. I had troubles getting things to run with Ardour (a DAW) a while back, but I didn't try too hard.
     
  8. IndySpeed

    IndySpeed Friend

    Pyrate
    Joined:
    Nov 19, 2015
    Likes Received:
    120
    Trophy Points:
    43
    Location:
    Indianapolis
    Home Page:
    Oh ok... That makes sense. I'll keep that in mind if I need/want to do that in the future. My Linux box is my main box too... In fact, I have three of them running. One is my main laptop. One is my main server (audio, video, and pictures), and the other Linux laptop is used by my wife which I just finished reconfiguring for meets. Anyway, I just play all of my other audio through the built-in speaker system or jacks, and I just kept things really simple by not having the standard pulseaudio system use the USB audio device (Bifrost Multibit) at all. I was actually bypassing all of that. Sounds like you integrated all of it through the asoundrc file which is cool. I have played with the asoundrc file in the past, but I never got the results I wanted. I don't suppose you could send me a copy so I could actually see one that works, could you?
     
  9. Xen

    Xen Friend

    Pyrate
    Joined:
    Sep 30, 2015
    Likes Received:
    207
    Trophy Points:
    43
    Location:
    Houston, TX
    I thought that would make my post too long, so I just left the link of where I got mine from.
    I use ~/.asoundrc so this only affects me...even though I am the ONLY user...
    Code:
    pcm.!default {
        type plug
        slave.pcm "dmixer"
    }
    
    pcm.dmixer  {
         type dmix
         # unique identifier, if you want add a second dmixer, you need another stanza and use another number.
         ipc_key 1024
         slave {
            # aplay -l showed Gungnir Multibit to be at Card 1, Device 0 so that becomes "hw:1,0"
            pcm "hw:1,0"
            # not sure what these do as I don't quite understand the ALSA wikis explanation for these 3
            period_time 0
            period_size 1024
            buffer_size 4096
            # force 44.1khz to keep Gungnir Multibit from clicking. Does not affect exclusive mode. Only affects dmix rate.
            rate 44100
            # really should just use S16_LE, but this works
            format S24_3LE
        }
        bindings {
            0 0
            1 1
        }
    }
    
    ctl.dmixer {
        type hw
            # change this to match the "card" you are interested in
        card 1
    }
    
     
  10. IndySpeed

    IndySpeed Friend

    Pyrate
    Joined:
    Nov 19, 2015
    Likes Received:
    120
    Trophy Points:
    43
    Location:
    Indianapolis
    Home Page:
    Cool! Thanks for posting that!
     

Share This Page