Skip to content

Instantly share code, notes, and snippets.

@maxogden

maxogden/index.js

Created Jul 11, 2019
Embed
What would you like to do?
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
You can’t perform that action at this time.