{"id":22472534,"url":"https://github.com/ericbatlle/unityandroidspeechrecognizer","last_synced_at":"2025-08-02T10:30:46.129Z","repository":{"id":38977453,"uuid":"250666668","full_name":"EricBatlle/UnityAndroidSpeechRecognizer","owner":"EricBatlle","description":"🗣️ Speech recognition on Unity and Android without the annoying google popup!","archived":false,"fork":false,"pushed_at":"2023-03-05T16:27:57.000Z","size":27714,"stargazers_count":57,"open_issues_count":1,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-01T19:04:43.747Z","etag":null,"topics":["android","android-plugin","plugin","speech-recognition","speech-to-text","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"ShaderLab","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/EricBatlle.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}},"created_at":"2020-03-27T22:55:25.000Z","updated_at":"2024-04-13T16:15:23.000Z","dependencies_parsed_at":"2022-09-11T19:02:01.169Z","dependency_job_id":null,"html_url":"https://github.com/EricBatlle/UnityAndroidSpeechRecognizer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricBatlle%2FUnityAndroidSpeechRecognizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricBatlle%2FUnityAndroidSpeechRecognizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricBatlle%2FUnityAndroidSpeechRecognizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EricBatlle%2FUnityAndroidSpeechRecognizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EricBatlle","download_url":"https://codeload.github.com/EricBatlle/UnityAndroidSpeechRecognizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228461255,"owners_count":17923765,"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":["android","android-plugin","plugin","speech-recognition","speech-to-text","unity","unity3d"],"created_at":"2024-12-06T12:16:04.414Z","updated_at":"2024-12-06T12:16:06.088Z","avatar_url":"https://github.com/EricBatlle.png","language":"ShaderLab","funding_links":["https://www.buymeacoffee.com/ebatlleclavero","https://github.com/sponsors/EricBatlle","https://paypal.me/EricBatlleClavero?locale.x=es_ES"],"categories":[],"sub_categories":[],"readme":"# UnityAndroidSpeechRecognizer 🗣️\n*Created by Eric Batlle Clavero*\n\n A simple **Android App** made with **Unity** that implements a **Speech Recognizer** using Android native recognizer. \n\n**Without** the annoying **pop-up** and the option to keep the app **listening indefinitely**, not just once.\n\nThis repository is divided in 2 parts:\n\n- Unity Project (**C#**)\n- Android Plugin (**Java**)\n\n## Example 🎬\n\n\u003cp\u003e\n  \u003cimg src=\"SpeechRecognizerImage.jpeg\" alt=\"simple video gif\" width=\"246\" height=\"512\"/\u003e\n\u003c/p\u003e\n\n*In this image it is possible to see multiple results appearing on the panel after speaking to the device \"continuous text speech\". *\n\n## Donations are appreciated! 💸\n*Remember that are many ways to say thank you.*\n\nIf this plugin has been helpful remember to star the repository and consider buying me a coffee! 😀 \n\u003cp\u003e\n\u003ca href=\"https://www.buymeacoffee.com/ebatlleclavero\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-blue.png\" alt=\"Buy Me A Coffee\" width=\"144.6\" height=\"34\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nIf you like my general work and contributions consider [sponsoring me on Github](https://github.com/sponsors/EricBatlle). \n\nBut if you just want to donate straightforward, I also have [PayPal.me](https://paypal.me/EricBatlleClavero?locale.x=es_ES).\n\n## How to Install :hammer_and_wrench:\t\n\n- If you want to install the the app, you can download the APK from [here](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/releases/download/v1.3/SpeechRecognizer_1.3.apk).\n\n- If you want to install the whole project and check the code, you need to have **Unity** and **AndroidStudio** installed and updated.\n\n- If you want to install only the few files to make the plugin work and don't want the whole project, you only need to import the package **SpeechRecognizer_pckg** located inside ``UnitySpeechRecognizer/Assets/``. To import it simply drag and drop the file in your current Unity project. Remember that you can also download the package without cloning the project, simply clicking this [link](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/raw/v1.3.support/UnitySpeechRecognizer/Assets/SpeechRecognizer_pckg.unitypackage).\n\n## How to Use ⚙️\n\n#### How to use the Demo:\n- Functionality is simple, just press the **Start Listening button** and talk to your device to check the results! \n- If you want to enable/disable continuous listening mode simply press the **Continous Listening checkmark**.\n- You can also stop the current recongizer by pressing the **Stop Listening button**.\n- Set the language of the recognizer or the maximum results you want that the recognizer retrieves.\n\n#### How to use the Plugin:\n\nTo call the plugin you first need  a variable to reference it:\n```csharp\nprivate SpeechRecognizerPlugin plugin = null;\n```\nThen you have to create a new platform-specific instance by calling:\n```csharp\nplugin = SpeechRecognizerPlugin.GetPlatformPluginVersion(this.gameObject.name);\n```\nNotice that ``this.gameObject.name`` is the name of the GameObject that will have the plugin callback methods to retrieve the recognition results and errors.\nTo create those callbacks you need to add and implement the Interface ```ISpeechRecognizerPlugin``` on the same GameObject. A common implementation of the interface will be:\n```csharp\npublic void OnResult(string recognizedResult)\n{\n    char[] delimiterChars = { '~' };\n    string[] results = recognizedResult.Split(delimiterChars);\n\n    //Do something with the results\n}\n\npublic void OnError(string recognizedError)\n{\n    ERROR error = (ERROR)int.Parse(recognizedError);\n    switch (error)\n    {\n        case ERROR.UNKNOWN:\n            Debug.Log(\"\u003cb\u003eERROR: \u003c/b\u003e Unknown\");\n            break;\n        case ERROR.INVALID_LANGUAGE_FORMAT:\n            Debug.Log(\"\u003cb\u003eERROR: \u003c/b\u003e Language format is not valid\");\n            break;\n        default:\n            break;\n    }\n}\n```\nFrom so on every time you want to call any plugin feature you only have to call it like any other object:\n\nDo you want to start the recognition?\n```csharp\nplugin.StartListening();\n```\nDo you want to stop it?\n```csharp\nplugin.StopListening();\n```\nDo you want to start the recognition with continous recognition and specific language?\n```csharp\nplugin.StartListening(true, \"es-ES\");\n```\n\n#### How to scratch the code:\n- To check **Unity** project, **open the project**, select **SpeechRecognizer** scene.\nEither inside the unity project or simply dragging the **.cs** classes on your editor, you have to watch on to the classes located on ``UnitySpeechRecognizer/Assets/Scripts``. \n- To check **Android Plugin** you can do it opening the solution with **AndroidStudio** or just drag the ``SpeechRecognizerFragment.java`` class located on ``UnitySpeechRecognizerPlugin\\SpeechRecognizer\\src\\main\\java\\com\\example\\eric\\unityspeechrecognizerplugin``\n\n\n## Multiple plugins support 🔌\nThis plugin has been made following a **fragment-pattern** to avoid errors that can be derived from extending *UnityPlayerActivity*.\n\nThis way you can integrate this plugin with your projects even if they already have more plugins. **Truly pluggable**.\n\n## Upgrading dependencies and choosing plugin version 📜\nKeep in mind that the latest versions [v1.3](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/releases/tag/v1.3) and [v1.3.support](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/releases/tag/v1.3.support) of the plugin work with different android support libraries even if they have identical features.\n\n- **[v1.3](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/releases/tag/v1.3)** works with **AndroidX** dependencies. That means that is targeting **Android 9** (API level 28).\n- **[v1.3.support](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/releases/tag/v1.3.support)** works with **Support-v4** dependencies. That means that is targeting **Android 7** (API level 24).\n\n### Why multiple versions and when to use each one? \nBasically cause there are multiple plugins and SDK's out there that work with similar libraries or different API requirements.\nIf your other plugins and SDK's use API lvl 28 or above, choose [v1.3](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/releases/tag/v1.3) version.\nIf you need to target older devices (to a minimum of API level 24) choose [v1.3.support](https://github.com/EricBatlle/UnityAndroidSpeechRecognizer/releases/tag/v1.3.support) version.\n\n## Controlled Exceptions 🚨\nHow to solve some of the most typical exceptions when trying to deal with multiple plugins\n\n#### Duplicate class XXXXX found in modules classes.jar (androidx.core:core:1.0.0) and classes.jar (com.android.support:support-compat:27.1.1)\nThis exceptions means that another of your project plugins is using a library (like androidX) that internally uses the same class as another library that is using the current plugin. \nThe easiest way to solve this problem is to remove one of the lib file (usually .aar) from one of the two plugins. Keep in mind that this is only valid in case that the erased library is using specific classes that exists in the prior one.\nIn case you have Player Service Resolver on your project you can also do \"Delete Resolved Libraries\" and \"Resolve\".\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericbatlle%2Funityandroidspeechrecognizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericbatlle%2Funityandroidspeechrecognizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericbatlle%2Funityandroidspeechrecognizer/lists"}