js-tts-wrapper
Version:
A JavaScript/TypeScript library that provides a unified API for working with multiple cloud-based Text-to-Speech (TTS) services
32 lines (31 loc) • 1.18 kB
TypeScript
/**
* Utility functions for playing audio in Node.js
*/
/**
* Check if Node.js audio playback is available
* @returns True if Node.js audio playback is available
*/
export declare function isNodeAudioAvailable(): Promise<boolean>;
/**
* Play audio in Node.js
* @param audioBytes Audio data as Uint8Array
* @param sampleRate Sample rate in Hz (default: 24000 for WitAI, 16000 for others)
* @param engineName Name of the TTS engine (used to determine if raw PCM conversion is needed)
* @returns Promise that resolves when audio playback is complete
*/
export declare function playAudioInNode(audioBytes: Uint8Array, sampleRate?: number, engineName?: string): Promise<void>;
/**
* Pause audio playback by stopping the current process
* @returns True if playback was paused, false otherwise
*/
export declare function pauseAudioPlayback(): boolean;
/**
* Resume audio playback is not supported in this implementation
* @returns Always false as resume is not supported
*/
export declare function resumeAudioPlayback(): boolean;
/**
* Stop audio playback
* @returns True if playback was stopped, false otherwise
*/
export declare function stopAudioPlayback(): boolean;