Class 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 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:
        close in interface AutoCloseable
      • getImpl

        public SafeHandle getImpl()
        Returns a internal handle to SpeechConfig implementation.
        Returns:
        The implementation handle.