Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Created July 11, 2019 20:01
Show Gist options
  • Save max-mapper/3dc22a64a2747e4372e5e62d8089e65c to your computer and use it in GitHub Desktop.
Save max-mapper/3dc22a64a2747e4372e5e62d8089e65c to your computer and use it in GitHub Desktop.
jtalk cli
#!/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