tardis-bot/tts/espeak/index.js

15 lines
392 B
JavaScript

const BaseEngine=require('../BaseEngine')
const {spawn} = require('child_process')
module.exports=class extends BaseEngine {
constructor() {
super('ESpeak','wav')
}
getDefaultVoice() {
return 'en';
}
async getSpeechFile(text, filepath, voice=this.getDefaultVoice(), params={}) {
let proc=await spawn('espeak', ['-v', voice, '-w',filepath, '--stdin']);
proc.stdin.end(text);
}
}