mmir-plugin-speech-nuance-lang
v1.1.1
Published
tools for querying supported languages (ASR and TTS) and voices (TTS) by Nuance / Cerence SpeechKit
Downloads
15
Maintainers
Readme
mmir-plugin-speech-nuance-lang
tools for querying supported languages (ASR and TTS) and voices (TTS) by Nuance / Cerence Speech API
(internally uses mmir-plugin-lang-support)
Intialization
In cordova
module plugin code:
// use corodva's require with exported main module ID:
var langTools = require('mmir-plugin-speech-nuance-lang.languageSupport');
// or global export:
var langTools = window.cordova.plugins.nuanceLanguageSupport.languageSupport;
...
As AMD
module:
// use async require (or specify as define-dependency):
require('mmir-plugin-speech-nuance-lang/dist/languageSupport', function(langTools){
...
});
As CommonJS
module:
// use synchronous require:
var langTools = require('mmir-plugin-speech-nuance-lang').languageSupport;
// or "deep link":
var langTools = require('mmir-plugin-speech-nuance-lang/www/languageSupport');
...
API
Exported functions for querying supported ASR and TTS languages and voices.
/** get list of supported TTS language codes */
langTools.ttsLanguages(): string[];
/** get list of supported TTS voice details (filtered by language code / gender) */
langTools.ttsVoices(langCode?: string, gender?: Gender): LabeledVoiceDetails[];
/** get list of supported TTS voice names (filtered by language code / gender) */
langTools.ttsVoiceNames(langCode?: string, gender?: Gender): string[];
/** get best matching voice result (for language / gender: may return different gender and/or country code, if no matching voice is available) */
langTools.ttsBestVoiceFor(langCode: string, gender?: Gender): VoiceResult;
/** get list of supported ASR language codes */
langTools.asrLanguages(): string [];
/** get best matching voice (for language / gender: may return different gender and/or country code, if no matching voice is available) */
langTools.ttsSelectVoice(langCode: string, query?: Gender | string): LabeledVoiceDetails;
interface VoiceResult {
voice: LabeledVoiceDetails;
language: string;
filter: string;
}
interface LabeledVoiceDetails {
/** the name of the voice */
name: string;
/** a (human readable) label for the voice (if not available, returns same value as the name) */
label: string;
/** the language (code) of the voice */
language: string;
/** the gender of the voice */
gender: "female" | "male" | "unknown";
/** if voice is locally available or requires network/internet access */
local: boolean | undefined;
}
Integration Notes
for usage in cordova-plugins, copy /dist
(AMD), /www
(CommonJS), or /src
(TypeScript)
to the appropriate location in plugin project, e.g. via the exported function
const installFiles = require('mmir-plugin-speech-nuance-lang/install');
installFiles(srcDirType: "dist" | "src" | "www", targetDir: string, callback(err: Error | null))