@picovoice/orca-web
Version:
Orca Text-to-Speech engine for web browsers (via WebAssembly)
115 lines • 3.43 kB
TypeScript
import { PvModel } from '@picovoice/web-utils';
export declare enum PvStatus {
SUCCESS = 10000,
OUT_OF_MEMORY = 10001,
IO_ERROR = 10002,
INVALID_ARGUMENT = 10003,
STOP_ITERATION = 10004,
KEY_ERROR = 10005,
INVALID_STATE = 10006,
RUNTIME_ERROR = 10007,
ACTIVATION_ERROR = 10008,
ACTIVATION_LIMIT_REACHED = 10009,
ACTIVATION_THROTTLED = 10010,
ACTIVATION_REFUSED = 10011
}
/**
* OrcaModel types
*/
export type OrcaModel = PvModel;
export type OrcaSynthesizeParams = {
speechRate?: number;
randomState?: number | null;
};
export type OrcaPhoneme = {
phoneme: string;
startSec: number;
endSec: number;
};
export type OrcaAlignment = {
word: string;
startSec: number;
endSec: number;
phonemes: OrcaPhoneme[];
};
export type OrcaSynthesizeResult = {
pcm: Int16Array;
alignments: OrcaAlignment[];
};
export type OrcaStreamSynthesizeResult = Int16Array | null;
export type OrcaOptions = {
/** @defaultValue 'best' */
device?: string;
};
export type OrcaWorkerInitRequest = {
command: 'init';
accessKey: string;
modelPath: string;
wasmSimd: string;
wasmSimdLib: string;
wasmPThread: string;
wasmPThreadLib: string;
sdk: string;
options: OrcaOptions;
};
export type OrcaWorkerSynthesizeRequest = {
command: 'synthesize';
text: string;
synthesizeParams: OrcaSynthesizeParams;
};
export type OrcaWorkerReleaseRequest = {
command: 'release';
};
export type OrcaWorkerStreamOpenRequest = {
command: 'streamOpen';
synthesizeParams: OrcaSynthesizeParams;
};
export type OrcaWorkerStreamSynthesizeRequest = {
command: 'streamSynthesize';
text: string;
};
export type OrcaWorkerStreamFlushRequest = {
command: 'streamFlush';
};
export type OrcaWorkerStreamCloseRequest = {
command: 'streamClose';
};
export type OrcaWorkerRequest = OrcaWorkerInitRequest | OrcaWorkerSynthesizeRequest | OrcaWorkerReleaseRequest | OrcaWorkerStreamOpenRequest | OrcaWorkerStreamSynthesizeRequest | OrcaWorkerStreamFlushRequest | OrcaWorkerStreamCloseRequest;
export type OrcaWorkerFailureResponse = {
command: 'failed' | 'error';
status: PvStatus;
shortMessage: string;
messageStack: string[];
};
export type OrcaWorkerInitResponse = OrcaWorkerFailureResponse | {
command: 'ok';
version: string;
numSymbols: number;
validCharacters: string[];
maxCharacterLimit: number;
sampleRate: number;
};
export type OrcaWorkerSynthesizeResponse = OrcaWorkerFailureResponse | {
command: 'ok';
result: OrcaSynthesizeResult;
};
export type OrcaWorkerReleaseResponse = OrcaWorkerFailureResponse | {
command: 'ok';
};
export type OrcaWorkerStreamOpenResponse = OrcaWorkerFailureResponse | {
command: 'ok';
result: any;
};
export type OrcaWorkerStreamSynthesizeResponse = OrcaWorkerFailureResponse | {
command: 'ok';
result: OrcaStreamSynthesizeResult;
};
export type OrcaWorkerStreamFlushResponse = OrcaWorkerFailureResponse | {
command: 'ok';
result: OrcaStreamSynthesizeResult;
};
export type OrcaWorkerStreamCloseResponse = OrcaWorkerFailureResponse | {
command: 'ok';
};
export type OrcaWorkerResponse = OrcaWorkerInitResponse | OrcaWorkerSynthesizeResponse | OrcaWorkerReleaseResponse | OrcaWorkerStreamOpenResponse | OrcaWorkerStreamSynthesizeResponse | OrcaWorkerStreamFlushResponse;
//# sourceMappingURL=types.d.ts.map