# Buggy code
def update(self, chunk):
    pcm = struct.unpack_from("h" * (len(chunk) // 2), chunk)
    self.audio_buffer += pcm
    while True:
        if len(self.audio_buffer) >= self.porcupine.frame_length:
            result = self.porcupine.process(
                self.audio_buffer[0 : self.porcupine.frame_length]
            )
            # result could be boolean (if there is one keword)
            # or int (if more than one keyword)
            self.has_found |= (self.num_keywords == 1 and result) | (
                self.num_keywords > 1 and result >= 0
            )
            self.audio_buffer = self.audio_buffer[self.porcupine.frame_length :]
        else:
            return


# Traceback (TypeError)
2020-10-13 18:03:22.296 | INFO     |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:328 | Creating wake word engine
2020-10-13 18:03:22.299 | INFO     |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:351 | Using hotword entry for blueberry
2020-10-13 18:03:22.302 | WARNING  |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:353 | Phonemes are missing falling back to listeners configuration
2020-10-13 18:03:22.305 | WARNING  |  6577 | mycroft.client.speech.listener:create_wake_word_recognizer:357 | Threshold is missing falling back to listeners configuration
2020-10-13 18:03:22.310 | INFO     |  6577 | mycroft.client.speech.hotword_factory:load_module:403 | Loading "blueberry" wake word via porcupine
2020-10-13 18:03:22.315 | INFO     |  6577 | mycroft.client.speech.hotword_factory:__init__:331 | Adding /home/pi/.mycroft/Porcupine/binding/python to Python path
2020-10-13 18:03:22.338 | INFO     |  6577 | mycroft.client.speech.hotword_factory:__init__:356 | Loading Porcupine using library path /home/pi/.mycroft/Porcupine/lib/linux/armv7l/libpv_porcupine.so and keyword paths ['/home/pi/.mycroft/Porcupine/resources/keyword_files/raspberry-pi/blueberry_raspberry-pi.ppn']
2020-10-13 18:03:22.341 | ERROR    |  6577 | mycroft.client.speech.hotword_factory:initialize:423 | Could not create hotword. Falling back to default.
Traceback (most recent call last):
File "/home/pi/mycroft-core/mycroft/client/speech/hotword_factory.py", line 411, in initialize
instance = clazz(hotword, config, lang=lang)
File "/home/pi/mycroft-core/mycroft/client/speech/hotword_factory.py", line 361, in __init__
sensitivities=sensitivities)
TypeError: __init__() got an unexpected keyword argument 'model_file_path'
2020-10-13 18:03:22.345 | INFO     |  6577 | mycroft.client.speech.hotword_factory:load_module:403 | Loading "blueberry" wake word via pocketsphinx
2020-10-13 18:03:22.475 | INFO     |  6577 | mycroft.client.speech.listener:create_wakeup_recognizer:365 | creating stand up word engine
2020-10-13 18:03:22.478 | INFO     |  6577 | mycroft.client.speech.hotword_factory:load_module:403 | Loading "wake up" wake word via pocketsphinx
2020-10-13 18:03:22.602 | INFO     |  6577 | __main__:on_ready:175 | Speech client is ready.

# Fixed code
def update(self, chunk):
    """Update detection state from a chunk of audio data.

    Arguments:
        chunk (bytes): Audio data to parse
    """
    pcm = struct.unpack_from("h" * (len(chunk) // 2), chunk)
    self.audio_buffer += pcm
    while True:
        if len(self.audio_buffer) >= self.porcupine.frame_length:
            result = self.porcupine.process(
                self.audio_buffer[0 : self.porcupine.frame_length]
            )
            # result will be the index of the found keyword or -1 if
            # nothing has been found.
            self.has_found |= result >= 0
            self.audio_buffer = self.audio_buffer[self.porcupine.frame_length :]
        else:
            return