Class: RecognizeStream

RecognizeStream

new RecognizeStream(options)

pipe()-able Node.js Readable/Writeable stream - accepts binary audio and emits text in it's `data` events. Also emits `results` events with interim results and other data. Cannot be instantiated directly, instead reated by calling #createRecognizeStream() Uses WebSockets under the hood. For audio with no recognizable speech, no `data` events are emitted.
Parameters:
Name Type Description
options
Properties
Name Type Attributes Default Description
model String <optional>
'en-US_BroadbandModel' voice model to use. Microphone streaming only supports broadband models.
url String <optional>
'wss://stream.watsonplatform.net/speech-to-text/api' base URL for service
content-type String <optional>
'audio/wav' content type of audio; should be automatically determined in most cases
interim_results Boolean <optional>
true Send back non-final previews of each "sentence" as it is being processed
continuous Boolean <optional>
true set to false to automatically stop the transcription after the first "sentence"
word_confidence Boolean <optional>
true include confidence scores with results
timestamps Boolean <optional>
true include timestamps with results
max_alternatives Number <optional>
3 maximum number of alternative transcriptions to include
inactivity_timeout Number <optional>
30 how many seconds of silence before automatically closing the stream (even if continuous is true). use -1 for infinity //todo: investigate other options at http://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/apis/#!/speech-to-text/recognizeSessionless
Source:

Events

connection-close

Parameters:
Name Type Description
reasonCode Number
description String
Source:

data

Finalized text
Parameters:
Name Type Description
transcript String
Source:

error

Source:

results

Object with interim or final results, including possible alternatives. May have no results at all for empty audio files.
Parameters:
Name Type Description
results Object
Source:

results

Object with interim or final results, including possible alternatives. May have no results at all for empty audio files.
Parameters:
Name Type Description
results Object
Deprecated:
  • - use the 'result' event (singular) instead
Source: