How to change speech recognition configuration after initialization of the speech recognizer

Faris Lemes 70 Reputation points
2024-04-04T08:13:33.6966667+00:00

Hi, I was experimenting with microsoft speech sdk and for my use case scenario I have to dynamically change some properties inside the configuration, for example:

PropertyId::Speech_SegmentationSilenceTimeoutMs

Is it possible to do it somehow? I.e. at various time points I need to change this property on different values. Is it possible to do it without doing reinitialization of the speech recognizer? I'm using c++ programming language.

Thanks!

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
2,061 questions
{count} votes

Accepted answer
  1. navba-MSFT 27,540 Reputation points Microsoft Employee Moderator
    2024-04-04T09:09:12.4266667+00:00

    @Faris Lemes Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    In the Microsoft Speech SDK for C++, the method to set a property is SetProperty

    public inline void SetProperty (PropertyId propertyID, const std::string & value);
    

    More info here.

    In the Microsoft Speech SDK, the SpeechRecognizer class has a Properties member that is a collection of properties and their values. You can use this to change the properties of the SpeechRecognizer after it has been initialized. More info here and here.

    Here is an example of how you might do this in C++:

    // Assuming you have a SpeechRecognizer object named recognizer 
    
    auto properties = recognizer.Properties; 
    
    properties.SetProperty(PropertyId::Speech_SegmentationSilenceTimeoutMs, "new_value");
    
    

    In this code, "new_value" should be replaced with the value you want to set for the Speech_SegmentationSilenceTimeoutMs property.

    Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.