Method: Pocketsphinx::Decoder#decode

Defined in:
lib/pocketsphinx/decoder.rb

#decode(audio_path_or_file, max_samples = 2048) ⇒ Object

Decode a raw audio stream as a single utterance, opening a file if path given

See #decode_raw

Parameters:

  • audio_path_or_file (IO)

    The raw audio stream or file path to decode as a single utterance

  • max_samples (Fixnum) (defaults to: 2048)

    The maximum samples to process from the stream on each iteration



54
55
56
57
58
59
60
61
# File 'lib/pocketsphinx/decoder.rb', line 54

def decode(audio_path_or_file, max_samples = 2048)
  case audio_path_or_file
  when String
    File.open(audio_path_or_file, 'rb') { |f| decode_raw(f, max_samples) }
  else
    decode_raw(audio_path_or_file, max_samples)
  end
end