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

voice-rss

v3.0.0

Published

An API wrappers for the Voice RSS Text-To-Speech API

Downloads

9

Readme

An API wrapper for the Voice RSS Text-To-Speech API

npm npm bundle size npm

The Voice RSS Text-To-Speech API creates a high quality audio stream with a very simple implementation. This npm module is a wrapper for this API to make it easy to implement in your Node or JavaScript projects.

Table of contents:

Quickstart

Before you begin

  1. Setup an API key

Installing the client library

// npm
npm install voice-rss --save-dev

// yarn
yarn add voice-rss --dev

Initiate the client library

// Imports the Voice RSS client library: es6 import (alternative 1)
import VoiceRSSWebApi from './voice-rss-api';

// Imports the Voice RSS client library: require (alternative 2)
const VoiceRSSWebApi = require('./voice-rss-api');

// Instantiates the client
const VoiceRSS = new VoiceRSSWebApi();
VoiceRSS.setApiKey('API_KEY');

// Instantiates the client with an api key
const VoiceRSS = new VoiceRSSWebApi('API_KEY');

Using the client library

Here are three examples of how to use the client library

// callback implementation
// the second argument is the options
// see "Default options" section below for available options and for setting options all at once
// see "Setting options" section below to set options one by one
VoiceRSS.getAudio('Hello World', {}, (err, audio) => {
    if (err) console.error(err);
    else new Audio(audio).play();
});

// promise implementation
// you can pass the options as the second argument, as in the callback implementation
VoiceRSS.getAudio('Hello World')
    .then(audio => new Audio(audio).play())
    .catch(error => console.log(error));

// async/await implementation
// you can pass the options as the second argument, as in the callback implementation
(async () => {
    const audio = await VoiceRSS.getAudio('Hello World');
    
    // play the audio
    new Audio(audio).play();
    
    // OR console log the audio (base64 encoding)
    console.log(audio);
})();
Setting options
VoiceRSS.setApiKey('API_KEY');
VoiceRSS.setLanguage('en-us');
VoiceRSS.setSpeechRate(0);
VoiceRSS.setAudioCodec('auto');
VoiceRSS.setAudioFormat('44khz_16bit_stereo');
VoiceRSS.setSSML(false);
VoiceRSS.setB64(false);
Getting options
VoiceRSS.getApiKey();
VoiceRSS.getLanguage();
VoiceRSS.getSpeechRate();
VoiceRSS.getAudioCodec();
VoiceRSS.getAudioFormat();
VoiceRSS.getSSML();
VoiceRSS.getB64();
Default options
const options = {
    hl: 'en-us',
    r: 0,
    c: 'mp3',
    f: '44khz_16bit_stereo',
    ssml: false,
    b64: false,
};
Available options

All of the available options can be found in the official documentation

Versioning

This library follows Semantic Versioning.

Contributing

Contributions welcome! See the Contributing Guide.

License

MIT

See LICENSE

To Do

  • [ ] 100% test coverage
  • [ ] Implement typescript
  • [ ] Minimize bundle size