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

Posted

技术标签:

【中文标题】在 LG Optimus S 上收到并处理了 TTS 文本,但未听到【英文标题】:TTS text received & processed but NOT HEARD on LG Optimus S 【发布时间】:2011-11-19 17:21:56 【问题描述】:

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

另一方面,这个问题是可重现的,所以在解开谜团的路上可能会有一些希望。

问题本身就是如此,传递给 TTS 引擎 (Pico) 的前两个文本段在所有手机上都得到了正确处理(并通过扬声器听到!),包括有问题的手机 (LG Optimus S)。

但第三和第四段传递给 TTS 引擎,在语音 RecognitionController 的 RECOGNIZED 步骤之后,在所有电话中产生完全良性的日志,除了在有问题的电话中 什么都听不到通过扬声器! - 尽管收到所有 OnUtteranceCompleted(),即使是有问题的手机!

我知道代码是正确的,因为它可以在所有其他手机上完美运行,所以我不知道是什么原因造成的。

这可能是 CPU 资源不足吗?内存资源不足?

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

如果这有助于在系统行为中发现“奇怪”的东西,我会在有问题的手机上包含一个丢失 TTS 语音的示例 logcat:

INFO/RecognitionController(1773): State change: RECOGNIZING -> RECOGNIZED
INFO/RecognitionController(1773): Final state: RECOGNIZED
INFO/ServerConnectorImpl(1773): ClientReportsession_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): ClientReportsession_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);    

想法?有什么建议吗?

【问题讨论】:

【参考方案1】:

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

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

【讨论】:

以上是关于在 LG Optimus S 上收到并处理了 TTS 文本,但未听到的主要内容,如果未能解决你的问题,请参考以下文章

在交流适配器上使用 NVidia optimus 有啥好处吗?

Per-monitor DPI-Aware:NVIDIA Optimus 出现黑窗故障

当我启用 NVidia Optimus 时,为啥在 D3D11 中我的纹理上会出现条纹

OpenGL 3.3 两个 GPU 上的两个不同结果 nVidia Optimus 与阴影映射

LG1600 天天爱跑步

带有 C# 的 Optimus 无头浏览器