bugfix: dep in bluebird was causing issue, update to latest synthAudio

This commit is contained in:
Dave Horton
2021-02-10 09:39:20 -05:00
parent f8e84b5ad0
commit a7e0fb2e8a
5 changed files with 46 additions and 24 deletions

View File

@@ -21,26 +21,26 @@ class TaskSay extends Task {
this.ep = ep;
try {
// synthesize all of the text elements
const filepath = (await Promise.all(this.text.map(async(text) => {
const fp = await synthAudio({
const files = (await Promise.all(this.text.map(async(text) => {
const {filePath} = await synthAudio({
text,
vendor: this.synthesizer.vendor || cs.speechSynthesisVendor,
language: this.synthesizer.language || cs.speechSynthesisLanguage,
voice: this.synthesizer.voice || cs.speechSynthesisVoice,
salt: cs.callSid
}).catch((err) => this.logger.error(err, 'Error synthesizing text'));
if (fp) cs.trackTmpFile(fp);
return fp;
if (filePath) cs.trackTmpFile(filePath);
return filePath;
})))
.filter((fp) => fp && fp.length);
this.logger.debug({filepath}, 'synthesized files for tts');
this.logger.debug({files}, 'synthesized files for tts');
while (!this.killed && this.loop-- && this.ep.connected) {
let segment = 0;
do {
await ep.play(filepath[segment]);
} while (!this.killed && ++segment < filepath.length);
await ep.play(files[segment]);
} while (!this.killed && ++segment < files.length);
}
} catch (err) {
this.logger.info(err, 'TaskSay:exec error');