🎵 Music & Sound Design · islamic folk arrangement

Mappila Paattu Arranger

Sarvam-105B writes choral harmonies in Malayalam so singers record; Sarvam Bulbul v2 (TTS) reads it.

Sarvam Bulbul v2 (TTS)· Indian-language voice
Section · Voice

The primitive.

full primer →

Islamic folk arrangement gets its own Indian-language voice: a server function calls Sarvam Bulbul v2 and musicians hear the result spoken in Hindi, Tamil, Bengali — whichever language they pick.

Why this primitiveBulbul v2 is the right voice for islamic folk arrangement in Music & Sound Design because the output is meant to be HEARD in an Indian language — a 30+ speaker, 11-language TTS beats any English-only narrator.

Kernel
a POST https://api.sarvam.ai/text-to-speech call (model bulbul:v2, 30+ speakers, 11 Indian languages) sent with the api-subscription-key header; the server returns base64 WAV the client plays
Drives the UI as
a play button (or auto-play) that streams a natural Indian-language voiceover of anything the app writes
Appendix · Secrets

Required key.

SARVAM_API_KEY
Single api-subscription-key for Bulbul TTS, Saaras STT, Sarvam-105B chat, and Mayura translation across 22 Indian languages.
open ↗

Add this in your Lovable project under Settings → Secrets before pasting the prompt below.

Appendix · Mega-prompt

The build prompt.

Paste into a fresh Lovable project. Make sure the key above is set first. read the build strategy →

Build "Mappila Paattu Arranger" as a Sarvam AI NATIVE one-shot Lovable build. The
participant has only 5 credits — this single message must produce a working
demo with no follow-ups. Single-page TanStack Start app. Cut scope ruthlessly.

CONCEPT
Sarvam-105B writes choral harmonies in Malayalam so singers record; Sarvam Bulbul v2 (TTS) reads it.
Discipline: Music & Sound Design (islamic folk arrangement). Audience: Indian creators working in their own language.
Recipe: Sarvam-105B does the reasoning + Sarvam Bulbul v2 (TTS) as the user-facing surface.
Why this Sarvam primitive: Bulbul v2 is the right voice for islamic folk arrangement in Music & Sound Design because the output is meant to be HEARD in an Indian language — a 30+ speaker, 11-language TTS beats any English-only narrator.

LOVABLE BUDGET (HARD CAP: ONE-SHOT, ~5 CREDITS TOTAL):
The participant has FIVE Lovable credits for the whole build. This prompt MUST
ship a working demo on the FIRST message with zero follow-ups. Engineer for that.
- ONE TanStack Start app, ONE route (`src/routes/index.tsx`). No extra pages, no auth, no nav.
- AT MOST TWO TanStack server functions: one that calls Sarvam-105B for the
  reasoning, one that calls the chosen Sarvam primitive (TTS / STT / Translate).
  Fold them into one if the primitive needs no upstream text generation.
- ONE client surface (a button, a mic, a prompt box, a language switcher) wired
  to those server fns.
- NO database, NO Lovable Cloud, NO auth, NO file uploads, NO extra integrations.
- NO tests, NO docs pages, NO settings screens, NO theming toggles.
- Libraries: template defaults + `ai` + `@ai-sdk/openai-compatible` + `zod`. Nothing else.
- Keep the diff small enough to land in one build pass. Cut scope before adding scope.

STACK
- TanStack Start app, the index route only.
- Sarvam AI is the ENTIRE backend. No OpenAI, no ElevenLabs, no Gemini, no
  Whisper, no Lovable AI Gateway. Every model call goes to api.sarvam.ai.
- Client surface fits the kernel: a play button (or auto-play) that streams a natural Indian-language voiceover of anything the app writes.
- Tailwind + shadcn. Editorial look: gold accent on a warm cream / deep ink
  background, generous Indian-script type (use a system stack that covers
  Devanagari, Tamil, Bengali, Telugu, etc.).
- Footer renders: "Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14".

BRAIN — Sarvam-105B via the OpenAI-compatible chat endpoint:
```ts
// src/lib/sarvam.server.ts
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
export function sarvam() {
  return createOpenAICompatible({
    name: "sarvam",
    baseURL: "https://api.sarvam.ai/v1",
    headers: { "api-subscription-key": process.env.SARVAM_API_KEY! },
  });
}
```
Default chat model: `sarvam-105b`. Use `generateText` from `ai`. For factual
Indian-context answers, add `providerOptions: { sarvam: { wiki_grounding: true } }`.
Keep the system prompt and model call inside the server function — never call
Sarvam from the client. The model THINKS in the user's Indian language; ask it
to answer in `${languageCode}` (e.g. "hi-IN", "ta-IN").

SERVER FUNCTION (src/lib/voice.functions.ts) — Sarvam-105B writes the answer, Bulbul speaks it:
```ts
import { createServerFn } from "@tanstack/react-start";
import { generateText } from "ai";
import { z } from "zod";
import { sarvam } from "./sarvam.server";

/** Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14 */
export const speak = createServerFn({ method: "POST" })
  .inputValidator((d) => z.object({
    topic: z.string().min(1).max(500),
    languageCode: z.string().default("hi-IN"),
    speaker: z.string().default("anushka"),
  }).parse(d))
  .handler(async ({ data }) => {
    // 1. BRAIN — Sarvam-105B answers in the user's Indian language.
    const { text } = await generateText({
      model: sarvam()("sarvam-105b"),
      system: `You are an expert islamic folk arrangement mentor for Indian creators. ` +
              `Answer in the language code ${data.languageCode}. ` +
              `Warm, specific, under 80 words. No headings, no English unless asked.`,
      prompt: data.topic,
    });

    // 2. VOICE — Bulbul v2 reads it back in the same language.
    const r = await fetch("https://api.sarvam.ai/text-to-speech", {
      method: "POST",
      headers: {
        "api-subscription-key": process.env.SARVAM_API_KEY!,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        text,
        target_language_code: data.languageCode,
        speaker: data.speaker,           // anushka / manisha / vidya / arya / abhilash / karun / hitesh
        model: "bulbul:v2",              // v2 = stable; switch to "bulbul:v3" when whitelisted
        enable_preprocessing: true,
      }),
    });
    if (!r.ok) throw new Error(`Sarvam TTS failed: ${r.status} ${await r.text()}`);
    const { audios } = await r.json() as { audios: string[] };
    return { text, audio: audios[0] };   // already base64 WAV
  });
```

CLIENT (in the page component):
```tsx
import { useServerFn } from "@tanstack/react-start";
import { speak } from "@/lib/voice.functions";

const ask = useServerFn(speak);
const onSubmit = async (topic: string, languageCode: string) => {
  const { text, audio } = await ask({ data: { topic, languageCode } });
  // render `text` (it's in Indian script — use a system font stack that covers Devanagari/Tamil/etc.)
  await new Audio(`data:audio/wav;base64,${audio}`).play();
};
```

LANGUAGE PICKER — required (Sarvam apps are Indian-language native):
Add a `<Select>` with these BCP-47 codes, labelled in their own script:
  hi-IN हिन्दी · bn-IN বাংলা · ta-IN தமிழ் · te-IN తెలుగు · kn-IN ಕನ್ನಡ ·
  ml-IN മലയാളം · mr-IN मराठी · gu-IN ગુજરાતી · pa-IN ਪੰਜਾਬੀ · od-IN ଓଡ଼ିଆ · en-IN English
Default to `hi-IN` so the demo opens in an Indian language without a click.
Pass the selected code into every Sarvam call (`target_language_code` for TTS
and Translate, `language_code` for STT, system-prompt instruction for chat).

USER FLOW (the entire app — nothing else exists)
1. Land on the page; the headline (in Hindi by default, switchable) previews
   what the demo does for islamic folk arrangement in Music & Sound Design.
2. The primary action (a play button (or auto-play) that streams a natural Indian-language voiceover of anything the app writes) is one tap away; the rest of the layout supports it.
3. Sarvam-105B does the thinking, the chosen Sarvam primitive does the
   speaking / transcribing / translating, and the result stays on screen in
   the chosen Indian language so the user can retry, switch language, or share.

KEY — one secret, already provided to participants:
`SARVAM_API_KEY` from https://dashboard.sarvam.ai. Read it ONLY on the server
via `process.env.SARVAM_API_KEY`. Never prefix with `VITE_` and never expose
to the client. Sarvam's auth header is `api-subscription-key: <key>` (NOT
`Authorization: Bearer`) — both the proprietary endpoints (TTS/STT/Translate)
and the OpenAI-compatible chat endpoint accept that header.

CREDIT (must appear in UI footer AND as JSDoc on the server function):
Built during the Creative AI & Quantum Hackathon organised by StreetKode Fam during Indian Krump Festival 14
Appendix · Market

Market sizing.

TAM
$500M
Malayalam Mappila folk and devotional music
SAM
$50M
regional folk choirs and studio vocalists
SOM
$5M
music arrangers producing traditional wedding albums

Indicative figures for hackathon pitches — refine with your own research before raising.

See also

Adjacent entries.