Closed onlize closed 7 years ago
This has nothing to do with LED. Audio needs to be configured properly. please refer to this closed issue. #1
Thank you for your reply. I checked that issue and still have the same issue. Interesting that the only way the command sudo /home/pi/src/gassist.sh runs without errors if I change the following in /usr/share/alsa/alsa.conf: Instead of defaults.ctl.card 0 defaults.pcm.card 0 I use: defaults.ctl.card 1 defaults.pcm.card 1
In this case, my speakers stop working. If I switch to defaults.pcm.card 0, I have the same error as I specified above.
Can you please help me with this? Thank you.
May i know your audio steup ? As in like, USB mic and 3.5 Jack of Pi or USB DAC that has both Mic and Speaker ports ?
I have USB Microphone and 3.5 Jack speakers.
aplay -l List of PLAYBACK Hardware Devices card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
arecord -l List of CAPTURE Hardware Devices card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
This is my .asoundrc file: pcm.!default { type asym capture.pcm "mic" playback.pcm "speaker" } pcm.mic { type plug slave { pcm "hw:1,0" } } pcm.speaker { type plug slave { pcm "hw:0,0" } }
All audio tests work for me.
Thank you.
Do the following steps sudo nano /usr/share/alsa/alsa.conf
Change the default values as folows
defaults.ctl.card 0 defaults.pcm.card 0 defaults.pcm.device 0 defaults.pcm.subdevice 0
sudo nano ~/.asoundrc
remove the existing code and paste the following
pcm.!default { type asym playback.pcm { type plug slave.pcm "hw:0,0" } capture.pcm { type plug slave.pcm "hw:1,0" } }
ctl.!default { type hw card 0 }
Whatever is there in asoundrc should be there in asound.conf also. sudo nano /etc/asound.conf pcm.!default { type asym playback.pcm { type plug slave.pcm "hw:0,0" } capture.pcm { type plug slave.pcm "hw:1,0" } }
ctl.!default { type hw card 0 } save reboot
Thank you for your reply. Just wanted to let you know that file /etc/asound.conf does not exist on my computer. I was a few people talking about this file and I tried to reinstall Raspian a few times, but I have never had this file.
In any case, I followed your recommendations and now I receive the following when I try to start it:
ALSA lib conf.c:1697:(snd_config_load1) toplevel:18:0:Unexpected end of file ALSA lib conf.c:3417:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it ALSA lib conf.c:3339:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing configuration OpenAlsaHandle PcmOpen: Invalid argument [1080:1093:ERROR:audio_input_processor.cc(756)] Input error ON_MUTED_CHANGED: {'is_muted': False} ON_START_FINISHED ON_ASSISTANT_ERROR: {'is_fatal': True} [1080:1095:ERROR:audio_input_processor.cc(756)] Input error ON_ASSISTANT_ERROR: {'is_fatal': True}
Also, when I try to run audio tests, they are failing now: speaker-test -t wav
speaker-test 1.0.28
Playback device is default Stream parameters are 48000Hz, S16_LE, 1 channels WAV file(s) ALSA lib conf.c:1697:(snd_config_load1) toplevel:18:0:Unexpected end of file ALSA lib conf.c:3417:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it ALSA lib conf.c:3339:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing configuration Playback open error: -22,Invalid argument
arecord --format=S16_LE --duration=5 --rate 16k --file-type=raw out.raw ALSA lib conf.c:1697:(snd_config_load1) toplevel:18:0:Unexpected end of file ALSA lib conf.c:3417:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it ALSA lib conf.c:3339:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument ALSA lib conf.c:3788:(snd_config_update_r) hooks failed, removing configuration arecord: main:722: audio open error: Invalid argument
Any ideas? Thank you very much for working with me.
From the aplay -l and arecord -l, i see that you are using a USB Dac which has 3.5mm jacks for both mic and headphone/audio out. Is that right ?
For testing purposes, I use my headphones with 3.5 jack. There is no mic with the headphones.
I ordered USB mic and it is still somewhere on the way. Temporary I use some professional USB microphone that I borrowed from my brother. Honestly, I do not know what is that mic and if it has speakers. Looks like microphone on stand.
I received new microphone today and it works now. I guess I had a problem with mic.
I have one additional question. I wanted to do auto start with CLI interface, but it does not work unless I open putty and login. Is this correct?
In any case, it works when I have auto login to Desktop.
Thank you again for all your help.
Auto login to CLI should work even without loggining into putty. Just make sure that, it is set to auto login, without password.
Since the issue is resolved, i am closing this !
When I try to start it, I receive the following error:
pi@raspberrypi:~ $ sudo /home/pi/src/gassist.sh /home/pi/src/main.py:31: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. GPIO.setup(25, GPIO.OUT) OpenAlsaHandle PcmOpen: No such file or directory ON_MUTED_CHANGED: {'is_muted': False}[1405:1418:ERROR:audio_input_processor.cc(756)] Input error
ON_START_FINISHED ON_ASSISTANT_ERROR: {'is_fatal': True} [1405:1420:ERROR:audio_input_processor.cc(756)] Input error ON_ASSISTANT_ERROR: {'is_fatal': True}
I do not have LED connected. Not sure how you want me to do this, should I use resistor? What kind of LED?
In any case, I do not think that LED would cause the problem. When I test my speakers and mic, everything looks good.
Can you help? Thank you.