support whisper tts (#255)

* support whisper tts

* wip

* update speech util version
This commit is contained in:
Hoan Luu Huu
2023-11-09 08:38:06 -05:00
committed by GitHub
parent 43344ae14b
commit 1b143f6aae
4 changed files with 293 additions and 12 deletions
+23 -1
View File
@@ -228,6 +228,23 @@ const testElevenlabs = async(logger, credentials) => {
}
};
const testWhisper = async(logger, synthAudio, credentials) => {
try {
await synthAudio({increment: () => {}, histogram: () => {}},
{
vendor: 'whisper',
credentials,
language: 'en-US',
voice: 'alloy',
text: 'Hi there and welcome to jambones!'
}
);
} catch (err) {
logger.info({err}, 'synthEvenlabs returned error');
throw err;
}
};
const testIbmTts = async(logger, getTtsVoices, credentials) => {
const {tts_api_key, tts_region} = credentials;
const voices = await getTtsVoices({vendor: 'ibm', credentials: {tts_api_key, tts_region}});
@@ -386,6 +403,10 @@ function decryptCredential(obj, credential, logger, isObscureKey = true) {
} else if ('assemblyai' === obj.vendor) {
const o = JSON.parse(decrypt(credential));
obj.api_key = isObscureKey ? obscureKey(o.api_key) : o.api_key;
} else if ('whisper' === obj.vendor) {
const o = JSON.parse(decrypt(credential));
obj.api_key = isObscureKey ? obscureKey(o.api_key) : o.api_key;
obj.model_id = o.model_id;
}
}
@@ -407,5 +428,6 @@ module.exports = {
testElevenlabs,
testAssemblyStt,
getSpeechCredential,
decryptCredential
decryptCredential,
testWhisper
};