-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raspberry Pi4 Buster : ValueError: Invalid chunk size: 0 #158
Comments
You ever figure this out? Getting this on |
https://github.com/MycroftAI/mycroft-precise/blob/dev/runner/precise_runner/runner.py#L235 Should this line ever return an empty chunk? Guessing the goal of this loop is to be a daemon loop and it should not bomb out unless it is unable to lock on to the mic with pyaudio for some reason? To add to this: Log output:
Debug Code:
After adding this my VA is working since the prediction handler daemon loop is not exiting. Would gladly open up a PR with cleaner exception handling and less verbose logging but looking for feedback of expected behaviors. Guessing also pyaudio stream returning no data could be an issue with my pulse audio configuration. |
* add logger to runner * handle chunk with 0 return * add general exception to chunk processing block to protect daemon loop
I think it is treated by management of the EOF of the new actual runner. Even if the actual management: chunk = self.stream.read(self.chunk_size)
if len(chunk) < self.chunk_size: # EOF seems a little hard for me. It may cut at the end of the stream and through away the last little chunk that may contain a wake word. Depending on the bitrate and duration of the wake word I guess it may not represent a big issue. |
Hey Guyz... some reason unable to get precise working on pi4 buster..
what I have tried:
Changing USB Posts
Pip reinstalling everything again (everything satisfies)
checking Alsa Sound Configuration
reinstalling portaudio
am using pyaudio with following config
audio = pyaudio.PyAudio()
self.audio_stream = audio.open(
format=pyaudio.paInt16,
channels=1,
rate=16000,
input=True,
frames_per_buffer=2048,
input_device_index=1 (my USB Sound Card)
)
while True:
self.stream.write(self.audio_stream.read(2048))
What Works
precise-listen <model_name> works perfectly fine
get the following error
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/homie-agent/scripts/mycroft-precise/runner/precise_runner/runner.py", line 240, in _handle_predictions
prob = self.engine.get_prediction(chunk)
File "/home/pi/homie-agent/scripts/mycroft-precise/runner/precise_runner/runner.py", line 64, in get_prediction
raise ValueError('Invalid chunk size: ' + str(len(chunk)))
ValueError: Invalid chunk size: 0
The text was updated successfully, but these errors were encountered: