IBM Speech to Text v0.1.1 IBMSpeechToText.Client View Source

A client process responsible for communication with Speech to Text API

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Sends audio data over websocket

Sends a proper message over websocket to the API

Starts client process responsible for communication with Speech to Text API

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

send_data(client, data) View Source
send_data(GenServer.server(), iodata()) :: :ok

Sends audio data over websocket

Link to this function

send_message(client, msg) View Source
send_message(
  GenServer.server(),
  %IBMSpeechToText.Message.Start{
    content_type: term(),
    customization_weight: term(),
    grammar_name: term(),
    inactivity_timeout: term(),
    interim_results: term(),
    keywords: term(),
    keywords_threshold: term(),
    max_alternatives: term(),
    profanity_filter: term(),
    redaction: term(),
    smart_formatting: term(),
    speaker_labels: term(),
    timestamps: term(),
    word_alternatives_threshold: term(),
    word_confidence: term()
  }
  | %IBMSpeechToText.Message.Stop{}
) :: :ok

Sends a proper message over websocket to the API

Link to this function

start_link(api_region_or_url, api_key, opts \\ []) View Source
start_link(IBMSpeechToText.region() | charlist(), String.t(), Keyword.t()) ::
  :ignore | {:error, any()} | {:ok, pid()}

Starts client process responsible for communication with Speech to Text API

Requires API url or region atom (See IBMSpeechToText.region/0) and an API key used to obtain IBMSpeechToText.Token (here you can learn how to get it)

Options

  • :stream_to - pid of the process that will receive recognition results, defaults to the caller of start_link/3
  • Recognition parameters (such as :model) described in IBM Cloud docs

Example

IBMSpeechToText.Client.start_link(
  :frankfurt,
  "ABCDEFGHIJKLMNO",
  model: "en-GB_BroadbandModel"
)