Created
July 11, 2019 20:01
-
-
Save max-mapper/3dc22a64a2747e4372e5e62d8089e65c to your computer and use it in GitHub Desktop.
jtalk cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/home/max/.nvm/versions/node/v0.12.18/bin/node | |
var fs = require('fs'); | |
var Speaker = require('speaker'); // version 0.3.0 | |
var OpenJTalk = require('node-openjtalk').OpenJTalk; | |
console.log(process.argv[2]) | |
// pre-included HTS voice file | |
var fn_voice = OpenJTalk.voices.mei_normal; | |
// instantiate OpenJTalk with an HTS voice | |
var open_jtalk = new OpenJTalk({voice: fn_voice}); | |
// synthesize a voice synchronously | |
var buffer = open_jtalk.synthesizeSync(process.argv[2], function(option) { | |
return { | |
speed: option.speed / 1.5 | |
}; | |
}); | |
// flush to node-speaker | |
var speaker = new Speaker({ | |
channels: 1, | |
bitDepth: 16, | |
sampleRate: 48000 | |
}); | |
speaker.end(buffer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment