收到 TTS 文本并已处理但未在 LG Optimus S 上听到

发布于 2024-12-05 05:22:08 字数 6407 浏览 2 评论 0原文

一方面,这个问题很棘手,因为我有相同的代码可以在 3 部不同的 Android 2.2 手机上完美运行,但不能在 LG Optimus S(也运行 Android 2.2)上运行。

另一方面,这个问题是可以重现的,所以在解开这个谜团的过程中可能还有一些希望。

该问题的表现是,传递到 TTS 引擎 (Pico) 的前两个文本片段在所有手机上都能正确处理(并通过扬声器听到!),包括有问题的手机 (LG Optimus S)。

但是,在语音 RecognitionController 的 RECOGNIZED 步骤之后,传递到 TTS 引擎的第三和第四段会在所有手机中生成完全良性的日志,但有问题的手机从扬声器中听不到任何声音! - 尽管收到所有 OnUtteranceCompleted(),即使是有问题的手机!

我知道代码是正确的,因为它在所有其他手机上都能完美运行,所以我很困惑是什么原因导致了这种情况。

会不会是CPU资源不足?内存资源不足?

如果是这样,为什么它适用于前 2 个文本段,但不适用于连续的 2 个文本段?

如果这可以帮助发现系统行为中的某些“奇怪”内容,我将在有问题的手机上提供丢失的 TTS 语音的示例 logcat:

INFO/RecognitionController(1773): State change: RECOGNIZING -> RECOGNIZED
INFO/RecognitionController(1773): Final state: RECOGNIZED
INFO/ServerConnectorImpl(1773): ClientReport{session_id=040af29064d281350f1325c6a361f003,request_id=1,application_id=voice-search,client_perceived_request_status=0,request_ack_latency_ms=93,total_latency_ms=2179,user_perceived_latency_ms=213,network_type=1,endpoint_trigger_type=3,}
INFO/AudioService(121):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@45a4f450
DEBUG/AppRecognizer(2167): Proceed.
INFO/TTS received:(2167): Speaking text segment number three but NOTHING is coming out of the speaker!!! 
VERBOSE/TtsService(572): TTS service received Speaking text segment number three but NOTHING is coming out of the speaker!!! 
VERBOSE/TtsService(572): TTS processing: Speaking text segment number three but NOTHING is coming out of the speaker!!! 
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
INFO/ClientReportSender(1773): Sending 1 client reports over HTTP
INFO/TTS received:(2167): Speaking text segment number four but NOTHING is coming out of the speaker!!!
VERBOSE/TtsService(572): TTS service received Speaking text segment number four but NOTHING is coming out of the speaker!!!
WARN/AudioTrack(572): obtainBuffer timed out (is the CPU pegged?) 0x5b3988 user=00062b40, server=00061b40
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/TtsService(572): TTS callback: dispatch completed to 1
VERBOSE/TtsService(572): TTS processing: Speaking text segment number four but NOTHING is coming out of the speaker!!!
VERBOSE/onUtteranceCompleted(2167): segment #3
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
WARN/AudioTrack(572): obtainBuffer timed out (is the CPU pegged?) 0x5b3988 user=0007dc00, server=0007cc00
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/TtsService(572): TTS callback: dispatch completed to 1
VERBOSE/onUtteranceCompleted(2167): segment #4

完美运行的手机上的相应日志如下所示:

INFO/RecognitionController(1773): State change: RECOGNIZING -> RECOGNIZED
INFO/RecognitionController(1773): Final state: RECOGNIZED
INFO/ServerConnectorImpl(1773): ClientReport{session_id=040af29064d281350f1325c6a361f003,request_id=1,application_id=voice-search,client_perceived_request_status=0,request_ack_latency_ms=96,total_latency_ms=2449,user_perceived_latency_ms=140,network_type=1,endpoint_trigger_type=3,}
INFO/AudioService(121):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@46039d08
DEBUG/AppRecognizer(2167): Proceed.
INFO/TTS received:(2167): Speaking text segment number three (and I can hear it :) 
VERBOSE/TtsService(572): TTS service received Speaking text segment number three (and I can hear it :) 
VERBOSE/TtsService(572): TTS processing: Speaking text segment number three (and I can hear it :) 
INFO/ClientReportSender(1773): Sending 1 client reports over HTTP
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): TtsEngine::setLanguage found matching language(eng) but not matching country().
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
INFO/TTS received:(2167): Speaking text segment number four (and I can hear it :)
VERBOSE/TtsService(572): TTS service received Speaking text segment number four (and I can hear it :)
INFO/AudioHardwareQSD(121): AudioHardware pcm playback is going to standby.
DEBUG/dalvikvm(3262): GC_EXPLICIT freed 6946 objects / 326312 bytes in 76ms
WARN/AudioTrack(572): obtainBuffer timed out (is the CPU pegged?) 0x3ce730 user=00032e80, server=00031e80
WARN/AudioFlinger(121): write blocked for 170 msecs, 161 delayed writes, thread 0xdc08
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/onUtteranceCompleted(2167): segment #3
VERBOSE/TtsService(572): TTS callback: dispatch completed to 1
VERBOSE/TtsService(572): TTS processing: Speaking text segment number four (and I can hear it :)
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): TtsEngine::setLanguage found matching language(eng) but not matching country().
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
WARN/KeyCharacterMap(2167): No keyboard for id 131074
WARN/KeyCharacterMap(2167): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
DEBUG/dalvikvm(7137): GC_EXPLICIT freed 1585 objects / 93216 bytes in 67ms
DEBUG/dalvikvm(6697): GC_EXPLICIT freed 3108 objects / 178688 bytes in 59ms
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/onUtteranceCompleted(2167): segment #4

更新 I:问题(仅在 LG Optimus S LS670 中)仅在语音识别器首次启动后发生。我可以发送任意数量的文本片段,其中一些文本片段非常长,并且 TTS 引擎可以完美地大声朗读。但当手机进入收听状态时(当然,不是在说话的同时),TTS 就停止大声发出声音。就好像语音识别器启动后,某些说话者会自动“静音”,但语音识别完成后不会自动恢复。

实际上,我尝试在 RecognitionListener.onEndOfSpeech() 中插入 audioManager.setMicrophoneMute(false); ,但这没有帮助。

更新二:我什至尝试在 RecognitionListener.onEndOfSpeech() 中添加以下内容,认为重新启动 TTS 引擎可能会重置某个地方的错误 - 这也没有帮助:

Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkIntent, TTS_STATCHECK);    

想法?建议?

On one hand, this problem is tough because I have the same exact code working perfectly on 3 different Android 2.2 phones, but not working on an LG Optimus S (runing Android 2.2, too).

On the other hand, this problem is reproducible, so there may be some hope on the way to solving the mystery.

The problem manifests itself such that the first two text segments passed to the TTS engine (Pico) are processed (and heard through the speaker!) correctly on all phones, including the problematic one (LG Optimus S).

But the third and fourth segments passed to the TTS engine, after the speech RecognitionController's RECOGNIZED step, results in totally benign logs in all phones, except that in the problematic phone nothing is heard through the speaker! - despite receiving all OnUtteranceCompleted() even for the problematic phone!

I know the code is correct because it works perfectly on all other phones, so I am stumped as to what could be causing this.

Could this be inadequate CPU resources? inadequate memory resources?

If so, why does it work for the first 2 text segments, but doesn't work for successive 2 text segments?

If that could help in spotting something "weird" in the system behavior, I am including a sample logcat of the missing TTS-speech on the problematic phone:

INFO/RecognitionController(1773): State change: RECOGNIZING -> RECOGNIZED
INFO/RecognitionController(1773): Final state: RECOGNIZED
INFO/ServerConnectorImpl(1773): ClientReport{session_id=040af29064d281350f1325c6a361f003,request_id=1,application_id=voice-search,client_perceived_request_status=0,request_ack_latency_ms=93,total_latency_ms=2179,user_perceived_latency_ms=213,network_type=1,endpoint_trigger_type=3,}
INFO/AudioService(121):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@45a4f450
DEBUG/AppRecognizer(2167): Proceed.
INFO/TTS received:(2167): Speaking text segment number three but NOTHING is coming out of the speaker!!! 
VERBOSE/TtsService(572): TTS service received Speaking text segment number three but NOTHING is coming out of the speaker!!! 
VERBOSE/TtsService(572): TTS processing: Speaking text segment number three but NOTHING is coming out of the speaker!!! 
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
INFO/ClientReportSender(1773): Sending 1 client reports over HTTP
INFO/TTS received:(2167): Speaking text segment number four but NOTHING is coming out of the speaker!!!
VERBOSE/TtsService(572): TTS service received Speaking text segment number four but NOTHING is coming out of the speaker!!!
WARN/AudioTrack(572): obtainBuffer timed out (is the CPU pegged?) 0x5b3988 user=00062b40, server=00061b40
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/TtsService(572): TTS callback: dispatch completed to 1
VERBOSE/TtsService(572): TTS processing: Speaking text segment number four but NOTHING is coming out of the speaker!!!
VERBOSE/onUtteranceCompleted(2167): segment #3
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
WARN/AudioTrack(572): obtainBuffer timed out (is the CPU pegged?) 0x5b3988 user=0007dc00, server=0007cc00
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/TtsService(572): TTS callback: dispatch completed to 1
VERBOSE/onUtteranceCompleted(2167): segment #4

The corresponding log on a phone that works perfectly looks like this:

INFO/RecognitionController(1773): State change: RECOGNIZING -> RECOGNIZED
INFO/RecognitionController(1773): Final state: RECOGNIZED
INFO/ServerConnectorImpl(1773): ClientReport{session_id=040af29064d281350f1325c6a361f003,request_id=1,application_id=voice-search,client_perceived_request_status=0,request_ack_latency_ms=96,total_latency_ms=2449,user_perceived_latency_ms=140,network_type=1,endpoint_trigger_type=3,}
INFO/AudioService(121):  AudioFocus  abandonAudioFocus() from android.media.AudioManager@46039d08
DEBUG/AppRecognizer(2167): Proceed.
INFO/TTS received:(2167): Speaking text segment number three (and I can hear it :) 
VERBOSE/TtsService(572): TTS service received Speaking text segment number three (and I can hear it :) 
VERBOSE/TtsService(572): TTS processing: Speaking text segment number three (and I can hear it :) 
INFO/ClientReportSender(1773): Sending 1 client reports over HTTP
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): TtsEngine::setLanguage found matching language(eng) but not matching country().
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
INFO/TTS received:(2167): Speaking text segment number four (and I can hear it :)
VERBOSE/TtsService(572): TTS service received Speaking text segment number four (and I can hear it :)
INFO/AudioHardwareQSD(121): AudioHardware pcm playback is going to standby.
DEBUG/dalvikvm(3262): GC_EXPLICIT freed 6946 objects / 326312 bytes in 76ms
WARN/AudioTrack(572): obtainBuffer timed out (is the CPU pegged?) 0x3ce730 user=00032e80, server=00031e80
WARN/AudioFlinger(121): write blocked for 170 msecs, 161 delayed writes, thread 0xdc08
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/onUtteranceCompleted(2167): segment #3
VERBOSE/TtsService(572): TTS callback: dispatch completed to 1
VERBOSE/TtsService(572): TTS processing: Speaking text segment number four (and I can hear it :)
VERBOSE/TtsService(572): TtsService.setLanguage(eng, USA, )
INFO/SVOX Pico Engine(572): TtsEngine::setLanguage found matching language(eng) but not matching country().
INFO/SVOX Pico Engine(572): Language already loaded (en-US == en-US)
INFO/SynthProxy(572): setting speech rate to 100
INFO/SynthProxy(572): setting pitch to 100
WARN/KeyCharacterMap(2167): No keyboard for id 131074
WARN/KeyCharacterMap(2167): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
DEBUG/dalvikvm(7137): GC_EXPLICIT freed 1585 objects / 93216 bytes in 67ms
DEBUG/dalvikvm(6697): GC_EXPLICIT freed 3108 objects / 178688 bytes in 59ms
VERBOSE/TtsService(572): TTS callback: dispatch started
VERBOSE/onUtteranceCompleted(2167): segment #4

UPDATE I: The problem (only in the LG Optimus S LS670) only occurs after the speech recognizer kicks in for the first time. I can send any number of text segments, some of which are very long, and the TTS engine speaks out loud perfectly. But the moment the phone goes into listening (not at the same time as speaking, of course), TTS stops sounding out loud. As if some speaker "mute" occurs automatically as soon as speech recognizer kicks in but not restored automatically, once speech recognition is done.

I actually went ahead and tried inserting an audioManager.setMicrophoneMute(false); in RecognitionListener.onEndOfSpeech() but that didn't help.

UPDATE II: I even tried adding to RecognitionListener.onEndOfSpeech() the following, thinking that prehaps restarting the TTS engine could reset a bug somwhere - this didn't help either:

Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkIntent, TTS_STATCHECK);    

Ideas? Suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一抹淡然 2024-12-12 05:22:08

只需接受从 Android 2.2.2 (Froyo) 到 Android 2.3.3 (Gingerbread) 的 OTA 固件更新即可解决问题。

事实证明,这是操作系统、特定 ROM (LS670ZVD) 中的错误,而不是我的代码中的错误。

Problem solved by simply accepting the OTA firmware update from Android 2.2.2 (Froyo) to Android 2.3.3 (Gingerbread).

It turns out that this was a bug in the OS, in that particular ROM (LS670ZVD), not in my code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文