Skip to content

Latest commit

 

History

History
43 lines (35 loc) · 1.6 KB

IflytekWakeUp.md

File metadata and controls

43 lines (35 loc) · 1.6 KB

IFLYTEK WakeUp

Configure

  • iFLYTEK Intelligent Voice Configuration
  • Configure the wake-up words in the iFLYTEK Voice Wake-Up App Configuration. After configuring, download the SDK, or re-download the SDK and replace the so libraries in the app.
  • Extract the downloaded SDK, and copy res/ivw/{app_id}.jet to the src/main/assets/ directory of the app. Subdirectories are allowed, and you can also rename the file, such as src/main/assets/wakeup/iflytek/xiaozhi.jet. Then, in the parameters of createWakeUp, configure ivw_res_path_assets as the directory of this file under assets, such as wakeup/iflytek/xiaozhi.jet.
  • Refer to the iFLYTEK Voice Wake-Up Android SDK Documentation for parameter configuration to customize WakeUp parameters.

Sample

// initialize wakeup
val wakeUp = ivAssistant.createWakeUp(
    WakeUpType.Iflytek,
    mapOf(
        Pair("app_id", "0******2"),
        Pair("ivw_res_path_assets", "wakeup/iflytek/xiaozhi.jet"),
        Pair("ivw_threshold", 1450),
        Pair("keep_live", 1),
    )
)
wakeUp.initialize()

// use wakeUp
wakeUp.start(object : WakeUpCallback {
    override fun onSuccess(keywordIndex: Int) {
        Log.d(TAG, "wakeUp onSuccess $keywordIndex")
    }

    override fun onError(errorCode: Int, errorMessage: String) {
        Log.e(TAG, "errorCode: $errorCode, errorMessage: $errorMessage")
    }

    override fun onStop() {
        Log.d(TAG, "wakeUp onStop")
    }
})

// stop & release wakeUp
wakeUp.stop()
wakeUp.release()