agentleFS
sarvamaisarvamai/skills/text-to-speech/SKILL.md

text-to-speech

Skill73 starsChanged 2 months agoApache-2.0View on GitHub

Write correct Sarvam Bulbul TTS code — REST, HTTP stream, WebSocket, pronunciation dictionaries, and v3 parameter traps (pitch/loudness, speaker compatibility). Use this skill when generating speech in an app with Python or JS/TS. For live TTS in chat via MCP, use sarvam-mcp instead.

  • Reads credentials

13 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use voice-changer, sound-effects and 5 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • wlzhSkill

    voice-changer

    音频变声处理工具 - 使用 RVC AI 模型进行真实的声音转换,支持视频直接输入

    Also in 4 projects that use this

  • awesome-genmediaSkill

    sound-effects

    Generate custom sound effects using each::sense AI. Create realistic and stylized audio for any scenario including impacts, ambiences, foley, UI sounds, nature, mechanical effects, and transitions. Powered by stable-audio-2-5 for precise audio generation. Use for: video production, game development, podcasts, apps, UI/UX, presentations, film. Triggers: sound effect, sfx, audio effect, foley, generate sound, ambient sound, ui sound, impact sound, whoosh, explosion, nature sound, notification sound, create audio

    Also in 4 projects that use this

  • elevenlabsSkill

    speech-engine

    Add real-time voice conversations to a custom agent runtime with ElevenLabs Speech Engine. Use when building Speech Engine servers, WebSocket handlers, WebRTC browser clients, conversation token endpoints, interruption-aware streaming responses, or voice-enabled chat agents that connect developer-owned server logic to ElevenLabs speech-to-text and text-to-speech.

    Also in 3 projects that use this

  • elevenlabsSkill

    voice-isolator

    Remove background noise and isolate vocals/speech from audio using ElevenLabs Voice Isolator (audio isolation) API. Use when cleaning up noisy recordings, removing music or background ambience from dialogue, isolating speech from field recordings, preparing audio for transcription, extracting vocals, or any "denoise / clean up / isolate voice" task.

    Also in 3 projects that use this

  • sonilo-aiSkill

    setup-api-key

    Guides users through connecting to Sonilo — signing in with `sonilo login` (OAuth, no key), the remote OAuth plugin for Claude Code or Muse Code, or an API key for CI and headless use. Use when the user needs to configure Sonilo, wants to sign in or connect their Sonilo account, when Sonilo tools are missing, or when a call fails because no key or credential is available. First checks what already works, and only runs full setup when needed.

    Also in 3 projects that use this

  • marswaveaiSkill

    music

    Generate, remix, extend, edit, and analyze AI music (Mureka). Triggers on: "音乐", "music", "生成音乐", "generate music", "翻唱", "cover", "混音", "remix", "续写", "extend", "纯音乐", "instrumental", "配乐", "soundtrack", "分轨", "stem", "识别歌词", "recognize lyrics", "作曲", "compose", "create a song", "做一首歌".

    Also in 3 projects that use this

The file

Files
SKILL.md

Text-to-Speech — Bulbul

Live in-chat TTS → sarvam-mcp (sarvam_tools_tts_*). This skill = SDK code.

[!IMPORTANT] Auth: api-subscription-key header — NOT Authorization: Bearer. Base URL: https://api.sarvam.ai (NOT /v1 — that prefix is only for the OpenAI-compatible chat endpoint) SDK floor for the code below: Python sarvamai>=0.1.29, JS sarvamai@>=1.1.8. On older versions the TTS param is target_language_code — see Gotchas.

Model

bulbul:v3 — 11 languages, 37 voices (23 male, 14 female; default: shubh), REST/HTTP stream/WebSocket.

Quick Start (Python)

from sarvamai import SarvamAI
from sarvamai.play import save

client = SarvamAI()

response = client.text_to_speech.convert(
    text="नमस्ते, आप कैसे हैं?",
    language_code="hi-IN",
    model="bulbul:v3",
    speaker="shubh"
)
save(response, "output.wav")

# HTTP Stream (lower latency, binary audio)
chunks = []
for chunk in client.text_to_speech.convert_stream(
    text="Hello from Sarvam AI",
    language_code="en-IN",
    speaker="shubh",
    model="bulbul:v3"
):
    chunks.append(chunk)
audio = b"".join(chunks)

Quick Start (JavaScript/TypeScript)

import { SarvamAIClient } from "sarvamai";
import { writeFile } from "fs/promises";

const client = new SarvamAIClient({ apiSubscriptionKey: "YOUR_SARVAM_API_KEY" });

// REST
const response = await client.textToSpeech.convert({
    text: "नमस्ते, आप कैसे हैं?",
    language_code: "hi-IN",
    model: "bulbul:v3",
    speaker: "shubh"
});

// HTTP Stream (lower latency, returns BinaryResponse)
const streamResponse = await client.textToSpeech.convertStream({
    text: "Hello from Sarvam AI",
    language_code: "en-IN",
    speaker: "shubh",
    model: "bulbul:v3"
});
const bytes = await streamResponse.bytes();
await writeFile("output.wav", bytes);

WebSocket Streaming

import asyncio
from sarvamai import AsyncSarvamAI

async def tts_stream():
    client = AsyncSarvamAI()
    async with client.text_to_speech_streaming.connect(model="bulbul:v3") as ws:
        await ws.configure(target_language_code="hi-IN", speaker="shubh")
        await ws.convert("Your text here")
        await ws.flush()
        async for message in ws:
            pass  # base64 audio chunks

asyncio.run(tts_stream())

Character Limits

MethodMax Text
REST (convert)2,500 chars
HTTP Stream (convert_stream)3,500 chars
WebSocket2,500 chars/msg (keep <500 for lowest latency; send many messages per connection)

Gotchas

GotchaDetail
language_code is version-gatedPython >=0.1.29 and JS >=1.1.8 (both 2026-08-03) take language_code; earlier versions take target_language_code. Hard rename — no alias, no deprecation shim, and the JSON body key changed too, so the wrong name raises TypeError before any request goes out. Check with pip show sarvamai / npm ls sarvamai if you hit that.
WebSocket was not renamedPython ws.configure() still takes target_language_code (mapped to language_code on the wire); JS configureConnection() takes language_code. REST and WebSocket disagree inside the Python SDK.
JS method nameclient.textToSpeech.convert({...}) and .convertStream({...}) — camelCase. Stream returns BinaryResponse with .stream(), .bytes(), .blob().
pitch/loudness rejectedSDK accepts these but API returns 400 for v3. Only pace (0.5–2.0) works.
v2 voices incompatibleanushka, abhilash, arya, etc. don't work with v3. Use shubh (default).
Sample rate >24kHz32kHz, 44.1kHz, 48kHz only via REST, not streaming.
REST responseBase64-encoded audio in response.audios[0]. Use sarvamai.play.save() or base64.b64decode().
No SSMLSSML markup is NOT supported. Use pace for speed control and the pronunciation dictionary for word-level fixes.
Use native scriptRomanized Indic input ("Aapka order confirm ho gaya hai") degrades quality. Write Indic words in native script.
Pronunciation dictionarydict_id param teaches custom word pronunciations (bulbul:v3 only; 10 dicts/user, 100 words/dict). Create via Python client.pronunciation_dictionary.create(file=f). JS SDK upload is broken (missing multipart Content-Type) — use raw fetch + FormData with an explicit Blob type.

Full Docs

Fetch voice catalog, streaming protocol, pronunciation dictionary CRUD, and codec options from:

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.