respeaker / seeed-voicecard

2 Mic Hat, 4 Mic Array, 6-Mic Circular Array Kit, and 4-Mic Linear Array Kit for Raspberry Pi
GNU General Public License v3.0
481 stars 291 forks source link

amixer breaks recording #273

Closed slesinger closed 3 years ago

slesinger commented 3 years ago

Hello, I have 4 Mic Array and RPI Zero. Install was smooth and arecord working fine until I set volumes with following commands:

amixer -c 2 set 'ADC1 PGA gain' capture 61% unmute
amixer -c 2 set 'ADC2 PGA gain' capture 61% unmute
amixer -c 2 set 'ADC3 PGA gain' capture 61% unmute
amixer -c 2 set 'ADC4 PGA gain' capture 61% unmute
amixer -c 2 set 'CH1 digital volume' capture 81% unmute
amixer -c 2 set 'CH2 digital volume' capture 81% unmute
amixer -c 2 set 'CH3 digital volume' capture 81% unmute
amixer -c 2 set 'CH4 digital volume' capture 81% unmute

Since then, I always get recording which you can see on this screenshot, regardles how much loud I speak: https://paste.pics/B2XEW I reinstalled from scratch few times without luck. Only when I bought another RPI 3 device it worked again until I have executed the amixer command above. The sad story repeated. LEDs are working fine. Would you have an idea what's wrong? Thank you in advance

ghost commented 3 years ago

@slesinger , This action was performed automatically. Please describe the issue according to bug template - if the issue was resolved, ignore this message. The issue will be marked as closed in 7 days if inactive.

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Platform What platform are you running the code on.

Relevant log output Please copy and paste any relevant log output.

AIWintermuteAI commented 3 years ago

Hi, @slesinger !

I tried to reproduce the problem with the following setup: Raspberry Pi Zero W 5.10.52+ kernel https://github.com/respeaker/seeed-voicecard/commit/d840f77541f9f1ff64097a2aec274d549d6e8a23

Few things that are somewhat wrong: 1) According to ALSA command line utility alsamixer, all 4 channels ADC PGA gain is set to 0 by default for 4-mic reSpeaker. So, there is no need to change that settings. image 2) If you use Raspberry Pi Zero and 4-mic reSpeaker, under normal circumstances, your sound card number should be 0. Executing commands from your message throws an error for me here:

pi@raspberrypi:~ $ amixer -c 2 set 'CH1 digital volume' capture 90% unmute
Invalid card number.
Usage: amixer <options> [command]

But changing -c arguments from 2 to 0 works:

pi@raspberrypi:~ $ amixer -c 0 set 'CH1 digital volume' capture 90% unmute
Simple mixer control 'CH1 digital volume',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 255
  Mono: 230 [90%]
pi@raspberrypi:~ $ amixer -c 0 set 'CH2 digital volume' capture 90% unmute
Simple mixer control 'CH2 digital volume',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 255
  Mono: 230 [90%]
pi@raspberrypi:~ $ amixer -c 0 set 'CH3 digital volume' capture 90% unmute
Simple mixer control 'CH3 digital volume',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 255
  Mono: 230 [90%]
pi@raspberrypi:~ $ amixer -c 0 set 'CH4 digital volume' capture 90% unmute
Simple mixer control 'CH4 digital volume',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 255
  Mono: 230 [90%]
pi@raspberrypi:~ $ alsamixer
pi@raspberrypi:~ $ arecord -Dac108 -f S32_LE -r 16000 -c 4 hello.wav
Recording WAVE 'hello.wav' : Signed 32 bit Little Endian, Rate 16000 Hz, Channels 4

I tweaked sound volumes both with alsamixer and using amixer command - all worked great. Just make sure you don't change ADC PDG gain and don't set digital volume too low - 81 was fairly quiet, 50 resulted in no sound at all.

HinTak commented 3 years ago

The device numbering ie -c 2 changed between 4.19 and 5.x, or rather depends on a few kernel module options to do with multiseat and multiple hdmi output on newer pi's (see https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=249204) . @slesinger likely read the commands from outdated instructions without understanding what they do.

And the instructions wherever he reads it from needs updating...

AIWintermuteAI commented 3 years ago

Right, thank you for the explanation, @HinTak . I checked https://github.com/Seeed-Studio/wiki-documents/search?q=amixer for instructions on that in wiki, it doesn't seem we mention that anywhere there. Probably he has found it somewhere else on the Internet.

AIWintermuteAI commented 3 years ago

Closing the issue due to the lack of activity. Feel free to re-open if issue persists.