HMS-Core / hms-ml-demo

HMS ML Demo provides an example of integrating Huawei ML Kit service into applications. This example demonstrates how to integrate services provided by ML Kit, such as face detection, text recognition, image segmentation, asr, and tts.
https://developer.huawei.com/consumer/en/hms/huawei-mlkit?ha_source=hms1
Apache License 2.0
357 stars 120 forks source link

TTS not working in HomeReader example #16

Closed minkiapps closed 3 years ago

minkiapps commented 4 years ago

Hi, I am trying to test the homework reader example, the text recognition part works, but the read function does not work

This is what I get:

E/ML_TTS_SynthesisEngineOnline: Speech synthesis request failed!
E/ML_TTS_SpeechSynthesisController: Receive engine error taskId[1595757576654554] errorCode[105] errorMsg[network no response]

I enabled the ML-Kit API in Huawei Developer Console, and also I am connected to WIFI. I am running on Huawei Mate 30 Pro...

Mike-mei commented 4 years ago

Hello, can you provide your log file?

minkiapps commented 4 years ago

Thats what I see in verbose:

2020-07-27 08:52:09.085 14937-14937/com.minkiapps.mlkit.huawei V/AudioManager: querySoundEffectsEnabled...
2020-07-27 08:52:09.085 14937-14937/com.minkiapps.mlkit.huawei I/ML_TTS_MLTtsEngine: [com.huawei.hms.mlsdk.tts.MLTtsEngine@b37e530] API:speak text[353] | queueMode[0]
2020-07-27 08:52:09.087 14937-14937/com.minkiapps.mlkit.huawei I/ML_TTS_MLTtsEngine: [com.huawei.hms.mlsdk.tts.MLTtsEngine@b37e530] API:speak return ID [1595832729085248]
2020-07-27 08:52:09.088 14937-15064/com.minkiapps.mlkit.huawei I/ML_TTS_AudioPlayer: resume play;  current state:1
2020-07-27 08:52:09.088 14937-15063/com.minkiapps.mlkit.huawei I/ML_TTS_SynthesisEngineOnline: startSpeechSynthesis|event=com.huawei.hms.mlsdk.tts.b.b@1f4ecf6
2020-07-27 08:52:09.088 14937-15063/com.minkiapps.mlkit.huawei I/ML_TTS_SynthesisEngineOnline: startSpeechSynthesis|TtsInput{text='原消戊江元遇不婚·水旱文匆那带回痛天假贴口象又
    流R定·歌服尺果再真三,普占要银乞新·
    黑封常度括道男祖黄想忍米羽己即仍今吉到跟嘉
    语要:巾大千肖仍肇坡已蝴火才昔,童细木高共蝴拍:
    睢千匆眼,世自穴
    占就三金能装停用戊大目斥米布;刀方林采看支同和
    福·科用匆想要良晋眼婚林春巾足友·真吧老
    明斗回口光六戊阴室娘年士汗小,汁内弟步屋布假冬玩
    跳波回泉呢虎,畏公玩黄耳。
    很明背高因,品国食错晚亮各二比眼削冒能起田要
    坐,吹步他校土意,朱今外清司跳冬·舞法几耍司
    出束重难雕蝶弟精促
    五只.呈W相人尤六固蚂父呢t
    未重免香拉都做萌
    向太弟功色寸;音面黏每禾。
    耳走步追肉司牙米示都目地
    清穴巾;忍新清戊至吹知
    松几消)向哥京!»
    聪道更活可煅·泉消院世男耳回
    工未主甲雨尼太夏,器
    络,当每用网-m用下。始有
    ', language='zh-Hans'}
2020-07-27 08:52:09.113 14937-15011/com.minkiapps.mlkit.huawei D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2020-07-27 08:52:09.116 14937-15354/com.minkiapps.mlkit.huawei I/ML_TTS_TtsConfig: TtsConfig{person=zh-Hans-st-1, codec=3, sampleRate=1, speed=1.0, volume=5.0, pitch=5.0}
2020-07-27 08:52:09.116 14937-15354/com.minkiapps.mlkit.huawei I/ML_TTS_SynthesisEngineOnline: requestJson:{"data":{"text":"原消戊江元遇不婚·水旱文匆那带回痛天假贴口象又\n流R定·歌服尺果再真三,普占要银乞新·\n黑封常度括道男祖黄想忍米羽己即仍今吉到跟嘉\n语要:巾大千肖仍肇坡已蝴火才昔,童细木高共蝴拍:\n睢千匆眼,世自穴\n占就三金能装停用戊大目斥米布;刀方林采看支同和\n福·科用匆想要良晋眼婚林春巾足友·真吧老\n明斗回口光六戊阴室娘年士汗小,汁内弟步屋布假冬玩\n跳波回泉呢虎,畏公玩黄耳。\n很明背高因,品国食错晚亮各二比眼削冒能起田要\n坐,吹步他校土意,朱今外清司跳冬·舞法几耍司\n出束重难雕蝶弟精促\n五只.呈W相人尤六固蚂父呢t\n未重免香拉都做萌\n向太弟功色寸;音面黏每禾。\n耳走步追肉司牙米示都目地\n清穴巾;忍新清戊至吹知\n松几消)向哥京!»\n聪道更活可煅·泉消院世男耳回\n工未主甲雨尼太夏,器\n络,当每用网-m用下。始有\n","language":"zh-Hans"},"config":{"person":"zh-Hans-st-1","codec":3,"sampleRate":1,"speed":"1.0","volume":"5.0","pitch":"5.0"}}
2020-07-27 08:52:09.116 14937-15354/com.minkiapps.mlkit.huawei E/ML_TTS_SynthesisEngineOnline: Speech synthesis request failed!
2020-07-27 08:52:09.116 14937-15354/com.minkiapps.mlkit.huawei E/ML_TTS_SpeechSynthesisController: Receive engine error taskId[1595832729085248] errorCode[105] errorMsg[network no response]
2020-07-27 08:52:09.116 14937-15354/com.minkiapps.mlkit.huawei I/ML_TTS_MLTtsEngine: CALLBACK:[1595832729085248] onDispatchError[11302] ;
2020-07-27 08:52:09.116 14937-15063/com.minkiapps.mlkit.huawei I/ML_TTS_AudioPlayer: start write data; current state:1 taskId = 1595832729085248
2020-07-27 08:52:09.116 14937-15063/com.minkiapps.mlkit.huawei I/ML_TTS_AudioPlayer: current main cache size:1, result = true
2020-07-27 08:52:09.117 14937-15062/com.minkiapps.mlkit.huawei I/ML_TTS_AudioPlayer: before play, retry nextFrame 1595832729085248
2020-07-27 08:52:09.506 14937-15039/com.minkiapps.mlkit.huawei I/HiAnalyticsSDK: hmsSdk=> HiAnalyticsInstance.onReport() is execute.TAG: _hms_config_tag,TYPE: -1
2020-07-27 08:52:09.507 14937-15039/com.minkiapps.mlkit.huawei I/HiAnalyticsSDK: hmsSdk=> onReport: Before calling runtaskhandler()
2020-07-27 08:52:09.508 14937-15348/com.minkiapps.mlkit.huawei I/HiAnalyticsSDK: EventReportTask=> eventReportTask is running
2020-07-27 08:52:09.508 14937-15039/com.minkiapps.mlkit.huawei I/HaLogOnReport: onReport time =Mon Jul 27 08:52:09 GMT+02:00 2020
2020-07-27 08:52:09.508 14937-15348/com.minkiapps.mlkit.huawei I/HiAnalyticsSDK: EventManager=> read all event records
2020-07-27 08:52:09.509 14937-15348/com.minkiapps.mlkit.huawei I/HiAnalyticsSDK: EventReportTask=> no have events to report: tag:_hms_config_tag : type:alltype
2020-07-27 08:52:11.099 14937-15011/com.minkiapps.mlkit.huawei W/libEGL: EGLNativeWindowType 0x761a8363d0 disconnect failed
Mike-mei commented 4 years ago

We find that you failed to connect the server,because the server's response is null, please check whether your agconnect-services.json is right

minkiapps commented 4 years ago

I doubled checked again, I went to AG console, downloaded the agconnect-services.json, put it into project and compiled, still the same error...

How are you sure that the json is incorrect? Since the error is quite generic.

Mike-mei commented 4 years ago

Please check the package_name in agconnect-services.json is the same with your applicationId in build.gradle

minkiapps commented 4 years ago

its the same, else wise it wouldn't even compile afaik

minkiapps commented 4 years ago

I created now a new project in AG console with new package name, it is still not working Same error...

minkiapps commented 4 years ago

Is there any progress on this one?

I pulled the latest master.

What I get now is this error from TTS on my Huawei Mate 30 Pro (Model LIO-L29) MLTtsError{errorId=11398, errorMsg='Failed to receive streams.Reason: Got response failed:UnknownHostException', extension=0198}

On the other hand, TTS works on an older Huawei phone Huawei P8 lite 2017 (Model PRA-LX1)...

HMS-MLKit commented 4 years ago

Can you provide a complete error log?

minkiapps commented 4 years ago

This is what I get:

 I/ML_TTS_MLTtsEngine: [com.huawei.hms.mlsdk.tts.MLTtsEngine@9816394] API:speak text[351] | Mode[0]
 I/ML_TTS_MLTtsEngine: [com.huawei.hms.mlsdk.tts.MLTtsEngine@9816394] API:speak return ID [1597146699895186]
 I/ML_TTS_AudioPlayer: Resume play;  current state:1
 I/ML_TTS_MLTtsEngine: CALLBACK:[1597146699895186] onDispatchSynthesisStart
 I/ML_TTS_SpeechSynthesisController: isReadyToStartSynthesis(), head is null
 I/ML_TTS_HttpUtils: Target domian: https:///v1/tts/text2audio
 I/ML_TTS_HttpUtils: Request from HMS Core!
 E/ML_CountryCodeHelper: getVendorCountry=eu
 E/ML_CountryCodeHelper: getVendorCountry equals eu or la ,not reliable
 E/ML_CountryCodeHelper: getSimCountryCode by not enableNetwork, countryCode=
 E/ML_CountryCodeHelper: getLocaleCountryCode from system language is not reliable.
 E/ML_TTS_HttpUtils: Got response failed:UnknownHostException;reasons:Unable to resolve host "v1": No address associated with hostname;cause:android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
 I/ML_TTS_HttpUtils: Target domian: https:///v1/tts/text2audio
 I/ML_TTS_HttpUtils: Request from HMS Core!
 E/ML_CountryCodeHelper: getVendorCountry=eu
 E/ML_CountryCodeHelper: getVendorCountry equals eu or la ,not reliable
 D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
 E/ML_CountryCodeHelper: getSimCountryCode by not enableNetwork, countryCode=
 E/ML_CountryCodeHelper: getLocaleCountryCode from system language is not reliable.
 E/ML_TTS_HttpUtils: Got response failed:UnknownHostException;reasons:Unable to resolve host "v1": No address associated with hostname;cause:null
 E/ML_TTS_SynthesisEngineOnline: Speech synthesis request failed!
 E/ML_TTS_SpeechSynthesisController: Receive engine error taskId[1597146699895186] errorCode[198] errorMsg[Failed to receive streams.Reason: Got response failed:UnknownHostException]
 I/ML_TTS_MLTtsEngine: CALLBACK:[1597146699895186] onDispatchError[11398] ;
 E/TTS: Failed to receive streams.Reason: Got response failed:UnknownHostException
 I/ML_TTS_SpeechSynthesisController: Receive END taskId [1597146699895186] interrupted [true]
 I/ML_TTS_MLTtsEngine: CALLBACK:[1597146699895186] onDispatchSynthesisEnd
 I/ML_TTS_SpeechSynthesisController: isReadyToStartSynthesis(), head is null
 I/ML_TTS_SpeechSynthesisController: isReadyToStartSynthesis(), head is null
 I/ML_TTS_AudioPlayer: Input audio data; current state:1 taskId = 1597146699895186 len:0
 I/ML_TTS_SpeechSynthesisController: TaskId:1597146699895186is Exist
 I/ML_TTS_MLTtsEngine: CALLBACK:[1597146699895186] onDispatchSynthesisComplete; interrupted[true]
 I/ML_TTS_HaAdapter: Post Event [1597146699895186]
 E/CountryCodeBean: getVendorCountry=eu
 E/CountryCodeBean: getVendorCountry equals eu or la ,not reliable
 E/CountryCodeBean: getSimCountryCode by not enableNetwork, countryCode=
 E/CountryCodeBean: getLocaleCountryCode=US
 E/CountryCodeBean: getLocaleCountryCode from system language is not reliable.
 E/HaLogProvider: forbiddenHiLog.getVenderCountry=UNKNOWN
 E/HaLogProvider: forbiddenHiLog openHa = true
 E/HaLogProvider: forbiddenHiLog.getVenderCountry=UNKNOWN
 E/HaLogProvider: forbiddenHiLog openHa = true
 E/CountryCodeBean: getVendorCountry=eu
 E/CountryCodeBean: getVendorCountry equals eu or la ,not reliable
 E/CountryCodeBean: getSimCountryCode by not enableNetwork, countryCode=
 E/CountryCodeBean: getLocaleCountryCode=US
 E/CountryCodeBean: getLocaleCountryCode from system language is not reliable.
 I/HaLogExecutor: type 1 mapValue:{package=com.minkiapps.wordreader, appid=102633825, appName=Homework-Reader, version=null, service=MLKit, transId=cfc673b4-7229-420c-ae74-2e13bfac1f86, operator=, networkType=wifi, apkVersion=, apiName=, countryCode=UNKNOWN, deviceType=LIO-L29, emuiVersion=EmotionUI_10.1.0, moudleName=MLKitTts, moudleVersion=2.0.1.302, deviceCategory=, ttsLanguage=zh-Hans, voiceName=zh-Hans-st-1, synthesisStartTime=1597146699899, synthesisEndTime=1597146699941, textLength=351, ttsFirstCost=0, ttsDownloadCost=0, sizeDownload=0, ttsSmoothly=true, result=1, resultDetail=MLTtsError{errorId=11398, errorMsg='Failed to receive streams.Reason: Got response failed:UnknownHostException', extension=0198}}
 I/HiAnalyticsSDK: hmsSdk=> HiAnalyticsInstance.onEvent(int type, String eventId, Map<String, String> mapValue) is execute.TAG: _hms_config_tag,TYPE: 1
 I/ML_TTS_SpeechSynthesisController: processSegment one audioSegment.isEndInterrupted(): true
 I/HiAnalyticsSDK: EventRecordTask=> Begin to run EventRecordTask...
 I/ML_TTS_SpeechSynthesisController: isReadyToStartSynthesis(), head is null
 I/HiAnalyticsSDK: EventRecordTask=> Cached data corrupted: stat_v2_1
minkiapps commented 4 years ago

any updates on this one?

Mike-mei commented 4 years ago

@minkiapps We still have 2 questions to confirm with you

  1. Did you insert SIM card into your phone? Please insert SIM card and try again.
  2. Would you mind telling us your country?
minkiapps commented 4 years ago

Okay, with SIM card inserted, it works. So, TTS only works on devices with SIM card? But why does it work on Huawei P8 lite without SIM card then?

My country is Austria.

Mike-mei commented 4 years ago

When you try to access with a test phone in areas like Europe, if you don't confirm user information, you can't access the server directly. This issue is involved with privacy security, and the related policy is still being optimized.

minkiapps commented 4 years ago

So there is no way to use HMS services like TTS without having a SIM card inserted before?

HMS-MLKit commented 3 years ago

This problem will be solved in the October version update, please pay attention to it.