assistant-sdk-python icon indicating copy to clipboard operation
assistant-sdk-python copied to clipboard

Playing Sounds in Response to Events?

Open ryan-clancy opened this issue 7 years ago • 12 comments

When using Google Assistant on your phone, there are several sounds that are played in response to certain events (after saying "Ok Google", etc.) - is there a nice way to get the sounds to play using the SDK?

I suppose one method would be to get the sound files from the search APK and use ALSA's "aplay" command as mentioned on the Assistant SDK website, but having these files included with the SDK would be nice.

ryan-clancy avatar May 03 '17 03:05 ryan-clancy

You should be able to use the following package together to play sounds w/ the SDK: https://pypi.python.org/pypi/SoundFile https://pypi.python.org/pypi/sounddevice

proppy avatar May 03 '17 16:05 proppy

@proppy That seems like a better way to handle playing the audio, but what about the Google sound files? Are these available for download anywhere, or would I have to extract them from the Google Assistant APK in order to play them?

ryan-clancy avatar May 03 '17 17:05 ryan-clancy

They are not currently available for download with the SDK. Will keep this issue open to track the request

alfongj avatar May 14 '17 07:05 alfongj

Could you please add audio feedback once wake word is recognised?

The default google-assistant-demo running in headless mode at the moment does not have any feedback and user is clueless whether it listening or not

palaniraja avatar May 18 '17 13:05 palaniraja

Yes, please, make tutorial how to add any sound feedback, then Google Assistant hears hotword.

Maybe someone is already created some python script for that?

Kalvisan avatar Jun 09 '17 05:06 Kalvisan

I'm interested too. Right now you dont know if GA is listening before you ask your question which makes it frustrating when you have to wait for some time to realise.

idimitrakopoulos avatar Jun 27 '17 22:06 idimitrakopoulos

It's pretty easy to implement this yourself.

(pip install playsound and change the sound file to something if you follow the example)

skogsmaskin avatar Jan 19 '18 09:01 skogsmaskin

Are the Google hotword dings available for download?

viggy96 avatar Apr 06 '18 14:04 viggy96

@skogsmaskin playsound literally breaks the assistant.

viggy96 avatar Apr 06 '18 18:04 viggy96

You may be able to find the raw sound files somewhere online, although I don't think we have them available for download.

Fleker avatar Apr 06 '18 19:04 Fleker

Well, in new Google-Assistant SDK I can't get any playback from @skogsmaskin tutorial. Somone know where should I put my subprocess.call function now?

Kalvisan avatar Jul 18 '18 10:07 Kalvisan

Pygame did the job for me...

pygame.mixer.init()
    pygame.mixer.music.load('/home/mantha/Downloads/ding.mp3')
    if event.type == EventType.ON_CONVERSATION_TURN_STARTED:
        print()
        pygame.mixer.music.play()
    print(event)

And, I needed a google ding so it's not assuring but does the job Zedge

mstech66 avatar Nov 21 '18 14:11 mstech66