@shooontan/voicetext
v0.0.2
Published
VoiceText Web API Client for Node.js
Downloads
3
Readme
@shooontan/voicetext
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 Formatwav
ogg
mp3
- emotion: string
- emotion_level: string
- pitch: number
- speaker: number
- volume: number
- format:
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
.