Add sam as speech synth
parent
a27d68ec92
commit
43d7f60a7a
|
@ -26,6 +26,6 @@ module.exports = function (bot, api) {
|
|||
str = printf(api.strings.USER_JOINED, username);
|
||||
}
|
||||
api.queue.add(__dirname + "/sysmsg.wav");
|
||||
api.speak(channel, str);
|
||||
api.queue.add(channel, str);
|
||||
})
|
||||
}
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
"node-google-translate-skidz": "^1.1.2",
|
||||
"opusscript": "^0.0.8",
|
||||
"printf": "^0.6.1",
|
||||
"sam-js": "^0.1.2",
|
||||
"sha1": "^1.1.1",
|
||||
"sqlite": "^4.0.21",
|
||||
"sqlite3": "^5.0.2"
|
||||
"sqlite3": "^5.0.2",
|
||||
"wavefile": "^11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@angular/common": {
|
||||
|
@ -1830,6 +1832,15 @@
|
|||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"node_modules/sam-js": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sam-js/-/sam-js-0.1.2.tgz",
|
||||
"integrity": "sha512-xK9BrzJGfKVsbteyXGUMlYyJPI1RKDZEqD3KRT1PSBhZ5YDfxkKLpeWeN7RIu3/zbHHyW4lisqCcRbugygT4jg==",
|
||||
"engines": {
|
||||
"node": ">= 4.0.0",
|
||||
"yarn": ">= 1.17.3"
|
||||
}
|
||||
},
|
||||
"node_modules/sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
|
@ -2084,6 +2095,17 @@
|
|||
"extsprintf": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/wavefile": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wavefile/-/wavefile-11.0.0.tgz",
|
||||
"integrity": "sha512-/OBiAALgWU24IG7sC84cDO/KfFuvajWc5Uec0oV2zrpOOZZDgGdOwHwgEzOrwh8jkubBk7PtZfQBIcI1OaE5Ng==",
|
||||
"bin": {
|
||||
"wavefile": "bin/wavefile.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
|
@ -3649,6 +3671,11 @@
|
|||
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"sam-js": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/sam-js/-/sam-js-0.1.2.tgz",
|
||||
"integrity": "sha512-xK9BrzJGfKVsbteyXGUMlYyJPI1RKDZEqD3KRT1PSBhZ5YDfxkKLpeWeN7RIu3/zbHHyW4lisqCcRbugygT4jg=="
|
||||
},
|
||||
"sax": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||
|
@ -3853,6 +3880,11 @@
|
|||
"extsprintf": "^1.2.0"
|
||||
}
|
||||
},
|
||||
"wavefile": {
|
||||
"version": "11.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wavefile/-/wavefile-11.0.0.tgz",
|
||||
"integrity": "sha512-/OBiAALgWU24IG7sC84cDO/KfFuvajWc5Uec0oV2zrpOOZZDgGdOwHwgEzOrwh8jkubBk7PtZfQBIcI1OaE5Ng=="
|
||||
},
|
||||
"which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
"node-google-translate-skidz": "^1.1.2",
|
||||
"opusscript": "^0.0.8",
|
||||
"printf": "^0.6.1",
|
||||
"sam-js": "^0.1.2",
|
||||
"sha1": "^1.1.1",
|
||||
"sqlite": "^4.0.21",
|
||||
"sqlite3": "^5.0.2"
|
||||
"sqlite3": "^5.0.2",
|
||||
"wavefile": "^11.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
const BaseEngine = require('../BaseEngine')
|
||||
const Sam = require('sam-js');
|
||||
const wavefile = require('wavefile');
|
||||
const fs = require('fs');
|
||||
|
||||
module.exports = class extends BaseEngine {
|
||||
constructor() {
|
||||
super('sam', 'Software Automatic Mouth', 'wav')
|
||||
}
|
||||
getDefaultVoice() {
|
||||
return 'en';
|
||||
}
|
||||
async getSpeechFile(text, filepath, voice = this.getDefaultVoice(), params = {}) {
|
||||
let sam = new samjs();
|
||||
const buf = sam.buf8(text);
|
||||
const file = new wavefile.WaveFile();
|
||||
file.fromScratch(1, 22050, 8, buf);
|
||||
fs.writeFileSync(filepath, file.toBuffer());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue