capacitor-tts
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

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
}

Readme

Keywords

Package Sidebar

Install

npm i capacitor-tts

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

494 kB

Total Files

122

Last publish

Collaborators

  • rahadur