Giter Club home page Giter Club logo

gtts4j's Introduction

gTTS4j

gTTS4j (Google Text to Speech): Java version of an interface to Google's Text to Speech API.

Usage

1. Import gTTS4j

import com.dragonbean.cloud.gTTS4j;

2. Create an instance

gTTS4j gtts = new gTTS4j();
gtts.init(text, "en", true, false);
Parameters:
  • text - String - Text to be spoken.
  • lang - String - ISO 639-1 language code (supported by the Google Text to Speech API) to speak in.
  • slow - Boolean - Speak slowly. Default False (Note: only two speeds are provided by the API).

3. Get voice stream

InputStream is = gtts.exec();
Example:
InputStream is = null;
String text = "Surprise!";
gTTS4j gtts = new gTTS4j();
try {
    gtts.init(text, "en", true, false);
    is = gtts.exec();
} catch (Exception e) {
    e.printStackTrace();
} finally {
    if (is != null) is.close();
}

Supported Languages

  • 'af' : 'Afrikaans'
  • 'sq' : 'Albanian'
  • 'ar' : 'Arabic'
  • 'hy' : 'Armenian'
  • 'bn' : 'Bengali'
  • 'ca' : 'Catalan'
  • 'zh' : 'Chinese'
  • 'zh-cn' : 'Chinese (Mandarin/China)'
  • 'zh-tw' : 'Chinese (Mandarin/Taiwan)'
  • 'zh-yue' : 'Chinese (Cantonese)'
  • 'hr' : 'Croatian'
  • 'cs' : 'Czech'
  • 'da' : 'Danish'
  • 'nl' : 'Dutch'
  • 'en' : 'English'
  • 'en-au' : 'English (Australia)'
  • 'en-uk' : 'English (United Kingdom)'
  • 'en-us' : 'English (United States)'
  • 'eo' : 'Esperanto'
  • 'fi' : 'Finnish'
  • 'fr' : 'French'
  • 'de' : 'German'
  • 'el' : 'Greek'
  • 'hi' : 'Hindi'
  • 'hu' : 'Hungarian'
  • 'is' : 'Icelandic'
  • 'id' : 'Indonesian'
  • 'it' : 'Italian'
  • 'ja' : 'Japanese'
  • 'km' : 'Khmer (Cambodian)'
  • 'ko' : 'Korean'
  • 'la' : 'Latin'
  • 'lv' : 'Latvian'
  • 'mk' : 'Macedonian'
  • 'no' : 'Norwegian'
  • 'pl' : 'Polish'
  • 'pt' : 'Portuguese'
  • 'ro' : 'Romanian'
  • 'ru' : 'Russian'
  • 'sr' : 'Serbian'
  • 'si' : 'Sinhala'
  • 'sk' : 'Slovak'
  • 'es' : 'Spanish'
  • 'es-es' : 'Spanish (Spain)'
  • 'es-us' : 'Spanish (United States)'
  • 'sw' : 'Swahili'
  • 'sv' : 'Swedish'
  • 'ta' : 'Tamil'
  • 'th' : 'Thai'
  • 'tr' : 'Turkish'
  • 'uk' : 'Ukrainian'
  • 'vi' : 'Vietnamese'
  • 'cy' : 'Welsh'

Contributing

  1. Fork yp2211/gTTS4j on GitHub and clone it locally
  2. Make sure you write tests for new features or modify the existing ones if necessary
  3. Open a new Pull Request from your feature branch to the master branch.
  4. Thank you!

gtts4j's People

Contributors

yp2211 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gtts4j's Issues

java.lang.NumberFormatException

Hello i use your library but i have this exception :

java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:601)
at java.lang.Long.parseLong(Long.java:631)
at com.dragonbean.cloud.Token._get_token_key(Token.java:155)
at com.dragonbean.cloud.Token.calculate_token(Token.java:38)
at com.dragonbean.cloud.gTTS4j.exec(gTTS4j.java:154)

Can you help me ?

Publish as a dependency?

Hi there. I can't get this to compile on my station. Token cannot be resolved to a type. I've tried cleaning, rebuilding and it just brings me back to the same hurdle.

Would it be possible for you to publish this as a library?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.