googlesamples / assistant-sdk-python

Samples and bindings for the Google Assistant API
http://developer.google.com/assistant/sdk
Apache License 2.0
916 stars 320 forks source link

Assistant failing when playing back #439

Open aravindjaimon opened 2 years ago

aravindjaimon commented 2 years ago
(env) aj@pi:~/GA $ googlesamples-assistant-audiotest 
/home/aj/GA/env/lib/python3.9/site-packages/cffi/cparser.py:163: UserWarning: Global variable 'stderr' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
  warnings.warn("Global variable '%s' in cdef(): for consistency "
/home/aj/GA/env/lib/python3.9/site-packages/cffi/cparser.py:163: UserWarning: Global variable '__stderrp' in cdef(): for consistency with C it should have a storage class specifier (usually 'extern')
  warnings.warn("Global variable '%s' in cdef(): for consistency "
INFO:root:Starting audio test.
INFO:root:Recording samples.
INFO:root:Finished recording.
INFO:root:Playing back samples.
Traceback (most recent call last):
  File "/home/aj/GA/env/bin/googlesamples-assistant-audiotest", line 8, in <module>
    sys.exit(main())
  File "/home/aj/GA/env/lib/python3.9/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/aj/GA/env/lib/python3.9/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/aj/GA/env/lib/python3.9/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/aj/GA/env/lib/python3.9/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/aj/GA/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 390, in main
    stream.write(samples.pop(0))
  File "/home/aj/GA/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 317, in write
    buf = normalize_audio_buffer(buf, self.volume_percentage)
  File "/home/aj/GA/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 57, in normalize_audio_buffer
    buf = arr.tostring()
AttributeError: 'array.array' object has no attribute 'tostring'
(env) aj@pi:~/GA $ 
EvgehaName commented 1 year ago

Need to change the code in the file /home/aj/GA/env/lib/python3.9/site-packages/googlesamples/assistant/grpc/audio_helpers.py (string: buf = arr.tostring()) to (string: buf = arr.tobytes())