shivasiddharth / PulseAudio-System-Wide

Git to help you setup pulse audio as a system wide service. this has been tested and found to work on Raspberry Pi
GNU General Public License v3.0
22 stars 4 forks source link

alexa and gassistant not working together even after following the steps #1

Open 05prateek opened 3 years ago

05prateek commented 3 years ago

the google assistant startsup first and then alexa. but only the google assistant has access to audio devices. even the option to set usb pnp as default device by clicking the speaker icon at the top right corner doesnt show anymore.

also my .asoundrc file gets modified to empty file on each reboot.

shivasiddharth commented 3 years ago

The speaker icon could have gone if you uninstalled pulseaudio. This repo does not alter the menubar or fiddle with pulseaudio. .asoundrc and asound.conf are not required since 2020 Dec update. USB PNP cards are plug and play since Dec 2020 release.

05prateek commented 3 years ago

i did not uninstalled pulseaudio. speaker icon is there but it only shows two options hdmi and AV jack.even raspi-config does not shows usb-pnp as an option. and only google responds to wakeword. aplay 'xyzsoundfile' gives no sound output:

aplay AlexaStartup.wav 
Playing WAVE 'AlexaStartup.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono
aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 2: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

the output from: systemctl --system status alexa.service :

   Loaded: loaded (/lib/systemd/system/alexa.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-04-27 16:58:25 IST; 9min ago
  Process: 464 ExecStart=/usr/bin/sudo /home/pi/Assistants-Pi/Alexa/start.sh (code=exited, status=0/SUCCESS)
 Main PID: 541 (screen)
    Tasks: 41 (limit: 3860)
   CGroup: /system.slice/alexa.service
           ├─541 SCREEN -dm sudo python3 /home/pi/Assistants-Pi/Alexa/alexa.py
           ├─543 sudo python3 /home/pi/Assistants-Pi/Alexa/alexa.py
           ├─544 python3 /home/pi/Assistants-Pi/Alexa/alexa.py
           ├─557 sudo /home/pi/Assistants-Pi/Alexa/startsample.sh
           ├─558 sh /home/pi/Assistants-Pi/Alexa/startsample.sh
           └─559 ./SampleApp /home/pi/Assistants-Pi/Alexa/build/Integration/AlexaClientSDKConfig.json /home/pi/Assistants-Pi/Alexa/third-party/a

Apr 27 16:58:25 raspberrypi sudo[464]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 27 16:58:25 raspberrypi sudo[528]:     root : TTY=unknown ; PWD=/home/pi/Assistants-Pi/Alexa ; USER=root ; COMMAND=/usr/bin/screen -dm sudo 
Apr 27 16:58:25 raspberrypi sudo[528]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 27 16:58:25 raspberrypi sudo[528]: pam_unix(sudo:session): session closed for user root
Apr 27 16:58:25 raspberrypi sudo[464]: pam_unix(sudo:session): session closed for user root
Apr 27 16:58:25 raspberrypi systemd[1]: Started Amazon Alexa Voice Service.
Apr 27 16:58:25 raspberrypi sudo[543]:     root : TTY=pts/0 ; PWD=/home/pi/Assistants-Pi/Alexa ; USER=root ; COMMAND=/usr/bin/python3 /home/pi/A
Apr 27 16:58:25 raspberrypi sudo[543]: pam_unix(sudo:session): session opened for user root by (uid=0)
Apr 27 16:58:27 raspberrypi sudo[557]:     root : TTY=pts/0 ; PWD=/home/pi/Assistants-Pi/Alexa ; USER=root ; COMMAND=/home/pi/Assistants-Pi/Alex
Apr 27 16:58:27 raspberrypi sudo[557]: pam_unix(sudo:session): session opened for user root by (uid=0)

systemctl --system status googleassistant.service :

 google-assistant.service - Google Assistant Voice Service
   Loaded: loaded (/lib/systemd/system/google-assistant.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-04-27 16:58:35 IST; 17min ago
 Main PID: 918 (python)
    Tasks: 22 (limit: 3860)
   CGroup: /system.slice/google-assistant.service
           └─918 /home/pi/env/bin/python -u /home/pi/Assistants-Pi/Google-Assistant/src/main.py --project_id raspi-4b080 --device_model_id raspi

Apr 27 17:08:22 raspberrypi python[918]: ON_END_OF_UTTERANCE
Apr 27 17:08:22 raspberrypi python[918]: ON_RECOGNIZING_SPEECH_FINISHED:
Apr 27 17:08:22 raspberrypi python[918]:   {"text": ""}
Apr 27 17:08:22 raspberrypi python[918]: ON_CONVERSATION_TURN_TIMEOUT
Apr 27 17:09:22 raspberrypi python[918]: ON_CONVERSATION_TURN_STARTED
Apr 27 17:09:31 raspberrypi python[918]: ON_END_OF_UTTERANCE
Apr 27 17:09:31 raspberrypi python[918]: ON_END_OF_UTTERANCE
Apr 27 17:09:31 raspberrypi python[918]: ON_RECOGNIZING_SPEECH_FINISHED:
Apr 27 17:09:31 raspberrypi python[918]:   {"text": ""}
Apr 27 17:09:31 raspberrypi python[918]: ON_CONVERSATION_TURN_TIMEOUT
lines 1-18/18 (END)

systemctl --system status pulseaudio.service:

 pulseaudio.service - PulseAudio system server
   Loaded: loaded (/etc/systemd/system/pulseaudio.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2021-04-27 17:19:52 IST; 2min 4s ago
 Main PID: 385 (pulseaudio)
    Tasks: 5 (limit: 3860)
   CGroup: /system.slice/pulseaudio.service
           └─385 /usr/bin/pulseaudio --daemonize=no --system --realtime --log-target=journal

Apr 27 17:19:49 raspberrypi pulseaudio[385]: Running in system mode, but --disallow-module-loading not set.
Apr 27 17:19:49 raspberrypi pulseaudio[385]: Running in system mode, forcibly disabling SHM mode.
Apr 27 17:19:49 raspberrypi pulseaudio[385]: Running in system mode, forcibly disabling exit idle time.
Apr 27 17:19:49 raspberrypi pulseaudio[385]: OK, so you are running PA in system mode. Please make sure that you actually do want to do that.
Apr 27 17:19:49 raspberrypi pulseaudio[385]: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithS
Apr 27 17:19:52 raspberrypi pulseaudio[385]: Failed to open cookie file '/var/run/pulse/.config/pulse/cookie': No such file or directory
Apr 27 17:19:52 raspberrypi pulseaudio[385]: Failed to load authentication key '/var/run/pulse/.config/pulse/cookie': No such file or directory
Apr 27 17:19:52 raspberrypi pulseaudio[385]: Failed to open cookie file '/var/run/pulse/.pulse-cookie': No such file or directory
Apr 27 17:19:52 raspberrypi pulseaudio[385]: Failed to load authentication key '/var/run/pulse/.pulse-cookie': No such file or directory
Apr 27 17:19:52 raspberrypi systemd[1]: Started PulseAudio system server.
shivasiddharth commented 3 years ago

I see some irregularities here. The pulseaudio service is starting almost 15 mins after the assistants have started. Why has the Alexa started almost 8 mins after Google ?

Can you explain the reason for the differences in the intervals ?

Did you perform the installation and system wide operation on a fresh copy of OS or an old copy that has been already played around with ?