{"id":15640576,"url":"https://github.com/goxr3plus/java-google-speech-api","last_synced_at":"2025-04-16T03:45:46.713Z","repository":{"id":26183240,"uuid":"105692604","full_name":"goxr3plus/java-google-speech-api","owner":"goxr3plus","description":"🙊 Speech Recognition , Text To Speech , Google Translate ","archived":false,"fork":false,"pushed_at":"2023-09-10T18:45:56.000Z","size":137,"stargazers_count":81,"open_issues_count":6,"forks_count":34,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-29T04:43:19.146Z","etag":null,"topics":["google-translate","speechrecognition","text-to-speech"],"latest_commit_sha":null,"homepage":"https://github.com/goxr3plus/java-google-speech-api","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goxr3plus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":null,"patreon":"GOXR3PLUSTUDIO","open_collective":null,"ko_fi":"goxr3plusstudio","tidelift":null,"custom":"https://www.paypal.me/GOXR3PLUSCOMPANY"}},"created_at":"2017-10-03T19:15:36.000Z","updated_at":"2025-02-24T20:05:41.000Z","dependencies_parsed_at":"2023-02-19T13:30:53.020Z","dependency_job_id":"d23973b0-993c-448f-a302-bc685b00975f","html_url":"https://github.com/goxr3plus/java-google-speech-api","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goxr3plus%2Fjava-google-speech-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goxr3plus%2Fjava-google-speech-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goxr3plus%2Fjava-google-speech-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goxr3plus%2Fjava-google-speech-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goxr3plus","download_url":"https://codeload.github.com/goxr3plus/java-google-speech-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249192224,"owners_count":21227750,"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":["google-translate","speechrecognition","text-to-speech"],"created_at":"2024-10-03T11:37:39.063Z","updated_at":"2025-04-16T03:45:46.695Z","avatar_url":"https://github.com/goxr3plus.png","language":"Java","funding_links":["https://patreon.com/GOXR3PLUSTUDIO","https://ko-fi.com/goxr3plusstudio","https://www.paypal.me/GOXR3PLUSCOMPANY","https://ko-fi.com/Q5Q3WBIC"],"categories":["人工智能"],"sub_categories":[],"readme":"[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/Q5Q3WBIC)\n\nTHIS LIBRARY IS NOT SUPPORTED BY ME ACTIVELY ANYMORE , feel free to contribute :)\n\n--- \n\n\u003ch3 align=\"center\" \u003e Java Google Speech Api ( Library )\u003c/h3\u003e\n\u003cp align=\"center\"\u003e \n🎤\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n\u003csup\u003e\n\u003cb\u003e This project is designed to be simple and efficient, using the speech engines created by Google to provide functionality for parts of the API. Essentially, it is an API written in Java, including a recognizer, synthesizer, and a microphone capture utility. The project uses Google services for the synthesizer and recognizer.  While this requires an Internet connection, it provides a complete, modern, and fully functional speech API in Java.  \u003c/b\u003e \n\u003c/sup\u003e\n\u003c/p\u003e\n\n---\n\n[![Latest Version](https://img.shields.io/github/release/goxr3plus/java-google-speech-api.svg?style=flat-square)](https://github.com/goxr3plus/java-google-speech-api/releases)\n[![GitHub contributors][contributors-image]][contributors-url]\n[![HitCount](http://hits.dwyl.io/goxr3plus/java-google-speech-api.svg)](http://hits.dwyl.io/goxr3plus/java-google-speech-api)\n[![Total Downloads](https://img.shields.io/github/downloads/goxr3plus/java-google-speech-api/total.svg)](https://github.com/goxr3plus/java-google-speech-api/releases)\n\n\n[contributors-url]: https://github.com/goxr3plus/java-google-speech-api/graphs/contributors\n[contributors-image]: https://img.shields.io/github/contributors/goxr3plus/java-google-speech-api.svg\n\n\n## Google has released it's official library for [Google Speech Recognition](https://github.com/googleapis/java-speech) . Check this issue for Official Google Speech Library code solution -\u003e [#4](https://github.com/goxr3plus/java-google-speech-api/issues/4)\n\n\n### Add it to your project using JitPack :\n\nhttps://jitpack.io/private#goxr3plus/java-google-speech-api\n\n\u003eStep 1. Add the JitPack repository to your build file\n``` XML\n\u003crepositories\u003e\n\t\u003crepository\u003e\n\t   \u003cid\u003ejitpack.io\u003c/id\u003e\n\t   \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n        \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n\u003eStep 2. Add the dependency\n``` XML\n\u003cdependency\u003e\n   \u003cgroupId\u003ecom.github.goxr3plus\u003c/groupId\u003e\n   \u003cartifactId\u003ejava-google-speech-api\u003c/artifactId\u003e\n   \u003cversion\u003e8.0.0\u003c/version\u003e \n\u003c/dependency\u003e\n```\n\n\n# Java Google Speech API\n\n##### Warning : The default secret key i was using is not working anymore (because ... i have to pay lol ) , you have to make your own , check tutorials :)\n\n### Description\nThis project is designed to be simple and efficient, using the speech engines created by Google to provide functionality for parts of the API. Essentially, it is an API written in Java, including a recognizer, synthesizer, and a microphone capture utility. The project uses Google services for the synthesizer and recognizer.  While this requires an Internet connection, it provides a complete, modern, and fully functional speech API in Java.\n\n\n### Features\nThis project is separated on 3 parts :\n\n**1)** Google Speech Recognition based on Chromium Speech API (which is free with restrictions for commercial applications) through [GSpeechDuplex.java]( java-google-speech-api/src/main/java/com/darkprograms/speech/recognizer/GSpeechDuplex.java)\n\n     - Microphone Capture API is used (Wrapped around the current Java API for simplicity)\n     - Converts WAVE files from microphone input to FLAC (using existing API, see CREDITS)\n     - Retrieves Response from Google, including confidence score and text\n     \n   ##### Keep in mind that:\n   \u003eIt doesn't currently support the new official [Google Cloud Speech API](https://cloud.google.com/speech/)(which is also free but for a certain amount of words) \n   \n   ### Update 2/7/2018\n   **Check this issue for Official Google Speech Library code solution -\u003e [#4](https://github.com/goxr3plus/java-google-speech-api/issues/4)**\n\n   \n   \u003eThe new Google Cloud Speech API is not supported yet but you can see [here](https://cloud.google.com/speech/docs/reference/libraries#client-libraries-usage-java) the official Alpha Library from supported by Google\n\n| Create Google Cloud Account | Generate Speech Recognition Private API Keys |\n|:-:|:-:|\n| [![First](http://img.youtube.com/vi/1sdLrUfMBdI/0.jpg)](https://www.youtube.com/watch?v=1sdLrUfMBdI)  | [![Second](http://img.youtube.com/vi/ZUHqMn6NacY/0.jpg)](https://www.youtube.com/watch?v=ZUHqMn6NacY) |\n\n\n**2)** Google translate full support through [GoogleTranslate.java](https://github.com/goxr3plus/java-google-speech-api/blob/master/src/main/java/com/darkprograms/speech/translator/GoogleTranslate.java)\n\n    - A translator using Google Translate (courtesy of Skylion's Google Toolkit)\n\n| Tutorial 1 | Tutorial 2 |\n|:-:|:-:|\n| [![First](http://img.youtube.com/vi/H9G02EkohtU/0.jpg)](https://www.youtube.com/watch?v=H9G02EkohtU)  | [![Second](http://img.youtube.com/vi/-AMoR_WPV_M/0.jpg)](https://www.youtube.com/watch?v=-AMoR_WPV_M) |\n\n**3)** Text to Speech , Audio Synthesizer through [SynthesiserV2.java](https://github.com/goxr3plus/java-google-speech-api/blob/master/src/main/java/com/darkprograms/speech/synthesiser/SynthesiserV2.java)\n\n    - Retrieves synthesized text in an InputStream (MP3 data ready to be played)\n\n| Tutorial 1 | Tutorial 2 |\n|:-:|:-:|\n| [![First](http://img.youtube.com/vi/42-ZqfPYmVw/0.jpg)](https://www.youtube.com/watch?v=42-ZqfPYmVw)  | [![Second](http://img.youtube.com/vi/ckjURDx1JGw/0.jpg)](https://www.youtube.com/watch?v=ckjURDx1JGw) |\n\n\n\u003eThe program supports dozens of languages and even has the ability to auto-detect languages! \n\n# Maven Build\n\n\u003e Maven Clean Package [ With Javadocs produced ]\n\n```mvn clean package``` \n\n\u003e Maven Clean Package [ No Javadocs produced ]\n\n```mvn -Dmaven.javadoc.skip=true clean package``` \n\n\n\n## Java Swing speech recognition example using [GSpeechDuplex.java](https://github.com/goxr3plus/java-google-speech-api/blob/master/src/main/java/com/darkprograms/speech/recognizer/GSpeechDuplex.java)\n\n```Java\n\npackage Try_Google_Speech_Recognition_Simple;\n\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\nimport java.io.IOException;\n\nimport javax.swing.BoxLayout;\nimport javax.swing.JButton;\nimport javax.swing.JFrame;\nimport javax.swing.JLabel;\nimport javax.swing.JPanel;\nimport javax.swing.JScrollPane;\nimport javax.swing.JTextArea;\n\nimport com.darkprograms.speech.microphone.Microphone;\nimport com.darkprograms.speech.recognizer.GSpeechDuplex;\nimport com.darkprograms.speech.recognizer.GSpeechResponseListener;\nimport com.darkprograms.speech.recognizer.GoogleResponse;\n\nimport net.sourceforge.javaflacencoder.FLACFileWriter;\n\npublic class TryGoogleSpeechRecognitionSimple implements GSpeechResponseListener {\n\t\n\tpublic static void main(String[] args) throws IOException {\n\t\tfinal Microphone mic = new Microphone(FLACFileWriter.FLAC);\n\t\t// You have to make your own GOOGLE_API_KEY \n\t\tGSpeechDuplex duplex = new GSpeechDuplex(\"GOOGLE_API_KEY\");\n\t\t\n\t\tduplex.setLanguage(\"en\");\n\t\t\n\t\tJFrame frame = new JFrame(\"Jarvis Speech API DEMO\");\n\t\tframe.setDefaultCloseOperation(3);\n\t\tJTextArea response = new JTextArea();\n\t\tresponse.setEditable(false);\n\t\tresponse.setWrapStyleWord(true);\n\t\tresponse.setLineWrap(true);\n\t\t\n\t\tfinal JButton record = new JButton(\"Record\");\n\t\tfinal JButton stop = new JButton(\"Stop\");\n\t\tstop.setEnabled(false);\n\t\t\n\t\trecord.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent evt) {\n\t\t\t\tnew Thread(() -\u003e {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tduplex.recognize(mic.getTargetDataLine(), mic.getAudioFormat());\n\t\t\t\t\t} catch (Exception ex) {\n\t\t\t\t\t\tex.printStackTrace();\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}).start();\n\t\t\t\trecord.setEnabled(false);\n\t\t\t\tstop.setEnabled(true);\n\t\t\t}\n\t\t});\n\t\tstop.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\tmic.close();\n\t\t\t\tduplex.stopSpeechRecognition();\n\t\t\t\trecord.setEnabled(true);\n\t\t\t\tstop.setEnabled(false);\n\t\t\t}\n\t\t});\n\t\tJLabel infoText = new JLabel(\n\t\t\t\t\"\u003chtml\u003e\u003cdiv style=\\\"text-align: center;\\\"\u003eJust hit record and watch your voice be translated into text.\\n\u003cbr\u003eOnly English is supported by this demo, but the full API supports dozens of languages.\u003ccenter\u003e\u003c/html\u003e\",\n\t\t\t\t\n\t\t\t\t0);\n\t\tframe.getContentPane().add(infoText);\n\t\tinfoText.setAlignmentX(0.5F);\n\t\tJScrollPane scroll = new JScrollPane(response);\n\t\tframe.getContentPane().setLayout(new BoxLayout(frame.getContentPane(), 1));\n\t\tframe.getContentPane().add(scroll);\n\t\tJPanel recordBar = new JPanel();\n\t\tframe.getContentPane().add(recordBar);\n\t\trecordBar.setLayout(new BoxLayout(recordBar, 0));\n\t\trecordBar.add(record);\n\t\trecordBar.add(stop);\n\t\tframe.setVisible(true);\n\t\tframe.pack();\n\t\tframe.setSize(500, 500);\n\t\tframe.setLocationRelativeTo(null);\n\t\t\n\t\tduplex.addResponseListener(new GSpeechResponseListener() {\n\t\t\tString old_text = \"\";\n\t\t\t\n\t\t\tpublic void onResponse(GoogleResponse gr) {\n\t\t\t\tString output = \"\";\n\t\t\t\toutput = gr.getResponse();\n\t\t\t\tif (gr.getResponse() == null) {\n\t\t\t\t\tthis.old_text = response.getText();\n\t\t\t\t\tif (this.old_text.contains(\"(\")) {\n\t\t\t\t\t\tthis.old_text = this.old_text.substring(0, this.old_text.indexOf('('));\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(\"Paragraph Line Added\");\n\t\t\t\t\tthis.old_text = ( response.getText() + \"\\n\" );\n\t\t\t\t\tthis.old_text = this.old_text.replace(\")\", \"\").replace(\"( \", \"\");\n\t\t\t\t\tresponse.setText(this.old_text);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (output.contains(\"(\")) {\n\t\t\t\t\toutput = output.substring(0, output.indexOf('('));\n\t\t\t\t}\n\t\t\t\tif (!gr.getOtherPossibleResponses().isEmpty()) {\n\t\t\t\t\toutput = output + \" (\" + (String) gr.getOtherPossibleResponses().get(0) + \")\";\n\t\t\t\t}\n\t\t\t\tSystem.out.println(output);\n\t\t\t\tresponse.setText(\"\");\n\t\t\t\tresponse.append(this.old_text);\n\t\t\t\tresponse.append(output);\n\t\t\t}\n\t\t});\n\t}\n\t\n\t@Override\n\tpublic void onResponse(GoogleResponse paramGoogleResponse) {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t}\n}\n\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoxr3plus%2Fjava-google-speech-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoxr3plus%2Fjava-google-speech-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoxr3plus%2Fjava-google-speech-api/lists"}