{"id":13802807,"url":"https://github.com/zzmp/juliusjs","last_synced_at":"2025-05-15T07:03:28.593Z","repository":{"id":18490121,"uuid":"21685855","full_name":"zzmp/juliusjs","owner":"zzmp","description":"A speech recognition library for the web","archived":false,"fork":false,"pushed_at":"2024-04-19T10:52:36.000Z","size":3106,"stargazers_count":2575,"open_issues_count":17,"forks_count":175,"subscribers_count":123,"default_branch":"master","last_synced_at":"2025-04-14T10:42:43.709Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://zzmp.github.io/juliusjs","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zzmp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2014-07-10T08:11:34.000Z","updated_at":"2025-03-05T23:33:08.000Z","dependencies_parsed_at":"2024-01-13T10:42:40.309Z","dependency_job_id":"be5324d0-cb09-425a-b57d-33f8118fc6df","html_url":"https://github.com/zzmp/juliusjs","commit_stats":{"total_commits":50,"total_committers":5,"mean_commits":10.0,"dds":0.09999999999999998,"last_synced_commit":"2e9edcc276743e42687b447bf7736590d25f6c9c"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzmp%2Fjuliusjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzmp%2Fjuliusjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzmp%2Fjuliusjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zzmp%2Fjuliusjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zzmp","download_url":"https://codeload.github.com/zzmp/juliusjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254110669,"owners_count":22016447,"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-08-04T00:01:58.166Z","updated_at":"2025-05-15T07:03:28.517Z","avatar_url":"https://github.com/zzmp.png","language":"JavaScript","readme":"JuliusJS\r\n====\r\n\r\n\u003e A speech recognition library for the web\r\n\r\nTry the [live demo.](https://zzmp.github.io/juliusjs/)\r\n\r\nJuliusJS is an opinionated port of Julius to JavaScript. \u003cbr\u003e\r\nIt __actively listens to the user to transcribe what they are saying__ through a callback.\r\n\r\n```js\r\n// bootstrap JuliusJS\r\nvar julius = new Julius();\r\n\r\njulius.onrecognition = function(sentence) {\r\n    console.log(sentence);\r\n};\r\n\r\n// say \"Hello, world!\"\r\n// console logs: `\u003e HELLO WORLD`\r\n```\r\n\r\n###### Features:\r\n\r\n- Real-time transcription\r\n - Use the provided grammar, or write your own\r\n- 100% JavaScript implementation\r\n - All recognition is done in-browser through a `Worker`\r\n - Familiar event-inspired API\r\n - No external server calls\r\n\r\n## Quickstart\r\n\r\n##### Using Express 4.0\r\n\r\n1. Grab the latest version with bower\r\n - `bower install juliusjs --save`\r\n1. Include `julius.js` in your html\r\n - `\u003cscript src=\"julius.js\"\u003e\u003c/script\u003e`\r\n1. Make the scripts available to the client through your server\r\n  ```js\r\n  var express = require('express'),\r\n      app     = express();\r\n  \r\n  app.use(express.static('path/to/dist'));\r\n  ```\r\n1. In your main script, bootstrap JuliusJS and register an event listener for recognition events\r\n  ```js\r\n  // bootstrap JuliusJS\r\n  var julius = new Julius();\r\n  \r\n  // register listener\r\n  julius.onrecognition = function(sentence, score) {\r\n      // ...\r\n      console.log(sentence);\r\n  };\r\n  ```\r\n\r\n- Your site now has real-time speech recognition baked in!\r\n\r\n### Configure your own recognition grammar\r\n\r\nIn order for JuliusJS to use it, your grammar must follow the [Julius grammar specification](http://julius.sourceforge.jp/en_index.php?q=en_grammar.html). The site includes a tutorial on writing grammars.\u003cbr\u003e\r\nBy default, phonemes are defined in `voxforge/hmmdefs`, though you might find [other sites](http://www.boardman.k12.oh.us/bdms/phonological/44Phonemes.pdf) more useful as reference.\r\n\r\n- Building your own grammar requires the `mkdfa.pl` script and associated binaries, distributed with Julius.\r\n - _On Mac OS X_\r\n   - Use `./bin/mkdfa.pl`, included with this repo\r\n - _On other OS_\r\n   - Run `emscripten.sh` to populate `bin` with the necessary files\r\n\r\n1. Write a `yourGrammar.voca` file with words to be recognized\r\n - The `.voca` file defines \"word candidates\" and their pronunciations.\r\n1. Write a `yourGrammar.grammar` file with phrases composed of those words\r\n - The `.grammar` file defines \"category-level syntax, i.e. allowed connection of words by their category name.\"\r\n1. Compile the grammar using `./bin/mkdfa.pl yourGrammar`\r\n - The `.voca` and `.grammar` must be prefixed with the same name\r\n - This will generate `yourGrammar.dfa` and `yourGrammar.dict`\r\n1. Give the new `.dfa` and `.dict` files to the `Julius` constructor\r\n  \r\n  ```js\r\n  // when bootstrapping JuliusJS\r\n  var julius = new Julius('path/to/dfa', 'path/to/dict');\r\n  ```\r\n\r\n## Advanced Use\r\n\r\n### Configuring the engine\r\n\r\nThe `Julius` constructor takes three arguments which can be used to tune the engine:\r\n\r\n```js\r\nnew Julius('path/to/dfa', 'path/to/dict', options)\r\n```\r\n\r\n_Both 'path/to/dfa' and 'path/to/dict' must be set to use a custom grammar_\r\n\r\n##### 'path/to/dfa'\r\n- path to a valid `.dfa` file, generated as described [above](#configure-your-own-recognition-grammar)\r\n- if left `null`, the default grammar will be used\r\n\r\n##### 'path/to/dict'\r\n- path to a valid `.dict` file, generated as described [above](#configure-your-own-recognition-grammar)\r\n- if left `null`, the default grammar will be used\r\n\r\n##### options\r\n- `options.verbose` - _if `true`, JuliusJS will log to the console_\r\n- `options.stripSilence` - _if `true`, silence phonemes will not be included in callbacks_\r\n - `true` by default\r\n- `options.transfer` - _if `true`, captured microphone input will be piped to your speakers_\r\n - _this is mostly useful for debugging_\r\n- `options.*`\r\n - Julius supports a wide range of options. Most of these are made available here, by specifying the flag name as a key. For example: `options.zc = 30` will lower the zero-crossing threshold to 30.\u003cbr\u003e _Some of these options will break JuliusJS, so use with caution._\r\n - A reference to available options can be found in the [JuliusBook](http://julius.sourceforge.jp/juliusbook/en/).\r\n - Currently, the only supported hidden markov model is from voxforge. The `h` and `hlist` options are unsupported.\r\n\r\n## Examples\r\n\r\n### Voice Command\r\n\r\n_Coming soon..._\r\n\r\n### Keyword Spotting (e.g., API integration)\r\n\r\n_Coming soon..._\r\n\r\n### In the wild\r\n\r\n_If you use `JuliusJS` let me know, and I'll add your project to this list (or issue a pull request yourself)._\r\n\r\n1. _Coming soon..._\r\n\r\n## Motivation\r\n\r\n- Implement speech recognition in...\r\n - 100% JavaScript - no external dependencies\r\n - A familiar and _easy-to-use_ context\r\n   - Follow standard eventing patterns (e.g., `onrecognition`)\r\n- As far as accessibility, allow...\r\n - __Out-of-the-box use__\r\n   - Minimal barrier to use\r\n     - _This means commited sample files (e.g. commited emscripted library)_\r\n   - Minimal configuration\r\n     - Real-time (opinionated) use only\r\n       - Hide mfcc/wav/rawfile configurations\r\n - Useful examples (_not so much motivation, as my motivating goals_)\r\n   - Voice command\r\n   - Keyword spotting\r\n\r\n#### Future goals\r\n\r\n- Better sample recognition grammar (_improves out-of-the-box usability_)\r\n- Examples\r\n\r\n## Developers\r\n\r\n___Contributions are welcome! See `CONTRIBUTING.md` for guidelines.___\r\n\r\n### Build from source\r\n\r\n__You'll need [emscripten](http://kripken.github.io/emscripten-site/), the LLVM to JS compiler, to build this from the C source.__ Once you have that, run `./emscript.sh`. If you are missing other tools, the script will let you know.\r\n\r\nAs emscript.sh reloads and recompiles static libraries, `./reemscript.sh` is available once you've already run emscript.sh. reemscript.sh will only recompile to JavaScript based on your latest changes. This can also be run with `npm make`.\r\n\r\nAdditionally, tests \u003cs\u003eare set\u003c/s\u003e will be made to run using `npm test`.\u003cbr\u003e In the meantime,  a blank page with the JuliusJS library can be served using `npm start`.\r\n\r\n### Codemap\r\n\r\n##### emscript.sh / reemscript.sh\r\n\r\nThese scripts will compile/recompile Julius C source to JavaScript, as well as copy all other necessary files, to the **js** folder.\r\n\r\nemscript.sh will also compile binaries, which you can use to create recognition grammars or compile grammars to smaller binary files. These are copied to the **bin** folder.\r\n\r\n##### src\r\n\r\nThis is where the source for Julius will go once emscript.sh is run. emscript.sh will replace certain files in **src/julius4** with those in **src/include** in order to make **src/emscripted**, the files eventually compiled to JavaScript.\r\n\r\n- src/include/julius/app.h - _the main application header_\r\n- __src/include/julius/main.c__ - _the main application_\r\n- __src/include/julius/recogloop.c__ - _a wrapper around the recognition loop_\r\n- src/include/libjulius/src/adin_cut.c - _interactions with a microphone_\r\n- src/include/libjulius/src/m_adin.c - _initialization to Web Audio_\r\n- __src/include/libjulius/src/recogmain.c__ - _the main recognition loop_\r\n- src/include/libsent/configure[.in] - _configuration to add Web Audio_\r\n- src/include/libsent/src/adin/adin_mic_webaudio.c - _input on Web Audio_\r\n\r\n_Files in bold were changed to replace a loop with eventing, to simulate multithreading in a Worker._\r\n\r\n##### js\r\n\r\nThe home to the testing server run with `npm start`. Files are copied to this folder from **dist** with emscript.sh and reemscript.sh. If they are modified, they should be commited back to the **dist** folder.\r\n\r\n##### dist\r\n\r\nThe home for committed copies of the compiled library, as well as the wrappers that make them work: julius.js and worker.js. **dist/listener/converter.js** is the file that actually pipes Web Audio to Julius (the compiled C program).\r\n\r\n---\r\n\r\n*JuliusJS is a port of the \"Large Vocabulary Continuous Speech Recognition Engine Julius\" to JavaScript*\r\n","funding_links":[],"categories":["JavaScript","Audio"],"sub_categories":["Torrent"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzmp%2Fjuliusjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzzmp%2Fjuliusjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzzmp%2Fjuliusjs/lists"}