API Reference
Speech To Speech · WebSocket
WSS
wss://stream.shabd.tech/v1/speech-to-speechConnection headers
x-api-keystringrequiredAPI key for authentication.
Message flow
WebSocket endpoint for real-time speech-to-speech conversion.
Message Flow:
- Outgoing Message (↑): The client sends metadata including a requestId, sourceLanguage, targetLanguage, and optional settings like gender, inputSampleRate, sampleRate and speed. After sending metadata, the client sends audio data in bytes.
- Incoming Message (↓): The server responds with processed text and audio data.
Send MetaData (↑):
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "sourceLanguage": "english", "targetLanguage": "hindi", "gender": "female", "inputSampleRate": 16000, "sampleRate": 8000, "speed": "normal", "projectId": "<your-project-id-here>"}Send Audio Data (↑):
Raw PCM 16-bit Audio Data (in Bytes) Initial messageapplication/json
requestIdstringrequiredUnique identifier for the request
sourceLanguagestringrequiredSource language of the speech
targetLanguagestringrequiredTarget language to translate to
genderstringoptional- Allowed:
malefemale- Default:
male
inputSampleRatenumber or nulloptionalSample rate of the input speech
- Default:
16000
sampleRatenumber or nulloptionalAudio sample rate for synthesis (e.g., 22050)
speedstringoptional- Allowed:
slownormalfast- Default:
normal
projectIdstring or nulloptionalAn optional ID representing the project.
Server messages
The server sends back synthesized audio as continuous streams of raw PCM-16 bit audio data.The response consists of 48-byte header containing metadata.Raw PCM-16 bit audio data following the header.
Receive Message (↓):
Streaming PCM-16 bit audio data in chunks...Field Breakdown
Messages