Search code examples
servicevoice-recognitiontizensamsung-gear-s2

Samsung Gear S2 TTS Native API


I'm following the tutorial:

STT: Recognizing Speech

I'm using STT API but I receive a STT_ERROR_NOT_SUPPORTED error when I call create_stt_handle on Samsung Gear S2. Is this API supported on this device or there's something wrong in calling this function on a service service_app_control :

   create_stt_handle()  {
                   int ret;
                   ret = stt_create(&stt);
                   if (STT_ERROR_NONE != ret)
                     {
                        dlog_print(DLOG_DEBUG, LOG_TAG, "create_stt_handle %#010x", ret);
                     }
                   if (STT_ERROR_NOT_SUPPORTED == ret)
                     {
                        dlog_print(DLOG_DEBUG, LOG_TAG, "create_stt_handle STT_ERROR_NOT_SUPPORTED");
                     }

       }


        void service_app_control(app_control_h app_control, void *data) {
            // Todo: add your code here.

            //create_stt_handle();

            //set_recognition_result_cb(stt);

            int error = register_accelerometer_callback(data);
            //dlog_print(DLOG_DEBUG, LOG_TAG, "after create %d", error);

            return;
        }

Solution

  • Stt need two feature tizen.org/feature/speech.recognition and tizen.org/feature/microphone

    You need to check supported feature by systemapi as below.

    https://developer.tizen.org/development/api-references/api-reference-2.3.1?redirect=https%3A//developer.tizen.org/dev-guide/2.3.1/org.tizen.native.wearable.apireference/group__CAPI__SYSTEM__SYSTEM__INFO__MODULE.html

    #include "system_info.h"
    
    bool stt_supported = false;
    bool mic_supported = false;
    
    system_info_get_platform_bool("http://tizen.org/feature/speech.recognition", &stt_supported);
    system_info_get_platform_bool("http://tizen.org/feature/microphone", &mic_supported);
    
    dlog_print(DLOG_ERROR, LOG_TAG, "supported = %d, %d", stt_supported ,mic_supported );
    

    Maybe it can not support stt_supported. Here is same question in tizen forum.

    https://developer.tizen.org/forums/native-application-development/stt-support-on-real-gear-s2-not-emulator?tab=active