iizukanao / picam

Audio/video recorder for Raspberry Pi with language agnostic API
GNU Lesser General Public License v2.1
489 stars 78 forks source link

Error: cannot set channel count for microphone (Invalid argument) #178

Open blogdemoi opened 2 years ago

blogdemoi commented 2 years ago

Hi,

I installed Picam on a Raspberry Pi 3. The camera is a Pi camera and the microphone is a usb "PlayStation Eye". When I run ./picam --alsadev hw:1,0 I have this error:

picam ./picam --alsadev hw:1,0 error: cannot set channel count for microphone (Invalid argument)

picam arecord -l List of CAPTURE Hardware Devices card 1: CameraB409241 [USB Camera-B4.09.24.1], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0

What can be wrong?

Thank you for any suggestions.

iizukanao commented 2 years ago

Hi, please follow the guide below to create an ALSA virtual device that mixes 4 microphones into one, then use that virtual device (cap) with picam. https://www.cnx-software.com/2019/08/30/using-sony-ps3-eye-camera-as-an-inexpensive-microphone-array/

blogdemoi commented 2 years ago

Thank you. I followed the guide you mentioned. However now I have:

picam ./picam --alsadev hw:1,cap error creating state dir (./state): File exists

iizukanao commented 2 years ago

I think the state in your filesystem is a broken symbolic link. Fix the symbolic link or remove it with rm state.

lukaszgielecinski commented 1 year ago

I have a 2xElectret condenser microphone and to fix the same problem I added /etc/asound.conf file with the following content:

pcm.channelsum {
 type plug
 slave {
  pcm "hw:1,0"
  channels 2
 }
 route_policy sum
}

I rebooted pi and I use it like that:

./picam --alsadev channelsum
blogdemoi commented 1 year ago

I have a 2xElectret condenser microphone and to fix the same problem I added /etc/asound.conf file with the following content

Thank you, I haven't had time till now to go further, I will try when I have more time.