Is the Google TTS Engine on all Android Phones, an

2019-04-28 20:14发布

问题:

I'm trying to find out if the Google TTS Engine that came with my Android phone comes installed as factory default with all Android phones that support it? I'm not sure what kind of reference to look at to figure this out, so my plan is to go to Softbank, a retailer, and ask. I feel it's a question they won't be able to answer, though.

I've been told that Galaxies don't come with Google TTS, specifically; so, anyone with a Galaxy can at least set me straight on that....

I'm also wondering, how can I get a packaged version of the Google TTS Engine? I'm not able to find it on The Play Store. The best I could find was found by looking at the license (those sweet little things always have developer names and sites). So, it's the HTS engine, using HMM, right? But I'm not able to find a package for Android on their website. My next step there is to contact the developer, and I'm currently having my translated e-mail proof read (hopefully, I can find my own answer and post it up).

Any information would be greatly appreciated.

回答1:

I don't think the accepted answer is really correct. This code doesn't check if the google TTS engine is installed. It just launch an intent that TTS engines in general respond to ask if the TTS data for them is installed.

If there is no TTS engine installed, you may get an FC caused by an exception of the type ActivityNotFoundException. If you have other TTS engine (like pico) it will respond and check it's data. If you have more than one TTS engine, it will ask you which TTS engine you want the intent to work.

You should check for the package name in the package manager instead. This code checks for SVOX Pico TTS:

public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    if(isPackageInstalled(getPackageManager(), "com.svox.pico")){
        ttsInstalled = true; // This would be good to have it as a static member
    }
}


public static boolean isPackageInstalled(PackageManager pm, String packageName) {
        try {
            pm.getPackageInfo(packageName, 0);
        } catch (NameNotFoundException e) {
            return false;
        }
        return true;
}


回答2:

This code will check if TextToSpeech is installed and if not go to google store to download

Intent intent = new Intent();
intent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
ArrayList<String> languages = new ArrayList<String>();
languages.add("eng-USA"); //$NON-NLS-1$
intent.putStringArrayListExtra(TextToSpeech.Engine.EXTRA_CHECK_VOICE_DATA_FOR, 
                                                    languages);
startActivityForResult(intent, REQUEST_TTS_DATA_CHECK_CODE);  

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent)
{
    super.onActivityResult(requestCode, resultCode, intent);

    switch (requestCode)
    {
        case REQUEST_TTS_DATA_CHECK_CODE:
            if (resultCode != TextToSpeech.Engine.CHECK_VOICE_DATA_PASS)
            {
                // show Alert Dialog to ask user go to play store to install
                // When user click OK this is the code to set
                intent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
                startActivity(intent);
            }
            break;

}


回答3:

Google TTS is a proprietary package developed by the Google and is available in most devices (particularly on Nexus devices) since ICS[citation needed]. It is part of Google developed apps that include Google Play Store, Google Maps, Google+, Gmail, YouTube, Google Search, Google Play Music, Google Play Books and many others. Not all of them are available for download from Play Store.

As far as I can tell, you can not have it unless somehow Google decides to make it open source and publicly available. As you have already mentioned, Google TTS uses HTS patch (is not an engine by itself) for HTK (I also know this from license page) which is released under the Modified BSD license. That's, you may never be able to obtain a copy of the engine.

If you want to develop a TTS engine, I would recommend taking a look on PICO TTS engine, source code of which is available in AOSP repository.