Skip to main content
The Text to Speech (TTS) service converts written text into spoken audio in various Ugandan languages.

Available Voices

We provide specific speaker models for each language to ensure natural intonation and pronunciation.
IDLanguageGenderCharacteristics
241AcholiFemaleClear, moderate pace
242AtesoFemaleWarm, expressive
243RunyankoleFemaleSoft, natural
245LugbaraFemaleClear articulation
246SwahiliMaleDeep, authoritative
248LugandaFemaleNatural, conversational

Generating Speech

Use the /tasks/tts endpoint.

Parameters

ParameterTypeRequiredDescription
textstringYesThe text to convert to speech.
speaker_idintegerYesThe ID of the voice to use (see table above).

Example Request

Generating Luganda speech.
import requests

url = "https://api.sunbird.ai/tasks/tts"
payload = {
    "text": "Oli otya?",
    "speaker_id": 248
}
headers = {
    "Authorization": "Bearer <YOUR_TOKEN>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())

Response

The response includes a URL to the generated audio file.
{
  "output": {
    "audio_url": "https://storage.googleapis.com/...",
    "sample_rate": 16000
  }
}
The audio_url is a temporary signed URL. You should download or stream the audio immediately.