UNPKG

@mastra/voice-sarvam

Version:

Mastra Sarvam AI voice integration

65 lines 2.94 kB
import { MastraVoice } from '@mastra/core/voice'; import type { SarvamTTSLanguage, SarvamSTTLanguage, SarvamSTTModel, SarvamTTSModel, SarvamVoiceId, SarvamSTTMode } from './voices.js'; interface SarvamVoiceConfig { apiKey?: string; model?: SarvamTTSModel; language?: SarvamTTSLanguage; properties?: { /** Controls the speed of the audio. Supported by bulbul:v2 (0.3–3.0) and bulbul:v3 (0.5–2.0). */ pace?: number; /** Sampling temperature. bulbul:v3 only. Range: 0.01–2.0. Default: 0.6. */ temperature?: number; /** Pronunciation dictionary ID. bulbul:v3 only. */ dict_id?: string; /** Controls the pitch of the audio. bulbul:v2 only. Range: -0.75–0.75. */ pitch?: number; /** Controls the loudness of the audio. bulbul:v2 only. Range: 0.3–3.0. */ loudness?: number; /** Enables normalization of English words and numeric entities. bulbul:v2 only. */ enable_preprocessing?: boolean; /** Audio sample rate in Hz. */ speech_sample_rate?: 8000 | 16000 | 22050 | 24000 | 32000 | 44100 | 48000; /** Output audio codec. */ output_audio_codec?: 'mp3' | 'wav' | 'linear16' | 'mulaw' | 'alaw' | 'opus' | 'flac' | 'aac'; }; } interface SarvamListenOptions { apiKey?: string; model?: SarvamSTTModel; languageCode?: SarvamSTTLanguage; filetype?: 'mp3' | 'wav'; /** Operation mode for saaras:v3. Ignored by other models. */ mode?: SarvamSTTMode; } export declare class SarvamVoice extends MastraVoice { private apiKey?; private model; private language; private properties; speaker: SarvamVoiceId; private baseUrl; constructor({ speechModel, speaker, listeningModel, }?: { speechModel?: SarvamVoiceConfig; speaker?: SarvamVoiceId; listeningModel?: SarvamListenOptions; }); private makeRequest; private streamToString; speak(input: string | NodeJS.ReadableStream, options?: { speaker?: SarvamVoiceId; }): Promise<NodeJS.ReadableStream>; getSpeakers(): Promise<{ voiceId: "shubh" | "aditya" | "ritu" | "priya" | "neha" | "rahul" | "pooja" | "rohan" | "simran" | "kavya" | "amit" | "dev" | "ishita" | "shreya" | "ratan" | "varun" | "manan" | "sumit" | "roopa" | "kabir" | "aayan" | "ashutosh" | "advait" | "amelia" | "sophia" | "anand" | "tanya" | "tarun" | "sunny" | "mani" | "gokul" | "vijay" | "shruti" | "suhani" | "mohit" | "kavitha" | "rehan" | "soham" | "rupali" | "anushka" | "manisha" | "vidya" | "arya" | "abhilash" | "karun" | "hitesh"; }[]>; /** * Checks if listening capabilities are enabled. * * @returns {Promise<{ enabled: boolean }>} */ getListener(): Promise<{ enabled: boolean; }>; listen(input: NodeJS.ReadableStream, options?: SarvamListenOptions): Promise<string>; } export {}; //# sourceMappingURL=index.d.ts.map