Skip to navigation

Overview

HAMS runs two speech models built for Arabic, including speech that switches between Arabic and English mid-sentence. Both are exposed as streaming WebSocket APIs so that audio and text flow in real time, with one persistent connection per stream.

ModelEndpointDirection
Speech-to-textwss://voice.hams.ai/asr/wsYou send 16 kHz PCM audio, you receive interim and final transcripts as JSON
Text-to-speechwss://tts.hams.ai/wsYou send text as JSON, you receive 24 kHz PCM audio as it is synthesized

What a client needs

Any server-side WebSocket client works. It must be able to:

  1. Set a custom Authorization header on the WebSocket handshake.
  2. Send and receive binary messages, which carry the PCM audio.
  3. Send and receive text messages, which carry JSON configuration, prompts, metadata and results.
  4. Keep one socket open for the whole session or stream, rather than reconnecting per message.

The API key must stay on a trusted server. Do not put it in browser code, mobile applications, URLs or client-side logs. If your framework cannot attach headers to a WebSocket connection, connect from a server-side service that can.

Audio in and out

Both APIs work with raw, headerless PCM: signed 16-bit little-endian samples, mono. Speech-to-text expects 16,000 Hz; text-to-speech returns 24,000 Hz. Decode and resample other formats before sending, and write the received bytes straight to a PCM sink or wrap them in a container yourself.