capacitor-tts
v0.0.2
Published
This is Ionic Capacitor native Text-To-Speech plugin for IOS & Android
Downloads
12
Readme
Capacitor Text-To-Speech
Platform
- Android
Installation
npm i capacitor-tts
Getting Start
import { TextToSpeech, Local } from 'capacitor-tts';
const tts = new TextToSpeech({
local: Local.US,
rate: 1.0,
pitch: 1.0
});
tts.speak({value: 'Text to speech'})
.then(res => {
console.log(res);
})
.catch(err => {
console.error(err);
})
API
Class
TextToSpeech
Methods
Open Installed text to speech activity
openInstallTts(): Promise<{value: null}>;
Check available languages
checkLanguage(): Promise<{values: string[]}>;
Set voice pitch
setPitch(options: { pitch: number }): Promise<{ value: boolean }>;
Set talking speed
setSpeechRate(options: { rate: number }): Promise<{ value: boolean }>;
Speak from text
speak(options: { text: string }): Promise<{ value: boolean }>;
Stop text to speech engine
stop(): Promise<{ value: boolean }>;
Types
export interface TTSOptions {
local: Local;
rate?: number,
pitch?: number,
}
Enums
export enum Local {
US = 0,
UK = 1,
FRANCE = 2
}