0

I'm trying to use Linphone with my microphone, but the sound is very choppy. After messing a bit with arecord, I discovered that while the sound on my sysdefault device is choppy, recording on front:CARD=Generic works better and with less noise.

However, front can apparently only be recorded with 2 channels active. Linphone forces mono on the input (in theory it could use stereo, but there does not seem to be a way to set this in the configuration), and so it gives an alsa error since it cannot set the channels correctly.

The same thing happens if I use arecord to force 1 channel to the device:

$ arecord -f cd -d front:CARD=Generic,DEV=0 -c 1 -V stereo /tmp/file
Recording WAVE '/tmp/file' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
arecord: set_params:1247: Channels count non available

I'm thus trying to create a device in ALSA which should downsample the microphone into a single channel, but I can't seem to be able to (I'm an ALSA newbie). I've tried using this answer, but it does not work:

pcm.front cards.pcm.front
pcm.makemono {           
        type plug      
        slave.pcm {  
                type route                     
                slave.pcm "pcm.front"
                slave.channels 2
                ttable {  
                        0.0 1  
                        1.0 1
                }                   
        }                               
}

...

$ arecord -f cd -d makemono -c1 -V stereo /tmp/file
Recording WAVE '/tmp/file' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
arecord: set_params:1247: Channels count non available

How can I do this?

Svalorzen
  • 113
  • 2
  • 6

1 Answers1

2

You want one software channel with two hardware channels, so you have to do the mapping in the opposite direction:

...
ttable {
    0.0 1
    0.1 1
}

And you should use the correct option to specify the device:

$ arecord --help | grep -i -- ^-d
-D, --device=NAME       select PCM by name
-d, --duration=#        interrupt after # seconds
CL.
  • 1,595
  • 12
  • 12
  • Doesn't seem to work unfortunately. I still get the same error.. – Svalorzen Feb 09 '17 at 16:09
  • This works for me on stereo hardware. – CL. Feb 09 '17 at 17:57
  • Could it be that for some reason my device is simply not recognized or there's some other problem (maybe the `slave.pcm` field)? If I put `-d random_device_which_does_not_exist` arecord does not complain about it. Is there a way to check that the device is being parsed correctly? – Svalorzen Feb 09 '17 at 18:27
  • You didn't actually specify a device ... – CL. Feb 09 '17 at 19:46