@bougiel/tts-node
TypeScript icon, indicating that this package has built-in type declarations

1.6.1 • Public • Published

tts-node

Introduction

A node js package used to convert SSML(Speech Synthesis Markup Language) to voice via microsoft azure tts.

Installation

npm i @bougiel/tts-node -S

Usage

import fs from "fs";
import { textToSsml, ssmlToStream } from "@bougiel/tts-node";

const writeStream = fs.createWriteStream("./foo.mp3");

textToSsml("Hello world").then((stream) => {
  stream.pipe(wirteStream);
});

writeStream.on("finish", () => {
  console.log(`download success`);
  process.exit(0);
});

stream.on("error", (error) => {
  console.error("download failed", error);
});

Documentation

  • textToSsml

Convert text to ssml with configuration.

function textToSsml(
  text: string,
  options?: {
    voice?: string; // default "general"
    style?: string; // default "zh-CN-XiaoxiaoNeural"
    rate?: string; // default "0%"
    pitch?: string; // default "0%"
  }
): string;
  • ssmlToText

Remove ssml markup.

function ssmlToText(ssml: string): string;
  • voices

The collection of usable voices

type Voice = {
  Name: string;
  DisplayName: string;
  LocalName: string;
  ShortName: string;
  Gender: string;
  Locale: string;
  LocaleName: string;
  SampleRateHertz: string;
  VoiceType: string;
  Status: string;
  WordsPerMinute: string;
};
  • ssmlToStream

Convert ssml to Stream.Transform

function ssmlToStream(ssml: string): Stream.Transform

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @bougiel/tts-node

Weekly Downloads

2

Version

1.6.1

License

MIT

Unpacked Size

649 kB

Total Files

35

Last publish

Collaborators

  • bougie