tts-narrator
Generate narration with Text-To-Speech technology
This may be neededo on MacOS for avoiding illegal hardware instruction
issue: npm install speaker --mpg123-backend=openal
CLI
USAGE
$ tts-narrator [FILE]
ARGUMENTS
FILE path to the script file (.yml)
OPTIONS
-d, --debug output debug information
-h, --help show CLI help
-i, --interactive wait for key press before start
playing next paragraph
-k, --subscription-key=subscription-key Azure Speech service subscription
key
-o, --overwrite always overwrite previously
generated audio files
-p, --[no-]play play generated audio
-r, --region=region region of the text-to-speech
service
-s, --service=azure text-to-speech service to use
-v, --version show CLI version
--chapters=chapters list of chapters to process,
examples: "1-10,13,15", "4-"
--dry-run don't try to generate or play
audio
--sections=sections list of sections to process,
examples: "1-10,13,15", "5-"
--ssml display generated SSML
--subscription-key-env=subscription-key-env Name of the environment variable
that holds the subscription key
EXAMPLE
tts-narrator myscript.yml --play --interactive --service azure
--subscription-key-env SUBSCRIPTION_KEY --region australiaeast
API
tts-narrator
tts-narrator
Table of contents
Namespaces
Classes
Interfaces
Functions
Functions
getAudioFileDuration
▸ getAudioFileDuration(filePath
): Promise
<number
>
Parameters
Returns
Promise
<number
>
loadScript
▸ loadScript(scriptFilePath
): Promise
<NarrationScript
>
Parameters
Name | Type |
---|
scriptFilePath | string |
Returns
Promise
<NarrationScript
>
playMp3File
▸ playMp3File(filePath
): Promise
<void
>
Parameters
Returns
Promise
<void
>
saveScript
▸ saveScript(script
): Promise
<void
>
Parameters
Returns
Promise
<void
>
▸ saveScript(script
, scriptFilePath
): Promise
<void
>
Parameters
Name | Type |
---|
script | Script |
scriptFilePath | string |
Returns
Promise
<void
>
Classes
tts-narrator / AzureTtsService
Class: AzureTtsService
Hierarchy
Table of contents
Constructors
Methods
Constructors
constructor
• new AzureTtsService()
Inherited from
BaseTtsService.constructor
Methods
buildSpeakStartTag
▸ Protected
buildSpeakStartTag(voiceSettings
): string
Parameters
Returns
string
Overrides
BaseTtsService.buildSpeakStartTag
generateAudio
▸ generateAudio(ssml
, options
): Promise
<any
>
Parameters
Returns
Promise
<any
>
Overrides
BaseTtsService.generateAudio
generateSSML
▸ generateSSML(paragraph
): Promise
<string
>
Parameters
Returns
Promise
<string
>
Inherited from
BaseTtsService.generateSSML
generateSsmlWithoutValidation
▸ Protected
generateSsmlWithoutValidation(paragraph
): Object
Parameters
Returns
Object
Name | Type |
---|
lineOffset | number |
ssml | string |
Inherited from
BaseTtsService.generateSsmlWithoutValidation
validateXML
▸ Protected
validateXML(xml
, lineOffset
): void
Parameters
Name | Type |
---|
xml | string |
lineOffset | number |
Returns
void
Inherited from
BaseTtsService.validateXML
tts-narrator / BaseTtsService
Class: BaseTtsService
Hierarchy
Implements
Table of contents
Constructors
Methods
Constructors
constructor
• new BaseTtsService()
Methods
buildSpeakStartTag
▸ Protected
buildSpeakStartTag(voiceSettings
): string
Parameters
Returns
string
generateAudio
▸ generateAudio(_ssml
, _options
): Promise
<void
>
Parameters
Returns
Promise
<void
>
Implementation of
TtsService.generateAudio
generateSSML
▸ generateSSML(paragraph
): Promise
<string
>
Parameters
Returns
Promise
<string
>
Implementation of
TtsService.generateSSML
generateSsmlWithoutValidation
▸ Protected
generateSsmlWithoutValidation(paragraph
): Object
Parameters
Returns
Object
Name | Type |
---|
lineOffset | number |
ssml | string |
validateXML
▸ Protected
validateXML(xml
, lineOffset
): void
Parameters
Name | Type |
---|
xml | string |
lineOffset | number |
Returns
void
tts-narrator / NarrationChapter
Class: NarrationChapter
Implements
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new NarrationChapter(chapter
, index
, script
)
Parameters
Properties
chapter
• Protected
chapter: Chapter
index
• index: number
script
• script: NarrationScript
sections
• sections: NarrationSection
[]
Implementation of
Chapter.sections
Accessors
key
• get
key(): string
Returns
string
Implementation of
Chapter.key
Methods
getSectionByKey
▸ getSectionByKey(key
): undefined
| NarrationSection
Parameters
Returns
undefined
| NarrationSection
tts-narrator / NarrationParagraph
Class: NarrationParagraph
Implements
Table of contents
Constructors
Properties
Accessors
Constructors
constructor
• new NarrationParagraph(paragraph
, index
, section
, chapter
, script
)
Parameters
Properties
chapter
• chapter: NarrationChapter
index
• index: number
paragraph
• Protected
paragraph: Paragraph
script
• script: NarrationScript
section
• section: NarrationSection
Accessors
key
• get
key(): string
Returns
string
Implementation of
Paragraph.key
settings
• get
settings(): VoiceSettings
Returns
VoiceSettings
Implementation of
Paragraph.settings
text
• get
text(): string
Returns
string
Implementation of
Paragraph.text
tts-narrator / NarrationScript
Class: NarrationScript
Implements
Table of contents
Constructors
Properties
Accessors
Methods
Constructors
constructor
• new NarrationScript(script
, scriptFilePath
)
Parameters
Name | Type |
---|
script | Script |
scriptFilePath | string |
Properties
chapters
• chapters: NarrationChapter
[]
Implementation of
Script.chapters
script
• Protected
script: Script
scriptFilePath
• scriptFilePath: string
Accessors
settings
• get
settings(): ScriptSettings
Returns
ScriptSettings
Implementation of
Script.settings
Methods
export
▸ export(): Script
Returns
Script
getChapterByKey
▸ getChapterByKey(key
): undefined
| NarrationChapter
Parameters
Returns
undefined
| NarrationChapter
tts-narrator / NarrationSection
Class: NarrationSection
Implements
Table of contents
Constructors
Properties
Accessors
Constructors
constructor
• new NarrationSection(section
, index
, chapter
, script
)
Parameters
Properties
chapter
• chapter: NarrationChapter
index
• index: number
paragraphs
• paragraphs: NarrationParagraph
[]
Implementation of
Section.paragraphs
script
• script: NarrationScript
section
• Protected
section: Section
Accessors
key
• get
key(): string
Returns
string
Implementation of
Section.key
Interfaces
tts-narrator / AudioGenerationOptions
Interface: AudioGenerationOptions
Hierarchy
Table of contents
Properties
Properties
outputFilePath
• outputFilePath: string
tts-narrator / AzureAudioGenerationOptions
Interface: AzureAudioGenerationOptions
Hierarchy
Table of contents
Properties
Properties
outputFilePath
• outputFilePath: string
Inherited from
AudioGenerationOptions.outputFilePath
serviceRegion
• Optional
serviceRegion: string
subscriptionKey
• Optional
subscriptionKey: string
tts-narrator / NarrationScriptFile / Chapter
Interface: Chapter
NarrationScriptFile.Chapter
Implemented by
Table of contents
Properties
Properties
key
• Optional
key: string
sections
• sections: Section
[]
tts-narrator / NarrationScriptFile / Paragraph
Interface: Paragraph
NarrationScriptFile.Paragraph
Implemented by
Table of contents
Properties
Properties
key
• Optional
key: string
settings
• Optional
settings: VoiceSettings
text
• text: string
tts-narrator / NarrationScriptFile / Script
Interface: Script
NarrationScriptFile.Script
Implemented by
Table of contents
Properties
Properties
chapters
• chapters: Chapter
[]
settings
• settings: ScriptSettings
tts-narrator / NarrationScriptFile / Section
Interface: Section
NarrationScriptFile.Section
Implemented by
Table of contents
Properties
Properties
key
• Optional
key: string
paragraphs
• paragraphs: Paragraph
[]
tts-narrator / ScriptSettings
Interface: ScriptSettings
Table of contents
Properties
Properties
voice
• Optional
voice: VoiceSettings
tts-narrator / TtsService
Interface: TtsService
Implemented by
Table of contents
Methods
Methods
generateAudio
▸ generateAudio(ssml
, options
): Promise
<void
>
Parameters
Returns
Promise
<void
>
generateSSML
▸ generateSSML(paragraph
): Promise
<string
>
Parameters
Returns
Promise
<string
>
tts-narrator / VoiceSettings
Interface: VoiceSettings
Table of contents
Properties
Properties
language
• Optional
language: string
name
• Optional
name: string
Modules
tts-narrator / NarrationScriptFile
Namespace: NarrationScriptFile
Table of contents
Interfaces