You are not logged in.

#1 2022-02-17 22:52:45

ricardo01l
Member
Registered: 2020-12-30
Posts: 19

[Solved] Set default capture device with alsa

I'm trying to configure a microphone. I could record with audacity and with

arecord --device=plughw:0,0

Tried writing this on ~/.asoundrc

capture.pcm {

type plug

slave.pcm "default microphone"

type hw

card 0

device 0

}

now the output for

 arecord -vvv --format=dat --device=plughw:0,0 test-mic.wav 
Recording WAVE 'test-mic.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Hardware PCM card 0 'HDA Intel MID' device 0 subdevice 0
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  : 24000
  period_size  : 6000
  period_time  : 125000
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 6000
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 24000
  silence_threshold: 0
  silence_size : 0
  boundary     : 6755399441055744000
  appl_ptr     : 0
  hw_ptr       : 0
Max peak (12000 samples): 0x00008000 #################### 100%
Max peak (12000 samples): 0x00008000 #################### 100%
Max peak (12000 samples): 0x0000732c ##################   89%
Max peak (12000 samples): 0x00007302 ##################   89%
Max peak (12000 samples): 0x000065f5 ################     79%
Max peak (12000 samples): 0x000067b9 #################    81%
Max peak (12000 samples): 0x00006bbd #################    84%
Max peak (12000 samples): 0x00006ee3 ##################   86%

As you can see in the percentages it's recording correctly, but with

arecord -vvv --format=dat --device=plughw:0,0 test-mic.wav 
Recording WAVE 'test-mic.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Linear conversion PCM (S32_LE)
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
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 16384
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Slave: Soft volume PCM
Control: Digital Capture Volume
min_dB: -30
max_dB: 30
resolution: 121
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 16384
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 16384
  silence_threshold: 0
  silence_size : 0
  boundary     : 4611686018427387904
Slave: Direct Snoop PCM
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 16384
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  tstamp_type  : MONOTONIC
  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 MID' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 16384
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : ENABLE
  tstamp_type  : MONOTONIC
  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
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%
Max peak (2048 samples): 0x00000000 #                    0%

I get this. I think I have to configure correctly which capture device to use by default on the ~/asoundrc

Thanks for reading me and helping.

Last edited by ricardo01l (2022-03-01 21:30:18)

Offline

#2 2022-02-17 23:17:45

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,292

Re: [Solved] Set default capture device with alsa

I'm not sure what you are actually asking?  The config is nonsensical, but yes with plughw you can access a device directly. Do you have specific programs you are having issues with? It does sound like you want a duplex stream that can be accessed via "default" regardless, which would be explained in: https://wiki.archlinux.org/title/Advanc … ure_device

In general "default" is a very loose and not clearly defined concept in ALSA and this is highly dependent on how each and every application decides to handle things. If you want more logical consistency consider pulseaudio or pipewire.

Last edited by V1del (2022-02-17 23:19:39)

Offline

#3 2022-03-01 21:29:59

ricardo01l
Member
Registered: 2020-12-30
Posts: 19

Re: [Solved] Set default capture device with alsa

Thanks! Installing pulseaudio worked out of the box. An aclaration: the problem was that alsa was recognizing the mic, but it was choosing the incorrect capture device. I think with https://wiki.archlinux.org/title/Advanc … ure_device, you could configure it, but it's easier to use pulse.

Offline

Board footer

Powered by FluxBB