Skip to contentSkip to conversation

how to configure .asoundrc to make arecord use a default device

DISCUSSION Jelle de Jong 2 participants 7 messages Jul 29, 2009

lore
Share & tools
lore
#0 lore raw

Hello everybody,

I am having some issues making arecord use the default device for recording. Could somebody help me get a working .asoundrc configuration?

I attached all information in the attachment and also made temporary hyperlink: http://debian.pastebin.com/m52601230

It works with:
arecord -v -f S16_LE -r 44100 -D audiodevice0 ~/record0.wav but it does not work with:
arecord -v -f S16_LE -r 44100 ~/record0.wav

background:
http://mailman.alsa-project.org/pipermail/alsa-devel/2008-November/012366.html

Thanks in advance,

Best regards,

Jelle de Jong

------------------------------------------------------------------------

# ls -hal /dev/snd/
total 0
drwxr-xr-x  2 root root       320 2009-07-29 10:21 .
drwxr-xr-x 14 root root      4.9K 2009-07-29 12:26 ..
crw-rw----  1 root user0 116,   0 2009-07-29 10:21 controlC0
crw-rw----  1 root user1 116,  32 2009-07-29 10:21 controlC1
crw-rw----  1 root user2 116,  64 2009-07-29 10:21 controlC2
crw-rw----  1 root user3 116,  96 2009-07-29 10:21 controlC3
crw-rw----  1 root user0 116,  24 2009-07-29 10:21 pcmC0D0c
crw-rw----  1 root user0 116,  16 2009-07-29 11:26 pcmC0D0p
crw-rw----  1 root user1 116,  56 2009-07-29 10:21 pcmC1D0c
crw-rw----  1 root user1 116,  48 2009-07-29 10:40 pcmC1D0p
crw-rw----  1 root user2 116,  88 2009-07-29 10:21 pcmC2D0c
crw-rw----  1 root user2 116,  80 2009-07-29 12:26 pcmC2D0p
crw-rw----  1 root user3 116, 120 2009-07-29 10:21 pcmC3D0c
crw-rw----  1 root user3 116, 112 2009-07-29 10:37 pcmC3D0p
crw-rw----  1 root audio 116,   1 2009-07-29 10:21 seq
crw-rw----  1 root audio 116,  33 2009-07-29 10:21 timer

------------------------------------------------------------------------

# cat /proc/asound/cards
 0 [audiodevice0   ]: USB-Audio - C-Media USB Audio Device
                      C-Media USB Audio Device    at usb-0000:00:13.0-1, full speed
 1 [audiodevice1   ]: USB-Audio - C-Media USB Audio Device
                      C-Media USB Audio Device    at usb-0000:00:13.0-2, full speed
 2 [audiodevice2   ]: USB-Audio - C-Media USB Audio Device
                      C-Media USB Audio Device    at usb-0000:00:13.3-1, full speed
 3 [audiodevice3   ]: USB-Audio - C-Media USB Audio Device
                      C-Media USB Audio Device    at usb-0000:00:13.3-2, full speed

------------------------------------------------------------------------

# cat /home/user0/.asoundrc
pcm.!default {
   type plug
   slave.pcm dmixer
}
pcm.dmixer {
   type dmix
   ipc_key 2048
   slave.pcm hw:audiodevice0
}
ctl.dmixer {
   type hw
   card audiodevice0
}
pcm.dsp {
    type plug
    slave.pcm dmixer
}
ctl.mixer {
    type hw
    card audiodevice0
}

------------------------------------------------------------------------

su user0

# This is the issue. how can I configure the asoundrc so that arecord

# uses audiodevice0 by default like speaker-test already does for playing.
$ arecord -v -f S16_LE -r 44100 ~/record1.wav
ALSA lib pcm_dmix.c:947:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
arecord: main:608: audio open error: Invalid argument
$ arecord -v -f S16_LE -r 44100 -D hw:audiodevice0 ~/record0.wav
Recording WAVE '/home/user0/record0.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
Hardware PCM card 0 'C-Media USB Audio Device   ' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 1
  rate         : 44100
  exact rate   : 44100 (44100/1)
  msbits       : 16
  buffer_size  : 22050
  period_size  : 5513
  period_time  : 125011
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 5513
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 22050
  silence_threshold: 0
  silence_size : 0
  boundary     : 6206523236469964800
  appl_ptr     : 0
  hw_ptr       : 0
^CAborted by signal Interrupt...
$ ls -hal ~/record*.wav
-rw-r----- 1 user0 user0 1.8M 2009-07-29 12:56 /home/user0/record0.wa

------------------------------------------------------------------------

su -c "speaker-test -c 2 & speaker-test -c 2 &" user0

------------------------------------------------------------------------

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw
Quoted 10 lines · On Wed, 29 Jul 2009 14:46:54 +0200 Jelle de Jong <[email protected]>…

Hello everybody,

I am having some issues making arecord use the default device for recording. Could somebody help me get a working .asoundrc configuration?

It works with:
arecord -v -f S16_LE -r 44100 -D audiodevice0 ~/record0.wav but it does not work with:
arecord -v -f S16_LE -r 44100 ~/record0.wav

Make audiodevice0 your default device

http://www.alsa-project.org/main/index.php/Asoundrc#The_default_plugin

#2 lore raw
Quoted 9 lines · stan
Quoted 5 lines · On Wed, 29 Jul 2009 14:46:54 +0200 Jelle de Jong<[email protected]>…

Hello everybody,

I am having some issues making arecord use the default device for recording. Could somebody help me get a working .asoundrc configuration?

Quoted 8 lines
Quoted 4 lines

It works with:
arecord -v -f S16_LE -r 44100 -D audiodevice0 ~/record0.wav but it does not work with:
arecord -v -f S16_LE -r 44100 ~/record0.wav

Make audiodevice0 your default device

http://www.alsa-project.org/main/index.php/Asoundrc#The_default_plugin

Hi Stan thanks for helping out.

In the original mail I attached my asoundrc setup it can also be found
here: http://debian.pastebin.com/m52601230 and now here below.

pcm.!default {
type plug
slave.pcm dmixer
}

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave.pcm hw:audiodevice0
}

ctl.!default {
type hw
card audiodevice0
}
ctl.dmixer {
type hw
card audiodevice0
}
pcm.dsp {
type plug
slave.pcm dmixer
}
ctl.mixer {
type hw
card audiodevice0
}

I am no asourdrc specialist and I always have got issues understanding the syntax when it comes down to more complicated setups. I know I need to make the audiodevice0 the default device. But how can I do this without losing my mixing support, how I configure it so it has dmix and dsnoop as default devices?

An example how to fix my asoundrc would be really helpful.

Thanks in advance,

Jelle

#3 lore raw
Quoted 2 lines · On Wed, 29 Jul 2009 19:14:46 +0200 Jelle de Jong <[email protected]>…

Hi Stan thanks for helping out.

<snip>

Quoted 1 line

I am no asourdrc specialist and I always have got issues

Neither am I! Ditto with the issues. There are experts around.

Quoted 6 lines

understanding the syntax when it comes down to more complicated setups. I know I need to make the audiodevice0 the default device. But how can I do this without losing my mixing support, how I configure it so it has dmix and dsnoop as default devices?

An example how to fix my asoundrc would be really helpful.

You're asking the wrong guy! I just use the page I pointed you to, web search, and trial and error to get an .asoundrc that works. I don't actually use one right now.

I notice that your USB device is actually interpreted as 4 cards. Are they each of different functionality? You could try (as a wild guess):

Quoted 3 lines
pcm.!default {
    type plug{
       slave.pcm dmixer
         slave.pcm drecord
      }
Quoted 6 lines

}

pcm.dmixer {
    type dmix
    ipc_key 1024
    slave.pcm hw:audiodevice0
}
 pcm.drecord {
     type dsnoop
     ipc_key 1025
     slave.pcm hw:audiodevice0

}

Quoted 12 lines

ctl.!default {
type hw
card audiodevice0
}
ctl.dmixer {
type hw
card audiodevice0
}
ctl.drecord {
type hw
card audiodevice0
}

Quoted 4 lines
pcm.dsp {
     type plug {
       slave.pcm dmixer
       slave.pcm drecord
       }
Quoted 5 lines

}
ctl.mixer {
type hw
card audiodevice0
}

All this is supposition on my part. Maybe it will give you enough of a hint in some way to get it working.

#4 lore raw
Quoted 56 lines · stan
Quoted 1 line · On Wed, 29 Jul 2009 19:14:46 +0200 Jelle de Jong<[email protected]>…

Hi Stan thanks for helping out.

<snip>

Quoted 1 line

I am no asourdrc specialist and I always have got issues

Neither am I! Ditto with the issues. There are experts around.

Quoted 6 lines

understanding the syntax when it comes down to more complicated setups. I know I need to make the audiodevice0 the default device. But how can I do this without losing my mixing support, how I configure it so it has dmix and dsnoop as default devices?

An example how to fix my asoundrc would be really helpful.

You're asking the wrong guy! I just use the page I pointed you to, web search, and trial and error to get an .asoundrc that works. I don't actually use one right now.

I notice that your USB device is actually interpreted as 4 cards. Are they each of different functionality? You could try (as a wild guess):

Quoted 3 lines
pcm.!default {
     type plug{
        slave.pcm dmixer
          slave.pcm drecord
       }
Quoted 6 lines

}

pcm.dmixer {
     type dmix
     ipc_key 1024
     slave.pcm hw:audiodevice0
}
  pcm.drecord {
      type dsnoop
      ipc_key 1025
      slave.pcm hw:audiodevice0

}

Quoted 12 lines

ctl.!default {
type hw
card audiodevice0
}
ctl.dmixer {
type hw
card audiodevice0
}
ctl.drecord {
type hw
card audiodevice0
}

Quoted 4 lines
pcm.dsp {
      type plug {
        slave.pcm dmixer
        slave.pcm drecord
        }
Quoted 8 lines
Quoted 5 lines

}
ctl.mixer {
type hw
card audiodevice0
}

All this is supposition on my part. Maybe it will give you enough of a hint in some way to get it working.

I don't know how you got it working but i tried several similar setups, and I ether get syntax error, working recording with broken playing, or working playing with broken recording. :( see:
http://debian.pastebin.com/m37d09000

I really hope somebody can show a cut and paste .asoundrc that I can use for testing.

Thanks in advance,

Jelle

#6 lore raw
Quoted 4 lines · stan

On Wed, 29 Jul 2009 20:29:08 +0200
Jelle de Jong<[email protected]> wrote:

Quoted 8 lines
Quoted 2 lines

I really hope somebody can show a cut and paste .asoundrc that I can use for testing.

Someone sent me this link of pre-configured .asoundrc files.

http://home.roadrunner.com/~infofiles/asoundrc.examples.html

Maybe one of those will work for you.

Thanks for the hint. i saw that page before sometime in the past :-)

The asym plug seems to be what whe want :D I am testing it now.

pcm.!default {
     type asym
     playback.pcm {
         type plug
         slave.pcm "dmixer"
     }
     capture.pcm {
         type plug
         slave.pcm "drecord"
     }
}
pcm.dmixer {
     type dmix
     ipc_key 1024
     slave.pcm hw:audiodevice0
}
pcm.drecord {
     type dsnoop
     ipc_key 2048
     slave.pcm hw:audiodevice0
}

ctl.!default {
type hw
card audiodevice0
}

Anybody that sees some missing things here? I needs to work with oss, alsa and gstreamer alsasinks.

Best regards,

Jelle