mirror of
https://github.com/jambonz/speech-utils.git
synced 2026-07-24 21:22:00 +00:00
wip
This commit is contained in:
+5
-5
@@ -86,7 +86,7 @@ const trimTrailingSilence = (buffer) => {
|
||||
*/
|
||||
async function synthAudio(client, createHash, retrieveHash, logger, stats, { account_sid,
|
||||
vendor, language, voice, gender, text, engine, salt, model, credentials, deploymentId,
|
||||
disableTtsCache, renderForCaching, disableTtsStreaming, options, preCache = false
|
||||
disableTtsCache, renderForCaching = false, disableTtsStreaming, options
|
||||
}) {
|
||||
let audioBuffer;
|
||||
let servedFromCache = false;
|
||||
@@ -165,7 +165,7 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
||||
voice: voice || deploymentId,
|
||||
engine,
|
||||
text,
|
||||
preCache: true
|
||||
renderForCaching: true
|
||||
});
|
||||
|
||||
const key = makeSynthKey({
|
||||
@@ -175,10 +175,10 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
||||
voice: voice || deploymentId,
|
||||
engine,
|
||||
text,
|
||||
preCache
|
||||
renderForCaching
|
||||
});
|
||||
let filePath;
|
||||
filePath = makeFilePath({vendor, key, salt, preCache});
|
||||
filePath = makeFilePath({vendor, key, salt, renderForCaching});
|
||||
debug(`synth key is ${key}`);
|
||||
let cached;
|
||||
if (!disableTtsCache) {
|
||||
@@ -187,7 +187,7 @@ async function synthAudio(client, createHash, retrieveHash, logger, stats, { acc
|
||||
cached = await client.get(preCachekey);
|
||||
if (cached) {
|
||||
// Precache audio is available update filpath with precache file extension.
|
||||
filePath = makeFilePath({vendor, key, salt, preCache: true});
|
||||
filePath = makeFilePath({vendor, key, salt, renderForCaching: true});
|
||||
} else {
|
||||
cached = await client.get(key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user