def recognize_after_speech(max_samples, buffer)
      if in_speech?
        while in_speech?
          process_audio(buffer, max_samples) or break
        end

        decoder.end_utterance

        if hypothesis = decoder.hypothesis
          yield hypothesis
        end

        decoder.start_utterance
      end

      process_audio(buffer, max_samples)
    end
def recognize_after_speech(max_samples, buffer)
      if in_speech?
        while in_speech?
          process_audio(buffer, max_samples) or break
        end

        decoder.end_utterance

        if hypothesis = decoder.hypothesis
          yield hypothesis
        end

        decoder.start_utterance
      end

      process_audio(buffer, max_samples)
    end
Splits speech into utterances by detecting silence between them.
 By default this uses Pocketsphinx's internal Voice Activity Detection (VAD) which can be
 configured by adjusting the `vad_postspeech`, `vad_prespeech`, and `vad_threshold` settings.