UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

54 lines (53 loc) 1.78 kB
/** * ElevenLabs Text-to-Speech Handler * * Implementation of TTS using ElevenLabs API. * * @module voice/providers/ElevenLabsTTS */ import type { TTSHandler, TTSOptions, TTSResult, TTSVoice } from "../../types/index.js"; /** * ElevenLabs Text-to-Speech Handler * * Supports high-quality multilingual TTS with voice cloning. * * @see https://elevenlabs.io/docs/api-reference */ export declare class ElevenLabsTTS implements TTSHandler { private readonly apiKey; private readonly baseUrl; private voicesCache; private static readonly CACHE_TTL_MS; /** * Maximum text length (5000 characters) */ readonly maxTextLength = 5000; constructor(apiKey?: string); isConfigured(): boolean; getVoices(languageCode?: string): Promise<TTSVoice[]>; synthesize(text: string, options?: TTSOptions): Promise<TTSResult>; /** * Map gender string to standard type */ private mapGender; /** * Map TTSAudioFormat to ElevenLabs output format */ private mapFormat; /** * Get sample rate from format string */ private getSampleRate; /** * Map the ElevenLabs `output_format` string back to a canonical * TTSAudioFormat. mapFormat() falls back to mp3_44100_128 for unsupported * inputs, so this is needed to keep TTSResult.format honest. * * NOTE: ElevenLabs `pcm_*` outputs are RAW 16-bit signed-LE PCM samples * with no RIFF/WAV header. We surface that as `pcm16` (which exists in the * `TTSAudioFormat` union exactly for this case) — labeling it as `wav` * would cause consumers writing the buffer to a `.wav` file or feeding it * to a WAV parser to produce unplayable output (CodeRabbit review). */ private effectiveFormat; }