@shooontan/voicetext
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@shooontan/voicetext

npm version Build Status

Get audio data from VoiceText Web API.

Install

# npm
$ npm install @shooontan/voicetext

# or yarn
$ yarn add @shooontan/voicetext

Usage

const fs = require('fs');
const voiceText = require('@shooontan/voicetext');

const apiKey = 'VoiceTextAPIKEY';
const vt = voiceText(apiKey);

(async () => {
  const text = 'おやすみ';
  const speaker = 'show';
  const bf1 = await vt.tts(text, speaker); // return Buffer
  const output1 = 'oyasumi.wav';
  fs.writeFile(output1, bf1, 'binary', error => {
    if (error) {
      console.log(error);
    }
  });

  const bf2 = await vt.mp3('ばいばい', 'haruka', {
    emotion: 'happiness',
    pitch: 160
  });
  const output2 = 'byebye.mp3';
  fs.writeFile(output2, bf2, 'binary', error => {
    if (error) {
      console.log(error);
    }
  });
})();

Document

voiceText(apiKey)

const voiceText = require('@shooontan/voicetext');
const vt = voiceText('apiKey');
  • apiKey: string

https://cloud.voicetext.jp/webapi/api_keys/new

vt.tts(text, speaker, [option])

vt.tts(text, speaker, {...})
  • text: string translated text.
  • speaker: string speaker name.
    • show
    • haruka
    • hikari
    • takeru
    • santa
    • bear
  • option: object
    • format: string data Format
      • wav
      • ogg
      • mp3
    • emotion: string
    • emotion_level: string
    • pitch: number
    • speaker: number
    • volume: number

vt.tts return audio buffer data from VoiceText WebAPI.

vt.wav(text, speaker, [option])

vt.wav(text, speaker, {...})

Same sa vt.tts, but option.format fix wav.

vt.ogg(text, speaker, [option])

vt.ogg(text, speaker, {...})

Same. option.format is ogg.

vt.mp3(text, speaker, [option])

vt.mp3(text, speaker, {...})

Same. option.format is mp3.

VoiceText

VoiceText official site

Readme

Keywords

Package Sidebar

Install

npm i @shooontan/voicetext

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

7.33 kB

Total Files

6

Last publish

Collaborators

  • shooontan