def recognize(max_samples = 2048, &b)
      unless ALGORITHMS.include?(algorithm)
        raise NotImplementedError, "Unknown speech recognition algorithm: #{algorithm}"
      end

      start unless recognizing?

      FFI::MemoryPointer.new(:int16, max_samples) do |buffer|
        loop do
          send("recognize_#{algorithm}", max_samples, buffer, &b) or break
        end
      end
    ensure
      stop
    end
def recognize(max_samples = 2048, &b)
      unless ALGORITHMS.include?(algorithm)
        raise NotImplementedError, "Unknown speech recognition algorithm: #{algorithm}"
      end

      start unless recognizing?

      FFI::MemoryPointer.new(:int16, max_samples) do |buffer|
        loop do
          send("recognize_#{algorithm}", max_samples, buffer, &b) or break
        end
      end
    ensure
      stop
    end
Recognize speech and yield hypotheses in infinite loop

 @param [Fixnum] max_samples Number of samples to process at a time