Speech Dictation (IAT)
Based on iFlytek TTS voice dictation, it converts speech (≤60 seconds) into corresponding text information, allowing the machine to “understand” human language. It is equivalent to installing “ears” on the machine, giving it the ability to “hear”.
- audio.xunfei_iat_config(api_key, app_id)
iFlytek iat configuration. Before use, you must initialize recording with
audio.recorder_init(). Since this function depends on the iFlytek API, you must first connect the mPython Board to the internet and set the RTC clock to the accurate time before use.For the iFlytek voice dictation function, you need to register an account on the iFlytek development platform https://www.xfyun.cn/ before using it. The steps are as follows:
1. Register an account (skip if you already have one)
2. In Products, select the “Voice Dictation” service.
3. Add the network’s public IP to the IP whitelist.
api_key(str): The APIKey of the iFlytek application
app_id(str): The APPID of the iFlytek application
- audio.xunfei_iat_record()
IAT recording. To set the recording duration, pass it as a parameter, in seconds. Without a parameter, it records for 5 seconds by default. This function is blocking; it is released only after the recording ends, then it executes the subsequent commands.
- audio.xunfei_iat()
Transmit the iat recording to the iFlytek platform for processing. After processing, it returns the json content of the speech-to-text conversion.