{"id":37017642,"url":"https://github.com/whitemagic2014/tts-edge-java","last_synced_at":"2026-01-14T02:00:42.997Z","repository":{"id":177218597,"uuid":"660087608","full_name":"WhiteMagic2014/tts-edge-java","owner":"WhiteMagic2014","description":"java sdk for Edge Read Aloud","archived":false,"fork":false,"pushed_at":"2025-10-27T08:17:31.000Z","size":87,"stargazers_count":71,"open_issues_count":1,"forks_count":21,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-27T10:23:50.327Z","etag":null,"topics":["edge-tts","text-to-speech","tts","tts-edge-java"],"latest_commit_sha":null,"homepage":"https://server.whitemagic2014.com/tts/","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/WhiteMagic2014.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-06-29T08:06:17.000Z","updated_at":"2025-10-27T08:16:05.000Z","dependencies_parsed_at":"2025-10-27T10:21:15.832Z","dependency_job_id":null,"html_url":"https://github.com/WhiteMagic2014/tts-edge-java","commit_stats":null,"previous_names":["whitemagic2014/tts-edge-java"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/WhiteMagic2014/tts-edge-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhiteMagic2014%2Ftts-edge-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhiteMagic2014%2Ftts-edge-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhiteMagic2014%2Ftts-edge-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhiteMagic2014%2Ftts-edge-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WhiteMagic2014","download_url":"https://codeload.github.com/WhiteMagic2014/tts-edge-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WhiteMagic2014%2Ftts-edge-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["edge-tts","text-to-speech","tts","tts-edge-java"],"created_at":"2026-01-14T02:00:27.418Z","updated_at":"2026-01-14T02:00:42.966Z","avatar_url":"https://github.com/WhiteMagic2014.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tts-edge-java\n\njava sdk for Edge Read Aloud\n\n[click me have a try](https://server.whitemagic2014.com/tts/)\n\n## Setup\n\n### maven\n\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.github.whitemagic2014\u003c/groupId\u003e\n  \u003cartifactId\u003etts-edge-java\u003c/artifactId\u003e\n  \u003cversion\u003eversion\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### gradle\n\n```\nimplementation group: 'io.github.whitemagic2014', name: 'tts-edge-java', version: 'version'\n\nshort\nimplementation 'io.github.whitemagic2014:tts-edge-java:version'\n```\n\n## demo\n\n```\n    @Test\n    void convert_to_mp3_with_byte_stream() {\n        String voiceName = \"zh-CN-XiaoyiNeural\";\n        Optional\u003cVoice\u003e voiceOptional = TTSVoice.provides()\n                .stream()\n                .filter(v -\u003e voiceName.equals(v.getShortName()))\n                .findFirst();\n        if (!voiceOptional.isPresent()) {\n            throw new IllegalStateException(\"voice not found：\" + voiceName);\n        }\n        Voice voice = voiceOptional.get();\n        String content = \"你好，有什么可以帮助你的吗，今天的天气很不错呢\";\n\n        TTS tts = new TTS(voice, content)\n                .isRateLimited(true) // Set to true to resolve the rate limiting issue in certain regions.\n                .formatMp3();  // default mp3.\n//                .formatOpus() // or opus\n//                .voicePitch()\n//                .voiceRate()\n//                .voiceVolume()\n//                .connectTimeout(0) // set connect timeout\n\n        ByteArrayOutputStream stream = tts.transToAudioStream();\n        // Write to file to test if the stream is correct.\n        try (FileOutputStream fileOutputStream = new FileOutputStream(\"./storage/test.mp3\")) {\n            stream.writeTo(fileOutputStream);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n\n\n  @Test\n    void should_convert_to_mp3_file_success_with_single_content() {\n        String voiceName = \"zh-CN-XiaoyiNeural\";\n        Optional\u003cVoice\u003e voiceOptional = TTSVoice.provides()\n                .stream()\n                .filter(v -\u003e voiceName.equals(v.getShortName()))\n                .findFirst();\n        if (!voiceOptional.isPresent()) {\n            throw new IllegalStateException(\"voice not found：\" + voiceName);\n        }\n        Voice voice = voiceOptional.get();\n        String filename = voiceName + \"-\" + \"test-tts\";\n        String content = \"你好，有什么可以帮助你的吗，今天的天气很不错呢\";\n        TTS tts = new TTS(voice, content)\n                .findHeadHook()\n                .isRateLimited(true) // Set to true to resolve the rate limiting issue in certain regions.\n                .fileName(filename)// You can customize the file name; if omitted, a random file name will be generated.\n                .overwrite(true) // When the specified file name is the same, it will either overwrite or append to the file.\n                .formatMp3();  // default mp3.\n//                .formatOpus() // or opus\n//                .voicePitch()\n//                .voiceRate()\n//                .voiceVolume()\n//                .storage()  // the output file storage ,default is ./storage\n//                .connectTimeout(0) // set connect timeout\n        tts.trans();\n        // you can find the voice file in storage folder\n    }\n    \n    @Test\n    void should_convert_to_mp3_file_success_with_multi_content() throws IOException {\n        String voiceName = \"zh-CN-XiaoyiNeural\";\n        Optional\u003cVoice\u003e voiceOptional = TTSVoice.provides()\n                .stream()\n                .filter(v -\u003e voiceName.equals(v.getShortName()))\n                .findFirst();\n        if (!voiceOptional.isPresent()) {\n            throw new IllegalStateException(\"voice not found：\" + voiceName);\n        }\n        Voice voice = voiceOptional.get();\n        List\u003cTransRecord\u003e recordList = new ArrayList\u003c\u003e();\n        String store = \"./storage\";\n\n        // create batch task\n        for (int i = 0; i \u003c 100; i++) {\n            TransRecord record = new TransRecord();\n            record.setContent(i + \", hello tts, 你好，有什么可以帮助你的吗\");\n            record.setFilename(i + \".test-tts\");\n            recordList.add(record);\n            Files.deleteIfExists(Paths.get(buildFilename(store, record)));\n        }\n        new TTS(voice)\n                .findHeadHook()\n                .isRateLimited(true)\n                .overwrite(true)\n                .batch(recordList) // set batch task\n                .parallel(12) // set up 12 parallel threads\n                .storage(store)\n                .formatMp3()\n                .batchTrans(); // trans\n        for (TransRecord record : recordList) {\n            Path path = Paths.get(buildFilename(store, record));\n            Assertions.assertTrue(Files.exists(path), \"file not found in \" + path.toString());\n        }\n    }\n\n    private static String buildFilename(String store, TransRecord record) {\n        return store + File.separator + record.getFilename() + \".mp3\";\n    }\n\n\n```\n\n## Version\n\n### 1.3.3\n- Update CHROMIUM_FULL_VERSION \u0026 SEC_MS_GEC_VERSION to fix 403 error\n\n### 1.3.2\n\n- Optimize: The method name ```finishBlocking``` has been changed to ```startBlocking```. This method is used to initiate the blocking process and wait for the task to complete.\n- Fix BUG: Resolved an issue where the ```enableVttFile``` setting was incorrectly set to ```true``` by default and was not updated properly.\n- New: Introduced a new method ```transToAudioStream``` to support direct return of audio streams. [Issue#17](https://github.com/WhiteMagic2014/tts-edge-java/issues/17) [Issue#16](https://github.com/WhiteMagic2014/tts-edge-java/issues/16)\n\n### 1.3.1\n\n- Optimize: Optimize parallel tasks [PR#15](https://github.com/WhiteMagic2014/tts-edge-java/pull/15)\n\n### 1.3.0\n\n- New: Now supports batch conversion of multiple text tasks within a single TTS transaction.\n- Optimize: A new parameter, `enableVttFile`, has been added. This parameter determines whether VTT file support is enabled, with the default setting being `false`\n- Optimize: Refactored some of the code.\n- Update: Upgraded some dependency packages.\n- Thanks to user [lifeopsgo](https://github.com/lifeopsgo) for making nearly all the contributions to this version update.[PR#13](https://github.com/WhiteMagic2014/tts-edge-java/pull/13)\n\n### 1.2.6\n\n- Resolve Conversion Issues Caused by Special Characters.[PR#9](https://github.com/WhiteMagic2014/tts-edge-java/pull/9)\n\n### 1.2.5\n\n- Optimize: Setting the parameter `isRateLimited` to true can resolve rate limiting issues in certain regions.\n- Thanks to user [PoliceZ](https://github.com/PoliceZ), the answer in\n  the [issue](https://github.com/Mai-Onsyn/VeloVoice/issues/9) was helpful to me.\n\n### 1.2.4\n\n- Optimize: The default value for the `overWrite` parameter is now true.\n\n### 1.2.3\n\n- Optimize: A new parameter, `overWrite`, has been added. When the same file name is provided, if overWrite = `true`, it\n  will overwrite the original audio file and VTT subtitle file. If overWrite = `false`, it will continue to append to the\n  original audio file and VTT subtitle file.\n\n### 1.2.2\n\n- Optimize: TTS can now set connectTimeout.\n\n### 1.2.1\n\n- New: In this update, 17 new supported voices have been added, as follows:\n\n```\n    en-US-AvaMultilingualNeural\n    en-US-AndrewMultilingualNeural\n    en-US-EmmaMultilingualNeural\n    en-US-BrianMultilingualNeural\n    en-US-AvaNeural\n    en-US-AndrewNeural\n    en-US-EmmaNeural\n    en-US-BrianNeural\n    fr-CA-ThierryNeural\n    fr-FR-VivienneMultilingualNeural\n    fr-FR-RemyMultilingualNeural\n    de-DE-SeraphinaMultilingualNeural\n    de-DE-FlorianMultilingualNeural\n    it-IT-GiuseppeNeural\n    ko-KR-HyunsuNeural\n    pt-BR-ThalitaNeural\n    es-ES-XimenaNeural\n```\n\n### 1.2.0\n\n- Optimize: Now You can customize the file name; if omitted, a random file name will be generated.\n- New:  Now, while generating audio, a VTT subtitle file with the same name will be\n  created.[issue:3](https://github.com/WhiteMagic2014/tts-edge-java/issues/3)\n\n### 1.1.1\n\n- Optimize: Fix high CPU usage while waiting for a response. [PR#2](https://github.com/WhiteMagic2014/tts-edge-java/pull/2)\n\n### 1.1.0\n\n- Optimize: Now, the TTS.trans function offers the choice of receiving the output file in two formats, MP3 or opus.\n- Optimize: Add two methods to parse voice file\n\n### 1.0.1\n\n- Optimize: Now, the TTS.trans function will return the name of the voice file.\n\n### 1.0.0\n\n- Edge Read Aloud Text To Speech\n\n## License\n\nThis project is an open-sourced software licensed under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitemagic2014%2Ftts-edge-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhitemagic2014%2Ftts-edge-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhitemagic2014%2Ftts-edge-java/lists"}