API Reference
Text Translate To Speech · WebSocket
WSS
wss://stream.shabd.tech/v1/text-translate-to-speechConnection headers
x-api-keystringrequiredAPI key for authentication.
Message flow
- Outgoing Message (↑): The client sends a JSON object with the necessary parameters for translation and speech synthesis.
- Incoming Message (↓): The server responds with a stream of translation and raw PCM-16 bit audio data in chunks.
Send Message (↑):
Sending Text Message
{ "requestId": "a216e43a-9d81-444c-a9ae-3c1e400fcb02", "text": "नमस्ते, आपका दिन शुभ हो!", "sourceLanguage": "hindi", "targetLanguage": "tamil", "gender": "female", "sampleRate": 8000, "speed": "normal"}Initial messageapplication/json
requestIdstringrequiredUnique identifier for the request
textstringrequiredText content to be converted to speech
sourceLanguagestringrequiredSource language of the text
targetLanguagestringrequiredTarget language to translate to
genderstringoptional- Allowed:
malefemale- Default:
male
sampleRatenumber or nulloptionalAudio sample rate for synthesis (e.g., 22050)
speedstringoptional- Allowed:
slownormalfast- Default:
normal
Server messages
The server sends back translation and 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