{"id":19654956,"url":"https://github.com/kilianb/googletranslatortts","last_synced_at":"2025-04-28T17:32:25.183Z","repository":{"id":144583042,"uuid":"97000873","full_name":"KilianB/GoogleTranslatorTTS","owner":"KilianB","description":"Converts a string of text to mp3 files utilizing the google translator text to speech api. Fast prototyping library without fees or rate limit.","archived":false,"fork":false,"pushed_at":"2018-10-05T14:09:59.000Z","size":81,"stargazers_count":5,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T10:11:17.253Z","etag":null,"topics":["java","text-to-speech","tts"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KilianB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-07-12T11:38:20.000Z","updated_at":"2023-06-29T14:43:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"18ecf323-67be-4f58-b521-5302b23be0f2","html_url":"https://github.com/KilianB/GoogleTranslatorTTS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilianB%2FGoogleTranslatorTTS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilianB%2FGoogleTranslatorTTS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilianB%2FGoogleTranslatorTTS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KilianB%2FGoogleTranslatorTTS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KilianB","download_url":"https://codeload.github.com/KilianB/GoogleTranslatorTTS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251355624,"owners_count":21576386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","text-to-speech","tts"],"created_at":"2024-11-11T15:18:56.225Z","updated_at":"2025-04-28T17:32:25.177Z","avatar_url":"https://github.com/KilianB.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Google-Text-To-Speech-Java-API\r\n\r\n [ ![Download](https://api.bintray.com/packages/kilianb/maven/GoogleTranslatorTTS/images/download.svg) ](https://bintray.com/kilianb/maven/GoogleTranslatorTTS/_latestVersion)\r\n\r\n\r\nConvert long strings of text into .mp3 files in real time utilizing googles translator text to speech service. Supports multi-language- requests and multi-threading resulting in usually responds times of \u003c .75 seconds. \r\n\r\n- Lightweight\r\n- No dependencies\r\n\r\nWhile stable during the past time the translator endpoint by google is undocumented and subject to change without any notification. This library\r\nworks great for private projects and quick prototyping where ever text to speech without quote limit or fees is needed. When implementing \r\na commercial or large scale project please consider falling back to one of the official text to speech libraries\r\ne.g. \u003ca href=\"https://cloud.google.com/text-to-speech/\"\u003eGoogle Cloud\u003c/a\u003e, \u003ca href=\"https://azure.microsoft.com/en-us/services/cognitive-services/text-to-speech/\"\u003eMicrosoft Azure\u003c/a\u003e, \u003ca href=\"https://aws.amazon.com/de/polly/what-is-text-to-speech/\"\u003eAmazon web services\u003c/a\u003e.\r\n\r\n\r\n## Maven, Gradly, Ivy\r\n\r\nHosted on \u003ca href=\"https://bintray.com/kilianb/maven/GoogleTranslatorTTS\"\u003ebintray\u003c/a\u003e.\r\n\r\n````\r\n\u003crepositories\u003e\r\n  \u003crepository\u003e\r\n    \u003cid\u003ejcenter\u003c/id\u003e\r\n    \u003curl\u003ehttps://jcenter.bintray.com/\u003c/url\u003e\r\n  \u003c/repository\u003e\r\n\u003c/repositories\u003e\r\n\r\n\u003cdependency\u003e\r\n  \u003cgroupId\u003egithub.com.kilianB\u003c/groupId\u003e\r\n  \u003cartifactId\u003eGoogleTranslatorTTS\u003c/artifactId\u003e\r\n  \u003cversion\u003e1.0.1\u003c/version\u003e\r\n\u003c/dependency\u003e\r\n````\r\n\r\n## Example usage \r\n\r\n```java\r\npublic class TextToSpeechSample{\r\n    \r\n    public static void main(String[] args) {\r\n        \r\n        // 1. Simple TTS Request\r\n        \t\r\n        //Path to output mp3 directory\r\n        String outputPath = \"mpFiles/\";\r\n\r\n        //Text to convert to mp3\r\n        String text = \"When in the Course of human events it becomes necessary for one people to dissolve the political bands which have connected them with another and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation.\";\r\n        \r\n        //Create directory\r\n        File outputDirectory = new File(outputPath);\r\n        outputDirectory.mkdirs();\r\n    \r\n        //Convert the text and retrieve an mp3 file\r\n        GoogleTextToSpeech tts = new GoogleTextToSpeech(outputPath);\r\n        File convertedTextMP3 = tts.convertText(text, GLanguage.English_US, \"FileName\");\r\n        \r\n        \r\n        \r\n        // 2. Asnch non blocking TTS\r\n        \r\n        //Non blocking method. Call event handler in the observer upon finishing\r\n        boolean deleteTemporaryFiles = true;\r\n        \r\n        GoogleTextToSpeechObserver callback = new GoogleTextToSpeechAdapter() {\r\n        \t@Override\r\n        \tpublic void mergeCompleted(File f,int id) {\r\n        \t\tSystem.out.println(\"File available for playback: \" + f.getAbsolutePath());\r\n        \t}\r\n        };\r\n        \r\n        tts.convertTextAsynch(text,GLanguage.German, \"FileNameAsynch\",deleteTemporaryFiles,callback);\r\n        \r\n        \r\n        \r\n        // 3. Multi language query\r\n         \r\n        //Request an mp3 file with multiple different pronounciations\r\n        String textMult[] = new String[]{\r\n            \"The author\",\r\n            \"Immanuel Kant\",\r\n            \"argued that the human mind creates the structure of human experience, that reason is the source of morality.\"\r\n        };\r\n        \r\n        GLanguage[] language = new GLanguage[] {\r\n                GLanguage.English_GB,\r\n                GLanguage.German,\r\n                GLanguage.English_GB\r\n        };\r\n        \r\n        convertedTextMP3 = tts.convertTextMultiLanguage(textMult,language,\"FileNameMulti\");\r\n    }\r\n}\r\n```\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilianb%2Fgoogletranslatortts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkilianb%2Fgoogletranslatortts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilianb%2Fgoogletranslatortts/lists"}