我正试图将HMS自动语音识别(ASR)添加到我的应用程序中。我已经实现了SpeechRecognizer
,但它需要GMS才能工作。
当前的HMS实现工作在安装HMS核心的非华为设备上,但不适用于我的Huawei Mediapad T5。
趣味初始化(活动:活动)
speechRecognizer = MLAsrRecognizer.createAsrRecognizer(activity)
speechIntent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
.putExtra(
MLAsrCaptureConstants.LANGUAGE,
"en-US"
)
.putExtra(MLAsrConstants.FEATURE, MLAsrConstants.FEATURE_ALLINONE)
speechRecognizer?.setAsrListener(listener)
Fun StartListing()
speechRecognizer?.startRecognizing(speechIntent)
趣味破坏()
speechRecognizer?.destroy()
4945-4945 W/HmsSpeechRecognitionHolder@c1cafe: init on Thread[main,5,main]
4945-4945 W/InputMethodManager: startInputReason = 1
4945-4945 W/HmsSpeechRecognitionHolder@c1cafe: startListening on Thread[main,5,main]
4945-4945 E/HaLogProvider: forbiddenHiLog openHa = false
4945-4945 E/HaLogProvider: forbiddenHiLog.getVenderCountry=ca
4945-4945 E/HaLogProvider: forbiddenHiLog openHa = false
4945-4945 E/MLASR_HaAdapter_MLKitAsr: mEventsToBeReported: has no response event isInfoGatherStart:falsemsg: 0
4945-4945 E/HwCustAudioRecordImpl: isOpenEC : false
634-985 E/HuaweiProcessing: ProcessingLib_Create: the algo have already been created.
634-985 W/EffectsFactory: EffectCreate() library huawei_processing: could not create fx Huawei Audio Preprocessing Effect, error -22
634-985 E/EffectFactoryHAL: Error creating effect e707d040-6b79-11e2-b16a-0002a5d5c51b: Invalid argument
721-8060 E/AudioEffect: set(): AudioFlinger could not create effect, status: -19
721-8060 W/AudioPolicyEffects: addInputEffects(): failed to create Fx huawei_pre_processing on source 1
634-8049 E/baidu_asr_interface: asr_baidu_set_parameters_data-not baidu asr
634-7993 W/DeviceHAL: Device 0x78c2d00000 get_mic_mute: Function not implemented
634-987 W/DeviceHAL: Device 0x78c2dc4680 get_mic_mute: Function not implemented
721-8009 W/HuaweiAudioFlinger: soundtrigger is now disable or not support, pls enable it first from setting
721-8009 W/APM_AudioPolicyManager: startInput(78) failed: other input 70 already started
721-8009 E/AudioFlinger: RecordThread::start error,setCallingAppName -1
4945-4945 E/AudioRecord: start() status -38
4945-4945 E/MLASR_A: getVendorCountry=ca
500-8480 W/libc: Set property "hw.wifi.dns_stat" to "99,14,14044,1,34759"
1472-1472 W/HwKeyguardDragHelper: AnimationBlocked
4945-5079 W/libEGL: EGLNativeWindowType 0x79e0317010 disconnect failed
1140-2290 E/WindowManager: win=Window{d80c651 u0 ProjectActivity} destroySurfaces: appStopped=true win.mWindowRemovalAllowed=false win.mRemoveOnExit=false
767-767 E/wificond: Failed to get NL80211_RATE_INFO_NOISE
767-767 E/wificond: Failed to get NL80211_RATE_INFO_SNR
767-767 E/wificond: Failed to get NL80211_STA_INFO_CNAHLOAD
1140-1316 E/WificondControl: Noise: 0, Snr: -1, Chload: -1
767-767 E/wificond: Failed to get NL80211_RATE_INFO_SNR
767-767 E/wificond: Failed to get NL80211_STA_INFO_CNAHLOAD
767-767 E/wificond: Failed to get NL80211_RATE_INFO_NOISE
767-767 E/wificond: Failed to get NL80211_RATE_INFO_SNR
767-767 E/wificond: Failed to get NL80211_STA_INFO_CNAHLOAD
1140-1316 E/WificondControl: Noise: 0, Snr: -1, Chload: -1
761-8466 W/ACodec: forcing OMX state to Idle when received shutdown in ExecutingState
769-8467 W/SimpleSoftOMXComponent: onChangeState mState= 3, mTargetState = 3, state = 2
769-8467 W/SimpleSoftOMXComponent: checkTransitions port buf count is not zero
769-1826 W/SimpleSoftOMXComponent: checkTransitions port buf count is not zero
769-1826 W/SimpleSoftOMXComponent: checkTransitions port buf count is not zero
769-1826 W/SimpleSoftOMXComponent: checkTransitions port buf count is not zero
769-1826 W/SimpleSoftOMXComponent: checkTransitions port buf count is not zero
769-1826 W/SimpleSoftOMXComponent: checkTransitions mState = 2, mTargetState = 1
721-8060 W/HuaweiAudioFlinger: soundtrigger is now disable or not support, pls enable it first from setting
1900-3437 E/HSM: BMNCaller:is not PermissionEnabled.
721-6695 W/AudioFlinger::EffectModule: EffectModule 0x7ba4f22a00 destructor called with unreleased interface
634-941 E/audio_hw_primary: in_remove_audio_effect error effect is null
634-941 W/StreamHAL: Error from HAL stream in function remove_audio_effect: Function not implemented
721-6695 E/AudioFlinger::EffectModule: Error when removing effect: -38
721-6695 W/AudioFlinger::EffectHandle: disconnect Effect handle 0x7ba4e45800 disconnected after thread destruction
1640-1796 W/AudioState: session release and not found sessionId: 81
4945-4945 W/HmsSpeechRecognitionHolder@c1cafe: destroy on Thread[main,5,main]
4945-8481 E/HwCustAudioRecordImpl: isOpenEC : false
4945-8481 E/HwCustAudioRecordImpl: isOpenEC : false
634-985 E/HuaweiProcessing: ProcessingLib_Create: the algo have already been created.
634-985 W/EffectsFactory: EffectCreate() library huawei_processing: could not create fx Huawei Audio Preprocessing Effect, error -22
634-985 E/EffectFactoryHAL: Error creating effect e707d040-6b79-11e2-b16a-0002a5d5c51b: Invalid argument
721-8060 E/AudioEffect: set(): AudioFlinger could not create effect, status: -19
721-8060 W/AudioPolicyEffects: addInputEffects(): failed to create Fx huawei_pre_processing on source 1
721-8009 W/APM_AudioPolicyManager: startInput(78) failed: other input 70 already started
721-8009 E/AudioFlinger: RecordThread::start error,setCallingAppName -1
4945-4945 E/AudioRecord: start() status -38
更新:经过@Shirley指出的一些修复后,ASR似乎可以在P30Lite上可靠地工作。但在旧的Mediapad T5上仍面临同样的问题。
某些型号的手机和平板电脑在使用ML ASR时可能存在资源限制问题。问题的症状是,单击麦克风按钮后,手机/平板电脑没有响应,或者显示错误消息,表明设备上没有安装语音识别服务。不仅是HMS ASR,我还尝试使用原生Android SpeechRecognizer来实现语音识别,在硬件资源有限的手机模拟器上单击按钮后,示例应用程序将挂起。
为了解决您的问题,我建议将使用HMS ML Kit ASR切换到使用HMS ML Kit实时转录(RTT)。RTT为语音识别提供了与ASR相似的特性,并将语音转换为文本。有关更多细节,请参见ML Kit-Real-Time Transcription(huawei.com)的HMS ML Kit RTT文档。
RTT的代码类似于ASR,您需要提供一个SpeechRecognitionListener类或匿名类来实现MLSpeechRealTimeTransCriptionListener。文档链接中也有示例代码。我在我的华为手机Mate 30 Pro上测试了样本代码,它运行良好。
问题内容: 我遇到了很大的麻烦,我无法启动Elasticsearch,我需要它来本地运行Rails,请告诉我发生了什么。我以正常方式安装Elasticsearch,然后执行以下操作: 但它显示以下错误: 我尝试了几种其他方式来运行它,例如: 但是随后出现以下错误,并且找不到解决该问题的有用方法,它似乎与文件权限有关,但不确定: 谢谢你的帮助。 问题答案: Elasticsearch / homeb
问题内容: 美好的一天,我尝试从另一个开始新的活动。但是它总是崩溃。这是我的代码。这是ListView上的事件。 向清单清单添加了活动 错误消息是 所有以前的活动,我添加的活动都很好… StudentInfoActivity 问题答案: 代替 改成 例如,活动actOne = null;
如果有人能帮助我,我会非常高兴,因为我是对象编程的新手。我的问题是:我正在编写一些带有蓝牙通信的应用程序。我编写了所有方法并在MainActivity.class.中成功地在设备之间连接和传输数据我也有一个SearchActivity.class它显示了List上范围内的所有设备,因此用户可以选择一个。然后将设备通过Intent传递到Main Active,从那里开始连接。但由于我的应用程序的性质
其他的,我不能直接在主窗口中编辑“native-lib.cpp”,因为它不出现在左侧的文件夹cpp中,即使这个文件存在,我也可以用终端看到它。下面的图片告诉你我的意思 我需要帮助
问题内容: 我编写了一个小模块,该模块首先在目录中找到所有文件,然后合并它们。但是,从目录打开这些文件时遇到问题。我确保我的文件和目录名称正确,并且文件实际上在目录中。 下面是代码。 下面是错误。 问题答案: listdir仅返回文件名:https ://docs.python.org/2/library/os.html#os.listdir您需要完整路径才能打开文件。在打开文件之前,还要检查以确
我在做计算器(顺便说一句,我是个初学者)。我几乎完成了它,直到我需要格式化我的电脑,并且在第一次重新打开Android Studio之后,它才打开,但现在它没有打开,并且显示了这个例外: 失败:生成失败,出现异常。 哪里出了问题: 无法打开a4fwtlbt6cgvdv2n0389t2u6w的cp\U初始化重新映射类缓存(C:\Users\tambe.gradle\caches\6.1.1\scri