@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
88 lines (87 loc) • 3.22 kB
TypeScript
import type { TTSOptions, TTSResult, TTSVoice, TTSHandler } from "../../types/index.js";
export declare class GoogleTTSHandler implements TTSHandler {
private client;
private voicesCache;
private static readonly CACHE_TTL_MS;
/**
* Google Cloud TTS maximum input size.
* ~5000 bytes INCLUDING SSML tags.
*/
private static readonly DEFAULT_MAX_TEXT_LENGTH;
/**
* Default timeout for Google Cloud TTS API calls (milliseconds)
*
* Google typically responds within:
* - 1–5 seconds for short or normal text
* - 5–10 seconds for longer text or Neural2 voices
*/
private static readonly DEFAULT_API_TIMEOUT_MS;
/**
* Maximum text length supported by Google Cloud TTS (in bytes).
*
* NOTE:
* Validation against this limit is performed by the shared TTS processor
* before invoking provider handlers, not inside this class.
*/
readonly maxTextLength: number;
constructor(credentialsPath?: string);
/**
* Validate that the provider is properly configured
*
* @returns True if provider can generate TTS
*/
isConfigured(): boolean;
/**
* Get available voices for the provider
*
* Note: This method is optional in the TTSHandler interface, but Google Cloud TTS
* fully implements it to provide comprehensive voice discovery capabilities.
*
* @param languageCode - Optional language filter (e.g., "en-US")
* @returns List of available voices
*/
getVoices(languageCode?: string): Promise<TTSVoice[]>;
/**
* Generate audio from text using provider-specific TTS API
*
* @param text - Text or SSML to convert to speech
* @param options - TTS configuration options
* @returns Audio buffer with metadata
*/
synthesize(text: string, options: TTSOptions): Promise<TTSResult>;
/**
* Extract language code from a Google Cloud voice name
*
* Example:
* "en-US-Neural2-C" -> "en-US"
*
* @param voiceId - Google Cloud voice identifier
* @returns Language code compatible with Google TTS
*/
private extractLanguageCode;
/**
* Map application audio format to Google Cloud audio encoding
*
* @param format - Audio format requested by the caller
* @returns Google Cloud AudioEncoding enum value
* @throws Error if format is unsupported
*/
private mapFormat;
/**
* Detect the voice type from a Google Cloud TTS voice name
*
* Parses the voice name to identify the underlying voice technology/model type.
* Google Cloud TTS offers different voice types with varying quality and pricing.
*
* @param name - The full Google Cloud voice name (e.g., "en-US-Neural2-C")
* @returns The detected voice type
*
* @example
* detectVoiceType("en-US-Neural2-C") // returns "neural"
* detectVoiceType("en-US-Wavenet-A") // returns "wavenet"
* detectVoiceType("en-US-Standard-B") // returns "standard"
* detectVoiceType("en-US-Chirp-A") // returns "chirp"
* detectVoiceType("en-US-Journey-D") // returns "unknown" (unrecognized type)
*/
private detectVoiceType;
}