{"id":15788450,"url":"https://github.com/ultcombo/ultvoice","last_synced_at":"2025-03-31T18:24:25.416Z","repository":{"id":10608416,"uuid":"12825733","full_name":"UltCombo/UltVoice","owner":"UltCombo","description":"Implement voice commands using the Speech Recognition API","archived":false,"fork":false,"pushed_at":"2013-09-15T09:09:43.000Z","size":144,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-18T13:56:13.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/UltCombo.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":"2013-09-14T07:11:23.000Z","updated_at":"2016-08-17T11:59:32.000Z","dependencies_parsed_at":"2022-09-17T04:51:15.709Z","dependency_job_id":null,"html_url":"https://github.com/UltCombo/UltVoice","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltCombo%2FUltVoice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltCombo%2FUltVoice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltCombo%2FUltVoice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UltCombo%2FUltVoice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UltCombo","download_url":"https://codeload.github.com/UltCombo/UltVoice/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246516109,"owners_count":20790175,"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":[],"created_at":"2024-10-04T22:00:25.851Z","updated_at":"2025-03-31T18:24:25.393Z","avatar_url":"https://github.com/UltCombo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"UltVoice\n========\n\nImplement voice commands through the [Speech Recognition API](https://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html)\n\n## Usage\n\nInclude the script (either minified or development version):\n```html\n\u003cscript src=\"path/to/ultvoice.min.js\"\u003e\u003c/script\u003e\n```\n\nThis will expose a global `ultvoice` object which provides the API documented below.\n\nNow, [push](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push) object(s) to ultvoice's `actions` array:\n\n```js\nultvoice.actions.push({\n\ttrigger: 'open',\n\tcallback: function(address) {\n\t\tlocation = 'http://' + address;\n\t}\n});\n```\n\nAll you need to do now is simply call `ultvoice.start()` to start listening for voice input! Then just say \"open google.com\" and you will be redirected to Google. `=]`\n\nKeep reading for the API details.\n\n## Internationalization\n\nThe `action` objects' `trigger` property accepts either a string or array. This way, you can specify an array of triggers for multiple languages:\n\n```js\nultvoice.actions.push({\n\ttrigger: ['open', 'abra'],\n\tcallback: function(address) {\n\t\tlocation = 'http://' + address;\n\t}\n});\nultvoice.start();\n```\n\nAnd now saying either \"open google dot com\" or \"abra google ponto com\" (Portuguese) will redirect the page to `http://google.com`.\n\nThis feature can also be used implement synonyms (mutliple words in a given language to trigger the same callback).\n\n## The action object\n\nEach element of the `ultvoice.actions` array must be an UltVoice action object. Action objects are nothing but plain JS objects which contain `trigger` and `callback` properties.\n\n- `trigger`: a word or array of words that will trigger the `callback` function once recognized.\n- `callback`: a function which receives N arguments which correspond to each word recognized after the `trigger` word.\n\n\n## Example with variable arguments length\n\n```js\nultvoice.actions.push({\n\ttrigger: ['write', 'escreva'],\n\tcallback: function() {\n\t\tdocument.body.innerHTML = '\u003ch1\u003e' + [].join.call(arguments, ' ') + '\u003c/h1\u003e';\n\t}\n});\nultvoice.start();\n```\nNow, everything that you say after \"write\" (or in Portuguese \"escreva\") will be printed to the page.\n\n## Testing for browser support\n\nThe `ultvoice` object will be `null` in case the browser does not support the Speech Recognition API.\n\n```js\nif (ultvoice) {\n\t//yay, do awesome speech recognition\n} else {\n\t//browser does not support speech recognition, fallback or show error/warning message\n}\n```\n\n## Removing actions from `ultvoice.actions`\n\n`ultvoice.actions` is a plain array. You can easily iterate over it, check for some criteria and remove items using [`.splice()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice), or assign to it a [`filter`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)ed copy of itself.\n\n## Debug\n\nSet `ultvoice.debug = true` to get debugging info (such as every recognized speech input) printed to the console.\n\n## Native method wrappers\n\nUpon abnormal interruption (other than `ultvoice.stop()`/`.abort()`), UltVoice will automatically ensue a request to restart speech recognition. You should always use the `ultvoice.start()`/`.stop()`/`.abort()` methods for this to work properly.\n\n## Exposed SpeechRecognition object\n\nYou can access UltVoice's SpeechRecognition object through `ultvoice.listener`. This way, you have access to the internal SpeechRecognition object and all of its API. It can be used for things that UltVoice does not abstract, e.g. setting its `lang` property.\n\n## AMD module\n\nIn case you'd like to use UltVoice as an AMD module, simply require it. In case UltVoice was `require()`d (e.g. through RequireJS) it will return the object instead of exposing a global variable.\n\n```js\nrequire.config({\n    paths: {\n        'ultvoice': 'path/to/ultvoice.min'\n    }\n});\n\nrequire(['ultvoice'], function(ultvoice) {\n\t//work with ultvoice as normal\n});\n```\n\n## Compatibility\n\nOnly Chrome has support for the Speech Recognition API thus far.\n\n## Stability\n\nThis library is currently in development, but I'll try to keep things stable in the master branch. Note that API function/property names may change so always check the changelog before updating.\n\n## Todo\n\n- `trigger` string with more than one word.\n\nFeel free to open an issue if you have ideas for useful features, or submit a PR directly if you feel like. `=]`\n\n## Changelog\n\n- 0.1: First revision.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultcombo%2Fultvoice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fultcombo%2Fultvoice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fultcombo%2Fultvoice/lists"}