npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bestcodes/edge-tts

v1.0.3

Published

An Azure Speech Service module that uses the Microsoft Edge Read Aloud API.

Downloads

217

Readme

:warning: This project is non-functional as it is under development. Do NOT use it.

@bestcodes/edge-tts

npm version

This is a fork.

The original version, here: https://github.com/Migushthe2nd/MsEdgeTTS Was undermaintained and had dependency issues, so I forked the repo and fixed them.

An simple Azure Speech Service module that uses the Microsoft Edge Read Aloud API.

Only supports speak, voice, and prosody element types. The following is the default SSML object:

<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xmlns:mstts="https://www.w3.org/2001/mstts"
       xml:lang="${this._voiceLang}">
    <voice name="${voiceName}">
        <prosody rate="${rate}" pitch="${pitch}" volume="${volume}">
            ${input}
        </prosody>
    </voice>
</speak>

Documentation on the SSML format can be found here . All supported audio formats can be found here.

Example usage

Make sure to escape/sanitize your user's input! Use a library like xml-escape.

Write to stream

import { MsEdgeTTS, OUTPUT_FORMAT } from "msedge-tts";

const tts = new MsEdgeTTS();
await tts.setMetadata(
  "en-IE-ConnorNeural",
  OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS
);
const readable = tts.toStream("Hi, how are you?");

readable.on("data", (data) => {
  console.log("DATA RECEIVED", data);
  // raw audio file data
});

readable.on("close", () => {
  console.log("STREAM CLOSED");
});

Write to file

import { MsEdgeTTS, OUTPUT_FORMAT } from "msedge-tts";

(async () => {
  const tts = new MsEdgeTTS();
  await tts.setMetadata(
    "en-US-AriaNeural",
    OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS
  );
  const filePath = await tts.toFile("./example_audio.webm", "Hi, how are you?");
})();

Change voice rate, pitch and volume

import { MsEdgeTTS, OUTPUT_FORMAT } from "msedge-tts";

(async () => {
  const tts = new MsEdgeTTS();
  await tts.setMetadata(
    "en-US-AriaNeural",
    OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS
  );
  const filePath = await tts.toFile(
    "./example_audio.webm",
    "Hi, how are you?",
    { rate: 0.5, pitch: "+200Hz" }
  );
})();

Use an alternative HTTP Agent

Use a custom http.Agent implementation like https-proxy-agent or socks-proxy-agent.

import { SocksProxyAgent } from "socks-proxy-agent";

(async () => {
  const agent = new SocksProxyAgent(
    "socks://your-name%40gmail.com:[email protected]"
  );
  const tts = new MsEdgeTTS(agent);
  await tts.setMetadata(
    "en-US-AriaNeural",
    OUTPUT_FORMAT.WEBM_24KHZ_16BIT_MONO_OPUS
  );
  const filePath = await tts.toFile("./example_audio.webm", "Hi, how are you?");
})();

API

For the full documentation check out the API Documentation.

This library only supports promises.