Implement api.output, announcevoice command, a bunch of other tts shit, etc etc etc buh
This commit is contained in:
@@ -5,7 +5,12 @@ module.exports=class {
|
||||
this.longName=longName;
|
||||
this.fileExtension=fileExtension;
|
||||
}
|
||||
async getSpeech(text, voice, params) {}
|
||||
getInternalVoiceName(str) {
|
||||
return this.voices?this.voices[str]:str;
|
||||
}
|
||||
getDefaultVoice() {}
|
||||
validateVoice(voice) {return this.voices ? this.voices[voice] : true;}
|
||||
async getSpeech(text, voice=this.getDefaultVoice(), params) {}
|
||||
async getSpeechFile(text, filepath, voice, params) {
|
||||
const data = await this.getSpeech(text, voice, params);
|
||||
const contents = await data.arrayBuffer();
|
||||
|
@@ -5,7 +5,10 @@ module.exports=class extends BaseEngine {
|
||||
constructor() {
|
||||
super('ESpeak','wav')
|
||||
}
|
||||
async getSpeechFile(text, filepath, voice='en', params={}) {
|
||||
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);
|
||||
}
|
||||
|
@@ -6,7 +6,10 @@ module.exports= class extends BaseEngine {
|
||||
constructor() {
|
||||
super("Google Translate TTS","mp3");
|
||||
}
|
||||
async getSpeech(text, voice='en-us', params={}) {
|
||||
getDefaultVoice() {
|
||||
return 'en-us';
|
||||
}
|
||||
async getSpeech(text, voice=this.getDefaultVoice(), params={}) {
|
||||
const url = tts.getAudioUrl(text, {lang: voice});
|
||||
return fetch(url);
|
||||
}
|
||||
|
@@ -5,9 +5,17 @@ const querystring = require('querystring');
|
||||
module.exports= class extends BaseEngine {
|
||||
constructor() {
|
||||
super("IBM Watson TTS","ogg");
|
||||
this.voices={
|
||||
'Michael': 'en-US_MichaelV3Voice',
|
||||
'Allison': 'en-US_AllisonV3Voice',
|
||||
'Kevin': 'en-US_KevinV3Voice',
|
||||
};
|
||||
}
|
||||
async getSpeech(text, voice='en-us', params={}) {
|
||||
const url = process.env.watsonURL+"/v1/synthesize";
|
||||
getDefaultVoice() {
|
||||
return 'Michael';
|
||||
}
|
||||
async getSpeech(text, voice=this.getSpeechVoice(), params={}) {
|
||||
const url = process.env.watsonURL+"/v1/synthesize?voice="+this.getInternalVoiceName(voice);
|
||||
let buff=new Buffer('apikey:'+process.env.watsonAPIKey);
|
||||
let b64auth=buff.toString('base64');
|
||||
const authorization='Basic '+b64auth;
|
||||
|
Reference in New Issue
Block a user