rhdunn / espeak

eSpeak NG is an open source speech synthesizer that supports 101 languages and accents.
http://reecedunn.co.uk/espeak-for-android
GNU General Public License v3.0
386 stars 16 forks source link

Android says not supported #74

Closed dalb8 closed 9 years ago

dalb8 commented 9 years ago

I installed 1.47.12 (espeak version 1.48.05 23 May 14) built from source (couldn't build the latest version; it failed at make espeakdata). When selecting espeak in Android Text-to-speech output settings the Listen to Example item is grey and Default Language Status says English not supported. However, I can play back text in the chosen voice, either via the espeak app or FBReader TTS plugin.

Here is log from when I enable espeak:

I/TtsEnginePreference( 5952): Displaying data alert for :com.reecedunn.espeak
D/AudioPolicyManagerBase( 8301): getOutput() device 2, stream 1, samplingRate 0, format 0, channelMask 3, flags 0
D/AudioPolicyManagerBase( 8301): getOutput() returns output 2
D/AudioPolicyManagerBase( 8301): getOutput() device 2, stream 1, samplingRate 0, format 0, channelMask 3, flags 0
D/AudioPolicyManagerBase( 8301): getOutput() returns output 2
D/AudioPolicyManagerBase( 8301): getOutput() device 2, stream 1, samplingRate 48000, format 1, channelMask 3, flags 4
D/AudioPolicyManagerBase( 8301): getOutput() returns output 2
W/AudioTrack(  392): AUDIO_OUTPUT_FLAG_FAST denied by client due to mismatching sample rate (48000 vs 44100)
D/AudioFlinger( 8301): start(4100), calling pid 392 session 2770
D/AudioFlinger( 8301): ? => ACTIVE (4100) on thread 0x4002dfd0
D/AudioPolicyManagerBase( 8301): startOutput() output 2, stream 1, session 2770
D/AudioHardware( 8301): AudioHardware pcm playback is exiting standby.
D/AudioHardware( 8301): openPcmOut_l() mPcmOpenCnt: 0
--------- beginning of /dev/log/system
W/ContextImpl( 5952): Calling a method in the system process without a qualified user: android.app.ContextImpl.bindService:1607 android.content.ContextWrapper.bindService:517 android.speech.tts.TextToSpeech.connectToEngine:687 android.speech.tts.TextToSpeech.initTts:638 android.speech.tts.TextToSpeech.<init>:610 
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeCreate [env=0x418e9e48, object=0x2d000019]
V/eSpeakService( 6406): Initializing with path /data/data/com.reecedunn.espeak/app_voices
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeGetSampleRate
I/SpeechSynthesis( 6406): Initialized synthesis library with sample rate = 22050
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeGetAvailableVoices
I/TextToSpeech( 5952): Sucessfully bound to com.reecedunn.espeak
I/eSpeak  ( 6406): GetVoices found 130 voices.
I/TextToSpeech( 5952): Connected to ComponentInfo{com.reecedunn.espeak/com.reecedunn.espeak.TtsService}
W/InputMethodManagerService(  392): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@420718c8 attribute=null, token = android.os.BinderProxy@423717a8
I/TextToSpeech( 5952): Set up connection to ComponentInfo{com.reecedunn.espeak/com.reecedunn.espeak.TtsService}
I/ActivityManager(  392): START u0 {act=android.speech.tts.engine.CHECK_TTS_DATA pkg=com.reecedunn.espeak cmp=com.reecedunn.espeak/.CheckVoiceData} from pid 5952
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeCreate [env=0x418e9e48, object=0x49900019]
V/eSpeakService( 6406): Initializing with path /data/data/com.reecedunn.espeak/app_voices
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeGetSampleRate
I/SpeechSynthesis( 6406): Initialized synthesis library with sample rate = 22050
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeGetAvailableVoices
I/eSpeak  ( 6406): GetVoices found 130 voices.
W/InputMethodManagerService(  392): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@424d1310 attribute=null, token = android.os.BinderProxy@423717a8
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeDestroy [env=0x400f9eb8, object=0x10a00001]
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeDestroy [env=0x400f9eb8, object=0x13900001]
V/eSpeakService( 6406): Java_com_reecedunn_espeak_SpeechSynthesis_nativeDestroy [env=0x400f9eb8, object=0x30900001]
I/Timeline( 5952): Timeline: Activity_idle id: android.os.BinderProxy@42088ab0 time:141555936
D/AudioHardware( 8301): AudioHardware pcm playback is going to standby.
D/AudioHardware( 8301): closePcmOut_l() mPcmOpenCnt: 1
rhdunn commented 9 years ago

This issue occurred when I was testing 1.47.12 on Android 5.0. This is because the Android 5.0 settings dialog assumes that the supported languages returned by a TTS engine uses 3-letter language and country codes, even when those can have equivalent 2-letter codes. The eSpeak TTS engine was returning 2-letter codes.

For example, "English (American)" has the 3-letter codes eng-USA and 2-letter codes en-US.

This was fixed in commit f4adda18b4163b50a98456e291e7714fd147e1eb.

There are many other changes in 1.48.11 that support the new Android 5.0 API. Without that eSpeak will still work, but the compatibility provided by Android has various issues in that it works differently to what eSpeak expects, so there will be bugs if not using 1.48.11.

dalb8 commented 9 years ago

I got that on 4.4.4 as well as Android 5.0.

rhdunn commented 9 years ago

The Android developers likely ported the check from the settings application in Android 5.0 to Android 4.4.4. That commit I linked to fixes the issue you describe. Can you retest with the 1.48.11 changes?

Thanks,

dalb8 commented 9 years ago

Can't build it: make stops with:

  CXX      src/src_espeakedit-compiledata.o
src/compiledata.cpp: In function ‘void CompileMbrola(const char*)’:
src/compiledata.cpp:3779:12: error: ambiguous overload for ‘operator=’ (operand types are ‘wxString’ and ‘const char*’)
   filepath = mbrola_file;
            ^
src/compiledata.cpp:3779:12: note: candidates are:
In file included from /usr/include/wx-2.8/wx/memory.h:16:0,
                 from /usr/include/wx-2.8/wx/object.h:20,
                 from /usr/include/wx-2.8/wx/wx.h:16,
                 from src/compiledata.cpp:27:
/usr/include/wx-2.8/wx/string.h:676:13: note: wxString& wxString::operator=(int) <near match>
   wxString& operator=(int);
             ^
/usr/include/wx-2.8/wx/string.h:676:13: note:   no known conversion for argument 1 from ‘const char*’ to ‘int’
/usr/include/wx-2.8/wx/string.h:956:13: note: wxString& wxString::operator=(wxChar) <near match>
   wxString& operator=(wxChar ch)
             ^
/usr/include/wx-2.8/wx/string.h:956:13: note:   no known conversion for argument 1 from ‘const char*’ to ‘wxChar {aka wchar_t}’
/usr/include/wx-2.8/wx/string.h:970:13: note: wxString& wxString::operator=(const wxWCharBuffer&) <near match>
   wxString& operator=(const wxWCharBuffer& psz)
             ^
/usr/include/wx-2.8/wx/string.h:970:13: note:   no known conversion for argument 1 from ‘const char*’ to ‘const wxWCharBuffer&’
/usr/include/wx-2.8/wx/string.h:659:24: note: wxString& wxString::operator=(const wxString&) <near match>
 class WXDLLIMPEXP_BASE wxString : public wxStringBase
                        ^
/usr/include/wx-2.8/wx/string.h:659:24: note:   no known conversion for argument 1 from ‘const char*’ to ‘const wxString&’
make[1]: *** [src/src_espeakedit-compiledata.o] Error 1
make[1]: Leaving directory `/home/david/my-fdroiddata/build/com.reecedunn.espeak'
make: *** [all] Error 2

I'm on Debian Testing spin:

    Configuration for eSpeak complete.

        Source code location:          .

        Compiler:                      g++
        Compiler flags:                -g -O2

        wxWidgets:                     2.8.12 (wx-config)
        pulseaudio:                    yes
        portaudio:                     18
        sada:                          no
        audio configuration:           runtime

        gradle:                        gradle

        Klatt:                         yes
        MBROLA:                        yes
        Sonic:                         yes
        Async:                         yes

        Extended Dictionaries:
            Russian:                   no
            Chinese (Mandarin):        no
            Chinese (Cantonese):       no