1.6.1 • Published 2 years ago

@bougiel/tts-node v1.6.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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

1.6.1

2 years ago

1.6.0

2 years ago

1.5.0

2 years ago

1.3.0

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago