You are not logged in.

#1 2019-02-24 01:39:31

pvenk
Member
Registered: 2019-02-23
Posts: 4

[SOLVED] Logitech C270 webcam's mic causes Audacity 2.2.2 to crash

Hello,

I have been having some trouble getting my Logitech C270 webcam to work in Audacity. The webcam works properly without any configuration needed in both Cheese and Chromium. In Cheese, I can take both photos and videos (with working audio). In Chromium, I have tried an online microphone test website and it picks up my webcam microphone easily.

I have consulted this ArchWiki page and this Audacity wiki page, and I have used these pages to get my microphone working for arecord. By running "arecord -l", I found that my webcam is card 2, device 0. The command "arecord -D hw:2,0 -d 5 test.wav" gave me this output:

$ arecord -D hw:2,0 -d 5 test.wav
Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
arecord: set_params:1339: Sample format non available
Available formats:
- S16_LE

Because of that, I tried the command

$ arecord -f S16_LE -D hw:2,0 -d 5 test.wav

which worked (gave me an audio file with the things that I had said while it was recording), but printed this to the console:

$ arecord -f S16_LE -D hw:2,0 -d 5 test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
Warning: rate is not accurate (requested = 8000Hz, got = 16000Hz)
         please, try the plug plugin

The Audacity wiki page that I linked to previously said that replacing "hw" with "plughw" should fix any problems, because arecord will take care of any conversion issues, so I ran this command:

$ arecord -D plughw:2,0 -d 5 test.wav
Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

This command also gave me an audio file that correctly picked up what I said while it was recording, but it did not output any warnings. Furthermore, the warning recommended I try the "plug" plugin, which I am guessing is "plughw". Therefore, I chose to make the plughw configuration permanent (as "arecord -d 5 test.wav" output nothing without specifying a device).

I created a file ~/.asoundrc with the following contents:

pcm.!default {
	type asym
	playback.pcm {
		type plug
		slave.pcm "hw:0,0"
	}
	capture.pcm {
		type plug
		slave.pcm "plughw:2,0"
	} 
}

After creating this file, I am now able to just run "arecord -d 5 test.wav" and experience no issues, but Audacity still does not work properly. In Audacity, when I go to Edit > Preferences > Devices > Recording > Device (Fig. 1), or the dropdown list next to the mic in the main view (Fig. 2), I see several entries for "hw:2,0" (which did not work with arecord without changing the format) but none for "plughw:2,0" (which worked perfectly with arecord). I tried selecting some of the "hw:2,0" entries, but all of them result in Audacity crashing a few seconds after I click "Record". Because aplay had told me that my test.wav had a rate of 8000 Hz (both the one recorded with hw:2,0 and the one recorded with plughw:2,0), I tried setting Audacity's "Project Rate" to 8000 Hz, but Audacity still crashes. I am using Audacity 2.2.2 (according to Audacity's "Help > About Audacity") or 1:2.2.2-1 (according to "pacman -Qi audacity").

I'm not sure if this is an Audacity issue, an ALSA issue, or just an issue with my webcam. Any help is greatly appreciated.

Fig. 1:
screenshot14lkwm.png

Fig. 2:
screenshot2iyjxa.png

Output of "lsusb --verbose":
http://codepad.org/1bJSMOPG

Portion of output of running "cat /proc/bus/input/devices" that is relevant to the webcam:

I: Bus=0003 Vendor=046d Product=0825 Version=0012
N: Name="UVC Camera (046d:0825)"
P: Phys=usb-0000:00:14.0-1.4/button
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.4/1-1.4:1.0/input/input23
U: Uniq=
H: Handlers=kbd event20 
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0

Full output of "cat /proc/bus/input/devices":
http://codepad.org/pTB1amM5

Output of "arecord -l":

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 2: ALC892 Alt Analog [ALC892 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: U0x46d0x825 [USB Device 0x46d:0x825], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I will be happy to share any additional information if needed.

Last edited by pvenk (2019-02-26 22:21:34)

Offline

#2 2019-02-24 08:08:46

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,563

Re: [SOLVED] Logitech C270 webcam's mic causes Audacity 2.2.2 to crash

I can record in Audacity without any asoundrc configuration. Somehow Audacity detects the device without any issue but in the drop down menu 'Recording Device' I use dmix and ity works automatically. But since you can already record but this warning:

Warning: rate is not accurate (requested = 8000Hz, got = 16000Hz)
         please, try the plug plugin

It seems your webcam samples at a much lower rate than normal microphones. Also it seems it only records in mono:

Recording WAVE 'test.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono

Why not experiment by setting your Project Rate Hz to 8000 and setting Audio Host ALSA to mono but this time using dmix as Recording Device with and without your asoundrc and see what happens.

Offline

#3 2019-02-25 00:29:52

pvenk
Member
Registered: 2019-02-23
Posts: 4

Re: [SOLVED] Logitech C270 webcam's mic causes Audacity 2.2.2 to crash

Thank you for the speedy reply. In Audacity, I do not see dmix as an option for a recording device. Here is a list of all the options I see:

HDA Intel PCH: ALC892 Analog (hw:0,0)
HDA Intel PCH: ALC892 Alt Analog (hw:0,2)
USB Device 0x46d:0x825: Audio (hw:2,0) - this is my webcam
sysdefault
samplerate
speexrate
pulse
speex
upmix
vdownmix
default

Each of the options I listed (with the exception of default) is actually 6 entries in Audacity -- "Front Mic:0", "Rear Mic:0", "Line:0", "Front Mic:1", "Rear Mic:1", and "Line:1".

However, I do see dmix as an option for a playback device. I don't think this will help, because my speaker is working fine. This wiki page said that I should add the following to my ALSA configuration file to manually enable dmix:

pcm.dsp {
    type plug
    slave.pcm "dmix"
}

I tried adding this to my asoundrc and to /etc/asound.conf, but neither enabled dmix as an option for my recording device. (I have removed that from my config files now.)

Audacity already has ALSA Host set to mono (with no other option available). I tried recording at 8000 Hz (project rate) with and without my asoundrc, and both cause Audacity to crash. However, in one of the attempts, Audacity managed to give me a crash report. This was saved to a zip file (report1.zip), which has four text files in it:

pluginsettings.cfg
pluginregistry.cfg
log.txt
audacity.cfg

I realized that I had files with these same names in my home directory (probably from getting Audacity to work previously), so I added those to a zip file called "report0.zip". I have uploaded the files inside these zip files to codepad:

I noticed that the log.txt files make references to a directory in my /tmp directory. Because report0.zip is from several reboots ago, I cannot recover the directory referenced there, but I have recovered the directory mentioned in report1.zip into a zip file called "report1_1.zip".

I have uploaded the contents of all of these zip files to codepad, but with a few things removed and replaced with "{USERNAME}" or "{REMOVED}" for my privacy:

report0.zip:
audacity.cfg, log.txt, pluginregistry.cfg, pluginsettings.cfg

report1.zip:
audacity.cfg, log.txt, pluginregistry.cfg, pluginsettings.cfg

report1_1.zip:
audacity.cfg, Audacity.xml, log.txt, pluginregistry.cfg, pluginsettings.cfg

By the way, I would like to point out that this webcam works fine in Audacity under Microsoft Windows with stereo audio. Either the webcam microphone does support stereo audio (and ALSA doesn't recognize it or doesn't have the proper drivers to capture stereo), or Windows is just copying mono audio to two channels and calling it "stereo".

Offline

#4 2019-02-25 09:28:26

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: [SOLVED] Logitech C270 webcam's mic causes Audacity 2.2.2 to crash

If you are using pulse during your other usages, it'd probably be less of a hassle to use pulse here as well so that pulseaudio handles recording and relevant format conversion (like it likely does on chrome and cheese already), in general you might also be interested in installing pulseaudio-alsa and removing your .asoundrc to make ALSA only application redirect over pulse.

For completeness sake and why you  don't see the plughw connectors, I'm assuming in essence the speex/libsamplerate pcms are relevantly equivalent and you can use whichever resampler would be preferred. Also can you post

arecord -L

to see which pcms you have actually defined?

Last edited by V1del (2019-02-25 09:38:39)

Online

#5 2019-02-26 22:18:29

pvenk
Member
Registered: 2019-02-23
Posts: 4

Re: [SOLVED] Logitech C270 webcam's mic causes Audacity 2.2.2 to crash

Thank you very much. Changing the recording input in Audacity to pulse solved the problem, and I can now record in both mono and stereo. Removing my .asoundrc has no effect on how Audacity handles pulseaudio, and I did not need to install pulseaudio-alsa. For completeness' sake, here is the output of "arecord -L":

null
    Discard all samples (playback) or generate zero samples (capture)
jack
    JACK Audio Connection Kit
pulse
    PulseAudio Sound Server
sysdefault:CARD=PCH
    HDA Intel PCH, ALC892 Analog
    Default Audio Device
front:CARD=PCH,DEV=0
    HDA Intel PCH, ALC892 Analog
    Front speakers
usbstream:CARD=PCH
    HDA Intel PCH
    USB Stream Output
usbstream:CARD=NVidia
    HDA NVidia
    USB Stream Output
sysdefault:CARD=U0x46d0x825
    USB Device 0x46d:0x825, USB Audio
    Default Audio Device
front:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    Front speakers
surround21:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=U0x46d0x825,DEV=0
    USB Device 0x46d:0x825, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
usbstream:CARD=U0x46d0x825
    USB Device 0x46d:0x825
    USB Stream Output

Offline

#6 2019-02-27 09:08:38

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,410

Re: [SOLVED] Logitech C270 webcam's mic causes Audacity 2.2.2 to crash

Yes it will not matter for applications that let you select the card/pcm, like Audacity. However if you ever run into an application (that does not itself support pulse directly) that assumes a valid default device to be present, your current configuration will not provide that (I'm not sure what exactly arecord does that your original attempt seems to work, however from the -L output we see that you do not have a valid default device anymore, and properly configuring this can be a bit of a raindance) and as you are using pulseaudio anyway this configuration, if it was correct, would fall apart if you are already playing something over pulseaudio and then intend to make use of the card via ALSA means or vice versa, as that's historically how ALSA works . Installing and using the config from the pulseaudio-alsa package will set up a correct default device redirecting applications over to pulseaudio, which can then take care of placing it to the correct device

Online

Board footer

Powered by FluxBB