Not recording system audio or audio from microphone properly

I’m using gentoo linux 64bit, audacity version 2.0.2 and my sound setup is only alsa. My old .asoundrc file used to do recording from system audio and recording from the microphone jack fine and a couple updates to things later it doesn’t work right. If I record from system audio it’s pretty low and distorted. I used to be able to record using a microphone cable going to my nintendo 2DS so I could record my music from korg dsn12. If I try to do that now, it has a few tiny audio skips and it changes the volume levels while it is playing.

My audio sources to record from in the mic dropdown are HDA Intel PCH: ALC269VB Analog (hw:0,0), Loopback: Loopback PCM (hw:1,0), Loopback: Loopback PCM (hw:1,1), sysdefault, and default.
My audio sources in the dropdown are HDA Intel PCH: ALC269VB Analog (hw:0,0), HDA Intel PCH: HDMI 0 (hw:0,3), Loopback: Loopback PCM (hw:1,0), Loopback: Loopback PCM (hw:1,1), front, surround40, surround51, surround71, hdmi, both, dmix, and default.

My current .asoundrc:

defaults.pcm.dmix.!rate 48000
defaults.pcm.dmix.!format S16_LE
pcm.multi {
    type multi
    slaves.a.pcm "dmix:PCH"
    slaves.a.channels 2
    slaves.b.pcm "dmix:PCH"
    slaves.b.channels 2
    bindings.0 { slave a; channel 0; }
    bindings.1 { slave a; channel 1; }
    bindings.2 { slave b; channel 0; }
    bindings.3 { slave b; channel 1; }
}
pcm.both {
    type route
    slave.pcm "multi"
    ttable.0.0 1
    ttable.1.1 1
    ttable.0.2 1
    ttable.1.3 1
}
pcm.!default {
    type asym
    playback.pcm "plug:both"
    capture.pcm "plug:dsnoop:PCH"
}

and here’s my old .asoundrc:

pcm.!default {
  type asym
  playback.pcm "LoopAndReal"
  #capture.pcm "looprec"
  capture.pcm "hw:0,0"
}

pcm.looprec {
    type hw
    card "Loopback"
    device 1
    subdevice 0
}


pcm.LoopAndReal {
  type plug
  slave.pcm mdev
  route_policy "duplicate"
}


pcm.mdev {
  type multi
  slaves.a.pcm pcm.MixReale
  slaves.a.channels 2
  slaves.b.pcm pcm.MixLoopback
  slaves.b.channels 2
  bindings.0.slave a
  bindings.0.channel 0
  bindings.1.slave a
  bindings.1.channel 1
  bindings.2.slave b
  bindings.2.channel 0
  bindings.3.slave b
  bindings.3.channel 1
}


pcm.MixReale {
  type dmix
  ipc_key 1024
  slave {
    pcm "hw:0,0"
    rate 48000
    #rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

pcm.MixLoopback {
  type dmix
  ipc_key 1025
  slave {
    pcm "hw:Loopback,0,0"
    rate 48000
    #rate 44100
    periods 128
    period_time 0
    period_size 1024 # must be power of 2
    buffer_size 8192
  }
}

I changed the .asoundrc because the old one was giving me playback issues on several programs.

Try recording using “arecord” as described here: http://www.alsa-project.org/main/index.php/SoundcardTesting
Can you get that working properly?

Well it looked like maybe it was recording system audio but I played back the file and it was all silence.

arecord -vv -fdat ~/tmp/test.wav
Recording WAVE '/home/todd/tmp/test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Direct Snoop PCM
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 16384
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 16384
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Hardware PCM card 0 'HDA Intel PCH' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 16384
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : ENABLE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 4611686018427387904
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
  appl_ptr     : 0
  hw_ptr       : 0
# +                                                | 02%^C
Aborted by signal Interrupt...
# +                                                | 02%

In another terminal window run:

alsamixer

and check your recording settings.

I was using earbuds to make sure it wasn’t recording sound from the laptop’s built in mic instead of the system audio.

https://i.imgur.com/bYrBsxL.png