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 🙏

© 2026 – Pkg Stats / Ryan Hefner

openjtalk

v0.1.6

Published

TTS using OpenJTalk

Readme

node-openjtalk : Node.js TTS module using OpenJTalk

これは何?

フリーの日本語音声合成エンジン OpenJTalk を利用する Node.js モジュールです。

動作環境

  • Mac OS X 10.10.1
  • Node.js v0.10.36

インストール

$ npm install openjtalk

テスト

$ npm test

使い方

もっともシンプルなコードは以下になります。

var OpenJTalk = require('openjtalk');
var mei = new OpenJTalk();
mei.talk('こんにちは世界');

.htsvoice のパスと辞書ファイルを含んだディレクトリ、OpenJTalk の設定オプションを引数に渡せます。 引数は省略することもできます。省略した場合は MMDAgent のメイちゃんの声をデフォルトとして喋ります。 音声ファイルを複数用意すれば以下のように喋り分け出来ます。

var OpenJTalk = require('openjtalk');
var mei1 = new OpenJTalk(); // mei_normal を使用
var mei2 = new OpenJTalk({ htsvoice: './voice/mei/mei_angry.htsvoice' });
var mei3 = new OpenJTalk({ htsvoice: './voice/mei/mei_happy.htsvoice' });

mei1.talk('これはテストです'); // コールバックは省略できる
setTimeout(function() {
	mei2.talk('喋り終わり次第コールバックを呼びます', function(err) {
		if (err) console.log('err', err);
		console.log('コールバックを呼ぶ');
		mei3.talk('エラーが発生したらコールバックの引数からチェックできます', function(err) {
			if (err) console.log('err', err);
			else mei1.talk('エラーは発生しませんでした');
		});
	});
}, 2000);

設定値を変える場合は以下のようにします。

var OpenJTalk = require('./openjtalk');
var mei = new OpenJTalk({
	htsvoice        : './voice/mei/mei_normal.htsvoice',
	dic             : './dic/open_jtalk_dic_utf_8-1.08',
	sampling_rate   : 48000,
	pitch           : 220,
	audio_buff_size : 48000,
	alpha           : 0.5,
	beta            : 0.8,
	uv_threshold    : 0.5,
	gv_weight_mgc   : 1.0,
	gv_weight_lf0   : 1.0
});

// 喋る速度を調整することもできます
mei.talk('すっごい速いです', 100, function(err) {
	mei.talk('普通くらいです', 200, function(err) {
		mei.talk('ゆっくり喋るよ', 300);
	});
});

上記がデフォルト値になります。

注意

処理的には、OpenJTalk で wav を生成、それを afplay / aplay で再生、喋り終わったら削除、としているので、しゃべっている途中に中断すると wav ファイルが実行しているディレクトリに残ります。その際は手動で削除して下さい。

詳細

その他詳細は Twitter:@hecomi へご質問いただくか、http://tips.hecomi.com/ をご参照下さい。