Class EmbeddedSpeechConfig
- java.lang.Object
-
- com.microsoft.cognitiveservices.speech.EmbeddedSpeechConfig
-
- All Implemented Interfaces:
AutoCloseable
public final class EmbeddedSpeechConfig extends Object implements AutoCloseable
Class that defines embedded (offline) speech configuration. Note: close() must be called in order to release underlying resources held by the object.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Dispose of associated resources.static EmbeddedSpeechConfigfromPath(String path)Creates an instance of the embedded speech config with a specified offline model path.static EmbeddedSpeechConfigfromPaths(List<String> paths)Creates an instance of the embedded speech config with specified offline model paths.SafeHandlegetImpl()Returns a internal handle to SpeechConfig implementation.StringgetProperty(PropertyId id)Gets the property by propertyId.StringgetProperty(String name)Gets a named property as value.StringgetSpeechRecognitionModelName()Gets the model name for speech recognition.List<SpeechRecognitionModel>getSpeechRecognitionModels()Gets a list of available speech recognition models.OutputFormatgetSpeechRecognitionOutputFormat()Gets the embedded speech recognition output format.StringgetSpeechSynthesisOutputFormat()Gets the embedded speech synthesis output format.StringgetSpeechSynthesisVoiceName()Gets the voice name for embedded speech synthesis.StringgetSpeechTranslationModelName()Gets the model name for speech translation.List<SpeechTranslationModel>getSpeechTranslationModels()Gets a list of available speech translation models.voidsetProfanity(ProfanityOption value)Sets the profanity option.voidsetProperty(PropertyId id, String value)Sets the property by propertyId.voidsetProperty(String name, String value)Sets a named property as value.voidsetSpeechRecognitionModel(String name, String key)Sets the model for speech recognition.voidsetSpeechRecognitionOutputFormat(OutputFormat value)Sets the speech recognition output format.voidsetSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat value)Sets the embedded speech synthesis output format.voidsetSpeechSynthesisVoice(String name, String key)Sets the voice for speech synthesis.voidsetSpeechTranslationModel(String name, String key)Sets the model for speech translation.
-
-
-
Method Detail
-
fromPath
public static final EmbeddedSpeechConfig fromPath(String path)
Creates an instance of the embedded speech config with a specified offline model path.- Parameters:
path- The folder path to search for offline models. This can be a root path under which several models are located in subfolders, or a direct path to a specific model folder.- Returns:
- An embedded speech config instance.
-
fromPaths
public static final EmbeddedSpeechConfig fromPaths(List<String> paths)
Creates an instance of the embedded speech config with specified offline model paths.- Parameters:
paths- he folder paths to search for offline models. These can be root paths under which several models are located in subfolders, or direct paths to specific model folders.- Returns:
- An embedded speech config instance.
-
getSpeechRecognitionModels
public final List<SpeechRecognitionModel> getSpeechRecognitionModels()
Gets a list of available speech recognition models.- Returns:
- Speech recognition model info.
-
setSpeechRecognitionModel
public final void setSpeechRecognitionModel(String name, String key)
Sets the model for speech recognition.- Parameters:
name- The model name.key- The model decryption key.
-
getSpeechRecognitionModelName
public final String getSpeechRecognitionModelName()
Gets the model name for speech recognition.- Returns:
- The recognition model name.
-
setSpeechRecognitionOutputFormat
public final void setSpeechRecognitionOutputFormat(OutputFormat value)
Sets the speech recognition output format.- Parameters:
value- The recognition output format.
-
getSpeechRecognitionOutputFormat
public final OutputFormat getSpeechRecognitionOutputFormat()
Gets the embedded speech recognition output format.- Returns:
- The recognition output format.
-
setProfanity
public final void setProfanity(ProfanityOption value)
Sets the profanity option. This can be used to remove profane words or mask them in output.- Parameters:
value- The profanity option.
-
setSpeechSynthesisVoice
public final void setSpeechSynthesisVoice(String name, String key)
Sets the voice for speech synthesis.- Parameters:
name- The voice name for embedded speech synthesis.key- The decryption key.
-
getSpeechSynthesisVoiceName
public final String getSpeechSynthesisVoiceName()
Gets the voice name for embedded speech synthesis.- Returns:
- Returns the embedded speech synthesis voice name.
-
setSpeechSynthesisOutputFormat
public final void setSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat value)
Sets the embedded speech synthesis output format.- Parameters:
value- The synthesis output format ID (e.g. Riff16Khz16BitMonoPcm).
-
getSpeechSynthesisOutputFormat
public final String getSpeechSynthesisOutputFormat()
Gets the embedded speech synthesis output format.- Returns:
- Returns the synthesis output format.
-
getSpeechTranslationModels
public final List<SpeechTranslationModel> getSpeechTranslationModels()
Gets a list of available speech translation models.- Returns:
- Speech translation model info.
-
setSpeechTranslationModel
public final void setSpeechTranslationModel(String name, String key)
Sets the model for speech translation.- Parameters:
name- Model name.key- Model decryption key.
-
getSpeechTranslationModelName
public final String getSpeechTranslationModelName()
Gets the model name for speech translation.- Returns:
- The translation model name.
-
setProperty
public void setProperty(String name, String value)
Sets a named property as value.- Parameters:
name- the name of the property.value- the value.
-
setProperty
public void setProperty(PropertyId id, String value)
Sets the property by propertyId.- Parameters:
id- PropertyId of the property.value- The value.
-
getProperty
public String getProperty(String name)
Gets a named property as value.- Parameters:
name- the name of the property.- Returns:
- The value.
-
getProperty
public String getProperty(PropertyId id)
Gets the property by propertyId.- Parameters:
id- PropertyId of the property.- Returns:
- The value.
-
close
public final void close()
Dispose of associated resources.- Specified by:
closein interfaceAutoCloseable
-
getImpl
public SafeHandle getImpl()
Returns a internal handle to SpeechConfig implementation.- Returns:
- The implementation handle.
-
-