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 🙏

© 2025 – Pkg Stats / Ryan Hefner

n-speech

v1.0.7

Published

nSpeech is screen reader javascript library (TTS).

Readme

nSpeech Build Status Dependency Status npm version MIT License

nSpeech is screen reader library (TTS).
nSpeechはWeb Speech APIを使用した、スクリーンリーダーライブラリです (TTS)。

Install

$ npm install n-speech

Usage

  • Include nSpeech.js before </body>.
    </body>の前にnSpeech.jsを追加します。

  • Please add ".speech" to any tags of the sentence you want to read.
    読み上げたい文章のタグに".speech"を追加してください。

<body>
<p class="speach">The sentence is read.</p>
<p class="speach">この文章が読まれます。</p>

<button type="button" id="play" class="button">Play</button>
<button type="button" id="pause" class="button">Pause</button>

<script  src="js/nSpeech.js"></script>
<script>
  var speech = new nSpeech();
  var play = document.getElementById('play');
  var stop = document.getElementById('stop');

  play.addEventListener('click', function(){
    speech.play();
  });

  stop.addEventListener('click', function(){
    speech.stop();
  });
</script>
</body>

Selector and Options defined

  • The selector and options can be defined to this.
    セレクタとオプションを定義することができます。
// In this case is ID.
// Other case is class and tag. (ex: '.speech', 'p')
var example_id = new nSpeech('#example_id');

var example_class = new nSpeech('.example_class');

var example_tag = new nSpeech('p');

var example_option = new nSpeech({ lang: 'ja-JP' });

var example_id_option = new nSpeech('#example_id_option', {
  lang: 'ja-JP'
});

Override the text selection

  • Able to read the override selected text by drag.
    ドラッグで選択したテキストを読むことができます。

Create select with voice list

  • Able to create select with voice list.
    音声リストをselectに出力することができます。
<body>
<select id="voiceSelect"></select>

<script  src="js/nSpeech.js"></script>
<script>
  var speech = new nSpeech({
    selectId: "voiceSelect" // Create select voice list.
  });
</script>
</body>

Options

// default options
var options = {

  // This is spoken the language. ex: 'en-US'.
  lang    : "",
  
  // This will insert an object from the voice
  voice   : null,
  
  // Speech volume.
  volume  : 1,
  
  // Speech rate. Speech gets faster if increase.
  rate    : 1,
  
  // Speech pitch. Speech gets shrill voice if increase
  pitch   : 1,
  
  // Read this text.
  text    : "",
  
  // Create option elements in this id.
  selectId      : "",

  // Create this elements in selectId.
  selectElement : "option",

  // callback methods
  onend   : function() { return undefined; },
  onstart : function() { return undefined; },
  onerror : function() { return undefined; },
  onmark  : function() { return undefined; },

  // Debug mode.
  debug   : false
};
var speech = new nSpeech(options);

Methods

  • The following methods are available.
    以下のメソッドが使えます。
var speech = new nSpeech();

// play
speech.play();

// pause
speech.pause();

// resume
// Start when paused.
speech.resume();

// stop
speech.stop();


////////////////
// change options.
////////////////

// replace text
speech.replaceText("Replace text");

// replace voice
speech.changeVoice("ja-JP");

// change volume
speech.changeVolume(1);

// change rate
speech.changeRate(1);

// change pitch
speech.changePitch(1);

Events

  • The following callback Methods are available.
    以下のコールバックメソッドが使えます。
var speech = new nSpeech();

// Fired when the spoken utterance reaches a word or sentence boundary.
speech.onboundary(function(){
  console.log("onboundary");
});

// Fire when finish.
speech.onend = (function(){
  console.log("onend");
});

// Fire when an error occurs.
speech.onerror = (function(){
  console.log("onerror");
});

// Fired when the spoken utterance reaches a named SSML "mark" tag.
speech.onmark = (function(){
  console.log("onmark");
});

// Fire when pause.
speech.onpause = (function(){
  console.log("onpause");
});

// Fire when resume.
speech.onresume =(function(){
  console.log("onresume");
});

// Fire when start.
speech.onstart = (function(){
  console.log("onstart");
});

Browser

| Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) | |---|---|---|---|---|---| | 33 | (Yes) | 49 (49) | No support | ? | 7 |

License

Released under the MIT License. See the LICENSE file for details

Change Log

2017.10.19 - v1.0.7
  • Add change voice method.
  • Add method to create select by voice list.
  • Add method to text adjust. This is that insert to a paragraph in no have period.
2017.10.16 - v1.0.4
  • Linted
2017.10.11 - v1.0.3
  • playSelection integrate to play.
  • Add change voice options.
  • Supported in input and textarea.
2017.10.10 - v1.0.2
  • Add other callback methods. onboundary, onpause, onresume.
2017.10.06 - v1.0.1
  • Supported the override text selection.