0.1.0 • Published 11 years ago

neospeech v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
11 years ago

NeoSpeech

neospeech is a client library for NeoSpeech TTS written in Node.js.

Dependencies

  • ffmpeg
  • libmp3lame for mp3
  • libvorbis for ogg

Refer to Installing FFmpeg section for more details.

Installation

$ npm install neospeech

Usage

var neospeech = new (require('neospeech'))({
  // host: '127.0.0.1',
  // port: 7000
});

API

Convenience Functions

neospeech.bridget(TEXT, OUT_PATH, function (err, result) {});
neospeech.hui(TEXT, OUT_PATH, function (err, result) {});
neospeech.julie(TEXT, OUT_PATH, function (err, result) {});
neospeech.junwoo(TEXT, OUT_PATH, function (err, result) {});
neospeech.kate(TEXT, OUT_PATH, function (err, result) {});
neospeech.liang(TEXT, OUT_PATH, function (err, result) {});
neospeech.misaki(TEXT, OUT_PATH, function (err, result) {});
neospeech.paul(TEXT, OUT_PATH, function (err, result) {});
neospeech.show(TEXT, OUT_PATH, function (err, result) {});
neospeech.violeta(TEXT, OUT_PATH, function (err, result) {});
neospeech.yumi(TEXT, OUT_PATH, function (err, result) {});

Request Buffer

neospeech.requestBuffer({
  text: TEXT,                 // default: ''
  speakerId: SPEAKER_ID,      // default: 'JULIE'
  voiceFormat: VOICE_FORMAT,  // default: 'DEFAULT'
  all: ALL                    // default: true, required: voiceFormat='PCM','MULAW','ALAW'
}, function (err, result) {
  // result.code
  // result.message
  // result.buffer (if value exists)
  // result.sockfd (if value exists)
});

Request Buffer Ex

neospeech.requestBufferEx({
  text: TEXT,                 // default: ''
  speakerId: SPEAKER_ID,      // default: 'JULIE'
  voiceFormat: VOICE_FORMAT,  // default: 'DEFAULT'
  textFormat: TEXT_FORMAT,    // default: 'NORMAL'
  volume: VOLUME,             // default: 100, valid: 0-500
  speed: SPEED,               // default: 100, valid: 50-400
  pitch: PITCH,               // default: 100, valid: 50-200
  dictNum: DICT_NUM,          // default: 1
  all: ALL                    // default: true, required: voiceFormat='PCM','MULAW','ALAW'
}, function (err, result) {
  // result.code
  // result.message
  // result.buffer (if value exists)
  // result.sockfd (if value exists)
});

Request Buffer SSML Ex

neospeech.requestBufferSSMLEx({
  text: TEXT,                 // default: ''
  speakerId: SPEAKER_ID,      // default: 'JULIE'
  voiceFormat: VOICE_FORMAT,  // default: 'PCM', valid: 'PCM','MULAW','ALAW'
  volume: VOLUME,             // default: 100, valid: 0-500
  speed: SPEED,               // default: 100, valid: 50-400
  pitch: PITCH,               // default: 100, valid: 50-200
  dictNum: DICT_NUM           // default: 1
}, function (err, result) {
  // result.code
  // result.message
  // result.marks
  // result.buffer (if value exists)
  // result.sockfd (if value exists)
});

Request File

neospeech.requestFile({
  text: TEXT,                // default: ''
  outPath: OUT_PATH,         // default: 'out'
  speakerId: SPEAKER_ID,     // default: 'JULIE'
  voiceFormat: VOICE_FORMAT  // default: 'DEFAULT'
}, function (err, result) {
  // result.code
  // result.message
});

Request File Ex

neospeech.requestFileEx({
  text: TEXT,                 // default: ''
  outPath: OUT_PATH,          // default: 'out'
  speakerId: SPEAKER_ID,      // default: 'JULIE'
  voiceFormat: VOICE_FORMAT,  // default: 'DEFAULT'
  textFormat: TEXT_FORMAT,    // default: 'NORMAL'
  volume: VOLUME,             // default: 100, valid: 0-500
  speed: SPEED,               // default: 100, valid: 50-400
  pitch: PITCH,               // default: 100, valid: 50-200
  dictNum: DICT_NUM           // default: 1
}, function (err, result) {
  // result.code
  // result.message
});

Request File SSML

neospeech.requestFileSSML({
  text: TEXT,                // default: ''
  outPath: OUT_PATH,         // default: 'out'
  speakerId: SPEAKER_ID,     // default: 'JULIE'
  voiceFormat: VOICE_FORMAT  // default: 'DEFAULT'
}, function (err, result) {
  // result.code
  // result.message
  // result.marks
  // result.voiceLen
});

Request Status

neospeech.requestStatus(function (err, result) {
  // result.code
  // result.message
});

Development

Compiling C++ Binding

$ node-gyp configure && node-gyp build

Installing FFmpeg

Ubuntu

$ apt-get install ffmpeg libavcodec-extra-52
$ apt-get install lame vorbis-tools
$ apt-get install libmp3lame-dev libmpg123-dev

Amazon Linux / Cent OS

yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_src

# yasm
yum install yasm

# libfdk_aac
cd ~/ffmpeg_src
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
autoreconf -fiv
./configure --disable-shared
make
make install
make distclean

# libmp3lame
cd ~/ffmpeg_src
curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz
tar xzvf lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --disable-shared --enable-nasm
make
make install
make distclean

# libogg
cd ~/ffmpeg_src
curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.1.tar.gz
tar xzvf libogg-1.3.1.tar.gz
cd libogg-1.3.1
./configure --disable-shared
make
make install
make distclean

# libvorbis
cd ~/ffmpeg_src
curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
tar xzvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
./configure --disable-shared
make
make install
make distclean

# ffmpeg
cd ~/ffmpeg_src
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-nonfree --enable-pthreads --enable-postproc --enable-libfdk_aac --enable-libmp3lame --enable-libvorbis --enable-filters --enable-runtime-cpudetect
make
make install
make distclean

Credits

See the contributors.

License