tts-narrator
Version:
Generate narration with Text-To-Speech technology
120 lines • 4.2 kB
TypeScript
import { TtsServiceType } from './tts-service';
export interface VoiceSettings {
/**
* Language, corresponding to `speak#xml:lang` in SSML.
*/
language?: string;
/**
* Voice name, corresponding to `speak.voice#name` in SSML.
*/
name?: string;
/**
* Voice effect, corresponding to `speak.voice#effect` in SSML.
*/
effect?: string;
/**
* Corresponding to `speak.voice.prosody` in SSML.
*/
prosody?: {
rate?: string;
pitch?: string;
volume?: string;
};
/**
* Corresponding to `speak.voice.mstts:express-as` in SSML.
*/
msttsExpressAs?: {
style?: string;
styleDegree?: string;
role?: string;
};
}
export interface ScriptSettings {
service?: TtsServiceType;
voice?: VoiceSettings;
}
export declare namespace NarrationScriptFile {
interface Paragraph {
settings?: VoiceSettings;
key?: string;
/**
* Text to be narrated, it can't be XML.
* If you want to use XML, use `ssml` property instead.
* If both `text` and `ssml` are provided, `ssml` will be used.
* If both are empty, an error will be thrown.
*/
text?: string;
/**
* Full or partial SSML (a kind of XML)
* If provided, it will be used instead of `text`.
* If both `text` and `ssml` are provided, `ssml` will be used.
* If both are empty, an error will be thrown.
*/
ssml?: string;
}
interface Section {
settings?: VoiceSettings;
key?: string;
paragraphs: Paragraph[];
}
interface Chapter {
settings?: VoiceSettings;
key?: string;
sections: Section[];
}
interface Script {
settings: ScriptSettings;
chapters: Chapter[];
}
}
export declare class NarrationParagraph implements NarrationScriptFile.Paragraph {
protected paragraph: NarrationScriptFile.Paragraph;
index: number;
section: NarrationSection;
chapter: NarrationChapter;
script: NarrationScript;
/**
* Path of the generated audio file. Only for in-memory processing, not supposed to be stored in file.
*/
audioFilePath?: string;
constructor(paragraph: NarrationScriptFile.Paragraph, index: number, section: NarrationSection, chapter: NarrationChapter, script: NarrationScript);
get settings(): VoiceSettings;
get key(): string;
get text(): string | undefined;
get ssml(): string | undefined;
}
export declare class NarrationSection implements NarrationScriptFile.Section {
protected section: NarrationScriptFile.Section;
index: number;
chapter: NarrationChapter;
script: NarrationScript;
paragraphs: NarrationParagraph[];
constructor(section: NarrationScriptFile.Section, index: number, chapter: NarrationChapter, script: NarrationScript);
get settings(): VoiceSettings;
get key(): string;
}
export declare class NarrationChapter implements NarrationScriptFile.Chapter {
protected chapter: NarrationScriptFile.Chapter;
index: number;
script: NarrationScript;
private sectionsByKeys;
sections: NarrationSection[];
constructor(chapter: NarrationScriptFile.Chapter, index: number, script: NarrationScript);
get settings(): VoiceSettings;
get key(): string;
getSectionByKey(key: string): NarrationSection | undefined;
}
export declare class NarrationScript implements NarrationScriptFile.Script {
protected script: NarrationScriptFile.Script;
scriptFilePath: string;
private chaptersByKeys;
chapters: NarrationChapter[];
constructor(script: NarrationScriptFile.Script, scriptFilePath: string);
get settings(): ScriptSettings;
getChapterByKey(key: string): NarrationChapter | undefined;
export(): NarrationScriptFile.Script;
}
export declare function loadScript(scriptFilePath: string): Promise<NarrationScript>;
export declare function saveScript(script: NarrationScript): Promise<void>;
export declare function saveScript(script: NarrationScriptFile.Script, scriptFilePath: string): Promise<void>;
//# sourceMappingURL=narration-script.d.ts.map