add support for ibm speech credentials, and test for ibm tts (#82)

* add support for ibm speech credentials, and test for ibm tts

* add stt testing for ibm watson
This commit is contained in:
Dave Horton
2022-11-21 21:16:26 -05:00
committed by GitHub
parent 5be286d3db
commit 5e070324ae
5 changed files with 1460 additions and 64 deletions
+32 -1
View File
@@ -179,6 +179,35 @@ const testWellSaidTts = async(logger, credentials) => {
}
};
const testIbmTts = async(logger, getTtsVoices, credentials) => {
const {tts_api_key, tts_region} = credentials;
const voices = await getTtsVoices({vendor: 'ibm', credentials: {api_key: tts_api_key, region: tts_region}});
return voices;
};
const testIbmStt = async(logger, credentials) => {
const {stt_api_key, stt_region} = credentials;
const SpeechToTextV1 = require('ibm-watson/speech-to-text/v1');
const { IamAuthenticator } = require('ibm-watson/auth');
const speechToText = new SpeechToTextV1({
authenticator: new IamAuthenticator({
apikey: stt_api_key
}),
serviceUrl: `https://api.${stt_region}.speech-to-text.watson.cloud.ibm.com`
});
return new Promise((resolve, reject) => {
speechToText.listModels()
.then((speechModels) => {
logger.debug({speechModels}, 'got IBM speech models');
return resolve();
})
.catch((err) => {
logger.info({err}, 'failed to get speech models');
reject(err);
});
});
};
const testWellSaidStt = async(logger, credentials) => {
//TODO
return true;
@@ -195,5 +224,7 @@ module.exports = {
testWellSaidStt,
testNuanceTts,
testNuanceStt,
testDeepgramStt
testDeepgramStt,
testIbmTts,
testIbmStt
};