microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
88 lines (87 loc) • 2.72 kB
TypeScript
import { PropertyCollection } from "./Exports.js";
import { SpeechSynthesisRequestInputType } from "./SpeechSynthesisRequestInputType.js";
import { SpeechSynthesisRequestInputStream } from "./SpeechSynthesisRequestInputStream.js";
export { SpeechSynthesisRequestInputStream } from "./SpeechSynthesisRequestInputStream.js";
/**
* Represents a speech synthesis request with support for text streaming.
* Note: This class is in preview and may be subject to change in future versions.
* @class SpeechSynthesisRequest
*/
export declare class SpeechSynthesisRequest {
private privInputType;
private privInputStream;
private privProperties;
private privTextPieceCallback;
private privStreamCloseCallback;
private privBufferedTextPieces;
private privStreamClosedBeforeReady;
/**
* Creates a speech synthesis request.
* @param inputType The input type for the speech synthesis request.
*/
constructor(inputType: SpeechSynthesisRequestInputType);
/**
* Gets the input type of this request.
*/
get inputType(): SpeechSynthesisRequestInputType;
/**
* Gets the input stream for writing text pieces.
*/
get inputStream(): SpeechSynthesisRequestInputStream;
/**
* Gets the properties collection for this request.
*/
get properties(): PropertyCollection;
/**
* Sets the pitch of the voice.
*/
set pitch(value: string);
/**
* Sets the speaking rate of the voice.
*/
set rate(value: string);
/**
* Sets the volume of the voice.
*/
set volume(value: string);
/**
* Sets the style of the voice.
*/
set style(value: string);
/**
* Sets the temperature of the voice synthesis.
*/
set temperature(value: number);
/**
* Sets the custom lexicon URL.
*/
set customLexiconUrl(value: string);
/**
* Sets the preferred locales for the voice.
*/
set preferLocales(value: string);
/**
* @internal
* Called by InputStream when a text piece is written.
* Buffers text if no callback is registered yet.
*/
onTextPieceReceived(text: string): void;
/**
* @internal
* Called by InputStream when it is closed.
* Buffers close event if no callback is registered yet.
*/
onInputStreamClosed(): void;
/**
* @internal
* Sets the callback for receiving text pieces.
* Flushes any buffered text pieces immediately.
*/
set onTextPiece(callback: (text: string) => void);
/**
* @internal
* Sets the callback for stream close events.
* Fires immediately if stream was already closed.
*/
set onClose(callback: () => void);
}