Skip to content
This repository was archived by the owner on Oct 19, 2023. It is now read-only.
This repository was archived by the owner on Oct 19, 2023. It is now read-only.

PortAudioError(errormsg, err) sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997] #155

Closed
@JawsOrca

Description

@JawsOrca

Hi All,

Sorry stupid beginner questions.

I'm trying this project on a Raspberry Pi 3.

I have a cheap usb webcam with a mic and a usbpowered mic driven speakers.

I'm entering: python -m googlesamples.assistant.grpc.pushtotalk

And I keep getting an error:

(env) pi@raspberrypi:~ $ python -m googlesamples.assistant.grpc.pushtotalk
INFO:root:Connecting to embeddedassistant.googleapis.com
Traceback (most recent call last):
File "/usr/lib/python3.5/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/pi/env/lib/python3.5/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 434, in
main()
File "/home/pi/env/lib/python3.5/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/home/pi/env/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/pi/env/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/pi/env/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/pi/env/lib/python3.5/site-packages/googlesamples/assistant/grpc/pushtotalk.py", line 332, in main
flush_size=audio_flush_size
File "/home/pi/env/lib/python3.5/site-packages/googlesamples/assistant/grpc/audio_helpers.py", line 187, in init
blocksize=int(block_size/2), # blocksize is in number of frames.
File "/home/pi/env/lib/python3.5/site-packages/sounddevice.py", line 1256, in init
**_remove_self(locals()))
File "/home/pi/env/lib/python3.5/site-packages/sounddevice.py", line 772, in init
'Error opening {0}'.format(self.class.name))
File "/home/pi/env/lib/python3.5/site-packages/sounddevice.py", line 2563, in _check
raise PortAudioError(errormsg, err)
sounddevice.PortAudioError: Error opening RawStream: Invalid sample rate [PaErrorCode -9997]

(env) pi@raspberrypi:~ $ 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

.asoundrc =

pcm.!default {
type hw
card 0
}

ctl.!default {
type hw
card 0
}

If I do the speaker test I hear the test.

If I test record this works too.

Sorry I've tried several suggestions from stackoverflow etc but nothings working and I'm getting a bit lost. I'm starting to suspect that the webcam just isn't compatible with this project but hope you guys can help before I give up!

Thanks in advance, p.s I'm a right novice with the pi and linux :(

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions