├── .eslintrc ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── build.yml ├── .gitignore ├── .nvmrc ├── .vscode └── settings.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── assets ├── README.md ├── background.png ├── icon.icns ├── icon.ico └── movie-icon.png ├── docs ├── ADR │ ├── .keep │ ├── 13-12-2019-deepspeech-stt-electron-integration-adr.md │ └── ADR-Template.md ├── guides │ ├── .keep │ └── electron-debug.md └── notes │ ├── 2019-04-16-name-change-dpe-to-autoEdit-3.md │ ├── 2019-12-23-node-windows-path-parse-join-issue.md │ ├── 2020-02-24-electron-ipc-and-stt.md │ ├── 2020-05-14-electron-remote-refactor.md │ ├── 2021-07-26-github-actions-release.md │ └── Jeremy Apthorp- Remote Module Considered Harmful [CovalenceConf 2020].md ├── package-lock.json ├── package.json └── src ├── ElectronWrapper ├── db │ ├── annotations.json │ ├── labels.json │ ├── paperedits.json │ ├── projects.json │ └── transcripts.json ├── dbWrapper.js ├── ffmpeg-remix │ └── index.js ├── index.js ├── lib │ ├── av-metadata-reader │ │ ├── README.md │ │ ├── example-usage.js │ │ ├── examples │ │ │ ├── edlMetadata.json │ │ │ └── sampleMetadata.json │ │ └── index.js │ ├── convert-to-audio │ │ ├── example-usage.js │ │ └── index.js │ ├── convert-to-video │ │ ├── example-usage.js │ │ └── index.js │ └── transcriber │ │ ├── assemblyai │ │ ├── assemblyai-to-dpe │ │ │ ├── assemblyai-sample.json │ │ │ ├── assemblyai-speakers-sample.json │ │ │ ├── example-usage.js │ │ │ └── index.js │ │ └── index.js │ │ ├── deepspeech │ │ └── index.js │ │ ├── index.js │ │ ├── pocketsphinx-stt │ │ ├── README.md │ │ ├── example-usage.js │ │ ├── index.js │ │ ├── pocketsphinx-output-to-json │ │ │ ├── example-pocketsphinx-output.txt │ │ │ ├── example-usage.js │ │ │ └── index.js │ │ ├── pocketsphinx-to-dpe │ │ │ ├── example-output.sample.json │ │ │ ├── example-usage.js │ │ │ └── index.js │ │ ├── pocketsphinx.js │ │ ├── pocketsphinx │ │ │ ├── bin │ │ │ │ ├── pocketsphinx_batch │ │ │ │ ├── pocketsphinx_continuous │ │ │ │ └── pocketsphinx_mdef_convert │ │ │ ├── include │ │ │ │ └── pocketsphinx │ │ │ │ │ ├── cmdln_macro.h │ │ │ │ │ ├── pocketsphinx.h │ │ │ │ │ ├── pocketsphinx_export.h │ │ │ │ │ ├── ps_lattice.h │ │ │ │ │ ├── ps_mllr.h │ │ │ │ │ └── ps_search.h │ │ │ ├── lib │ │ │ │ ├── libpocketsphinx.3.dylib │ │ │ │ ├── libpocketsphinx.a │ │ │ │ ├── libpocketsphinx.dylib │ │ │ │ ├── libpocketsphinx.la │ │ │ │ ├── pkgconfig │ │ │ │ │ └── pocketsphinx.pc │ │ │ │ └── python2.7 │ │ │ │ │ └── site-packages │ │ │ │ │ └── pocketsphinx │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── __init__.pyc │ │ │ │ │ ├── __init__.pyo │ │ │ │ │ ├── _pocketsphinx.0.so │ │ │ │ │ ├── _pocketsphinx.a │ │ │ │ │ ├── _pocketsphinx.la │ │ │ │ │ ├── _pocketsphinx.so │ │ │ │ │ ├── pocketsphinx.py │ │ │ │ │ ├── pocketsphinx.pyc │ │ │ │ │ └── pocketsphinx.pyo │ │ │ └── share │ │ │ │ ├── man │ │ │ │ └── man1 │ │ │ │ │ ├── pocketsphinx_batch.1 │ │ │ │ │ ├── pocketsphinx_continuous.1 │ │ │ │ │ └── pocketsphinx_mdef_convert.1 │ │ │ │ └── pocketsphinx │ │ │ │ └── model │ │ │ │ └── en-us │ │ │ │ ├── cmudict-en-us.dict │ │ │ │ ├── en-us-phone.lm.bin │ │ │ │ ├── en-us.lm.bin │ │ │ │ └── en-us │ │ │ │ ├── README │ │ │ │ ├── feat.params │ │ │ │ ├── mdef │ │ │ │ ├── means │ │ │ │ ├── noisedict │ │ │ │ ├── sendump │ │ │ │ ├── transition_matrices │ │ │ │ └── variances │ │ └── sphinxbase │ │ │ ├── bin │ │ │ ├── sphinx_cepview │ │ │ ├── sphinx_cont_seg │ │ │ ├── sphinx_fe │ │ │ ├── sphinx_jsgf2fsg │ │ │ ├── sphinx_lm_convert │ │ │ ├── sphinx_lm_eval │ │ │ ├── sphinx_lm_sort │ │ │ └── sphinx_pitch │ │ │ ├── include │ │ │ └── sphinxbase │ │ │ │ ├── ad.h │ │ │ │ ├── agc.h │ │ │ │ ├── bio.h │ │ │ │ ├── bitarr.h │ │ │ │ ├── bitvec.h │ │ │ │ ├── byteorder.h │ │ │ │ ├── case.h │ │ │ │ ├── ckd_alloc.h │ │ │ │ ├── clapack_lite.h │ │ │ │ ├── cmd_ln.h │ │ │ │ ├── cmn.h │ │ │ │ ├── err.h │ │ │ │ ├── f2c.h │ │ │ │ ├── fe.h │ │ │ │ ├── feat.h │ │ │ │ ├── filename.h │ │ │ │ ├── fixpoint.h │ │ │ │ ├── fsg_model.h │ │ │ │ ├── genrand.h │ │ │ │ ├── glist.h │ │ │ │ ├── hash_table.h │ │ │ │ ├── heap.h │ │ │ │ ├── huff_code.h │ │ │ │ ├── jsgf.h │ │ │ │ ├── listelem_alloc.h │ │ │ │ ├── logmath.h │ │ │ │ ├── matrix.h │ │ │ │ ├── mmio.h │ │ │ │ ├── mulaw.h │ │ │ │ ├── ngram_model.h │ │ │ │ ├── pio.h │ │ │ │ ├── prim_type.h │ │ │ │ ├── priority_queue.h │ │ │ │ ├── profile.h │ │ │ │ ├── sbthread.h │ │ │ │ ├── sphinx_config.h │ │ │ │ ├── sphinxbase_export.h │ │ │ │ ├── strfuncs.h │ │ │ │ └── yin.h │ │ │ ├── lib │ │ │ ├── libsphinxad.3.dylib │ │ │ ├── libsphinxad.a │ │ │ ├── libsphinxad.dylib │ │ │ ├── libsphinxad.la │ │ │ ├── libsphinxbase.3.dylib │ │ │ ├── libsphinxbase.a │ │ │ ├── libsphinxbase.dylib │ │ │ ├── libsphinxbase.la │ │ │ ├── pkgconfig │ │ │ │ └── sphinxbase.pc │ │ │ └── python2.7 │ │ │ │ └── site-packages │ │ │ │ └── sphinxbase │ │ │ │ ├── __init__.py │ │ │ │ ├── __init__.pyc │ │ │ │ ├── __init__.pyo │ │ │ │ ├── _sphinxbase.0.so │ │ │ │ ├── _sphinxbase.a │ │ │ │ ├── _sphinxbase.la │ │ │ │ ├── _sphinxbase.so │ │ │ │ ├── sphinxbase.py │ │ │ │ ├── sphinxbase.pyc │ │ │ │ └── sphinxbase.pyo │ │ │ └── share │ │ │ ├── man │ │ │ └── man1 │ │ │ │ ├── sphinx_cepview.1 │ │ │ │ ├── sphinx_cont_seg.1 │ │ │ │ ├── sphinx_fe.1 │ │ │ │ ├── sphinx_lm_convert.1 │ │ │ │ ├── sphinx_lm_eval.1 │ │ │ │ ├── sphinx_lm_sort.1 │ │ │ │ └── sphinx_pitch.1 │ │ │ └── sphinxbase │ │ │ └── swig │ │ │ ├── cmd_ln.i │ │ │ ├── fe.i │ │ │ ├── feat.i │ │ │ ├── fsg_model.i │ │ │ ├── iterators.i │ │ │ ├── jsgf.i │ │ │ ├── logmath.i │ │ │ ├── ngram_model.i │ │ │ ├── sphinxbase.i │ │ │ └── typemaps.i │ │ └── speechmatics │ │ ├── example-usage.js │ │ ├── index.js │ │ ├── send-to-speechmatics.js │ │ ├── speechmatics-sdk.js │ │ └── speechmatics-to-dpe │ │ ├── example-usage.js │ │ ├── index.js │ │ ├── speechmatics-long.sample.json │ │ ├── speechmatics-short.sample.json │ │ └── test.json └── seed-db │ ├── annotations.json │ ├── labels.json │ ├── paperedits.json │ ├── projects.json │ └── transcripts.json ├── dev-app-update.yml ├── electron-main.js ├── make-menu-template.js ├── prompt.js ├── stt-settings ├── babel.min.js ├── credentials.js ├── default-stt.js ├── index.html └── language-options │ ├── assemblyai.json │ ├── google.json │ └── speechmatics.json └── worker.html /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "parser": "babel-eslint", 3 | "plugins": [ 4 | "react" 5 | ], 6 | "extends": [ 7 | "plugin:react/recommended" 8 | ], 9 | "env": { 10 | "browser": true, 11 | "jest": true 12 | }, 13 | "rules": { 14 | "no-unused-expressions": "error", 15 | "no-trailing-spaces": "error", 16 | "no-nested-ternary": "error", 17 | "space-infix-ops": "error", 18 | "indent": ["warn", 2], 19 | "arrow-spacing": ["error", { "before": true, "after": true }], 20 | "space-in-parens": [ 0, "never" ], 21 | "template-curly-spacing": [ 2, "always" ], 22 | "array-bracket-spacing": [ 2, "always" ], 23 | "object-curly-spacing": [ 2, "always" ], 24 | "computed-property-spacing": [ 2, "never" ], 25 | "no-multiple-empty-lines": [ 2, { "max": 1, "maxEOF": 0, "maxBOF": 0 } ], 26 | "quotes": [ 1, "single", "avoid-escape" ], 27 | "no-use-before-define": [ 2, { "functions": false } ], 28 | "semi": [1, "always"], 29 | "prefer-const": 1, 30 | "react/prefer-es6-class": 0, 31 | "react/jsx-filename-extension": 0, 32 | "react/jsx-curly-spacing": [ 2, "always" ], 33 | "react/jsx-indent": [ 2, 2 ], 34 | "react/prop-types": [ 1 ], 35 | "react/no-array-index-key": [ 1 ], 36 | "class-methods-use-this": [ 1 ], 37 | "no-console": 0, 38 | "no-undef": [ 1 ], 39 | "no-case-declarations": [ 1 ], 40 | "no-return-assign": [ 1 ], 41 | "no-param-reassign": [ 1 ], 42 | "no-shadow": [ 1 ], 43 | "camelcase": [ 1 ], 44 | "no-underscore-dangle" : [0, "always"], 45 | "keyword-spacing": ["error", { "before": true, "after": true }], 46 | "newline-before-return": "error", 47 | "space-before-blocks": "error", 48 | "no-unused-vars": "error", 49 | "no-multi-spaces": "warn", 50 | "comma-spacing": ["error", { "before": false, "after": true }], 51 | "prefer-destructuring": ["error", { 52 | "VariableDeclarator": { 53 | "array": false, 54 | "object": false 55 | } 56 | }] 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: pietrop 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: pietrop 7 | --- 8 | **Is your feature request related to a problem? Please describe.** 9 | 10 | 11 | 12 | **Describe the solution you'd like** 13 | 14 | 15 | 16 | **Describe alternatives you've considered** 17 | 18 | 19 | 20 | **Additional context** 21 | 22 | 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask a question about this project 4 | title: '' 5 | labels: question 6 | assignees: pietrop 7 | 8 | --- 9 | 10 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Is your Pull Request request related to another issue in this repository ?** 2 | 3 | 4 | **Describe what the PR does** 5 | 6 | 7 | 8 | **State whether the PR is ready for review or whether it needs extra work** 9 | 10 | 11 | **Additional context** 12 | 13 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build Electron Releases 2 | on: 3 | push: 4 | tags: 5 | - '*' 6 | jobs: 7 | # Mac version M1 arm64 + older 8 | build_on_mac: 9 | if: github.event.base_ref == 'refs/heads/master' 10 | runs-on: macOS-latest 11 | steps: 12 | - uses: actions/checkout@master 13 | with: 14 | ref: master 15 | - uses: actions/setup-node@master 16 | with: 17 | node-version: 14 18 | - name: Install dependencies 19 | run: npm install 20 | - name: see directory HOME 21 | run: echo $HOME 22 | - name: Build Electron 23 | env: 24 | ELECTRON: true 25 | PUBLISH_FOR_PULL_REQUEST: false 26 | ELECTRON_CACHE: $HOME/.cache/electron 27 | ELECTRON_BUILDER_CACHE: $HOME/.cache/electron-builder 28 | USE_HARD_LINKS: false 29 | YARN_GPG: no 30 | GITHUB_TOKEN: ${{ secrets.github_token }} 31 | run: npm run build:m:publish:always 32 | - name: see directory 33 | run: ls ./dist 34 | # Linux version 35 | build_on_linux: 36 | if: github.event.base_ref == 'refs/heads/master' 37 | runs-on: ubuntu-latest 38 | steps: 39 | - uses: actions/checkout@master 40 | with: 41 | ref: master 42 | - uses: actions/setup-node@master 43 | with: 44 | node-version: 14 45 | - name: Install dependencies 46 | run: npm install 47 | - name: see directory HOME 48 | run: echo $HOME 49 | - name: Build Electron 50 | env: 51 | ELECTRON: true 52 | PUBLISH_FOR_PULL_REQUEST: false 53 | ELECTRON_CACHE: $HOME/.cache/electron 54 | ELECTRON_BUILDER_CACHE: $HOME/.cache/electron-builder 55 | USE_HARD_LINKS: false 56 | YARN_GPG: no 57 | GITHUB_TOKEN: ${{ secrets.github_token }} 58 | run: npm run build:l:publish:always 59 | - name: see directory 60 | run: ls ./dist 61 | # Windows version 62 | build_on_win: 63 | if: github.event.base_ref == 'refs/heads/master' 64 | runs-on: windows-2016 65 | steps: 66 | - uses: actions/checkout@master 67 | with: 68 | ref: master 69 | - uses: actions/setup-node@master 70 | with: 71 | node-version: 14 72 | - name: Install dependencies 73 | run: npm install 74 | - name: Build Electron on Windows 75 | env: 76 | ELECTRON: true 77 | PUBLISH_FOR_PULL_REQUEST: false 78 | ELECTRON_CACHE: $HOME/.cache/electron 79 | ELECTRON_BUILDER_CACHE: $HOME/.cache/electron-builder 80 | USE_HARD_LINKS: false 81 | YARN_GPG: no 82 | GITHUB_TOKEN: ${{ secrets.github_token }} 83 | run: npm run build:w:publish:always 84 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | # build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | 64 | # .gitignore, files to ignore when pushing to github 65 | 66 | dist/ 67 | 68 | # app.js in electron folder is generated with browserify using the npm comands. 69 | electron/app.js 70 | 71 | #ignore all video files 72 | *.wmv 73 | *.mpg 74 | *.mpeg 75 | *.mp4 76 | *.mov 77 | *.flv 78 | *.avi 79 | *.ogv 80 | *.ogg 81 | *.webm 82 | 83 | #ignore audio file 84 | *.wav 85 | *.mp3 86 | 87 | #ingore subtitles files 88 | *.srt 89 | *.sbv 90 | 91 | 92 | # Logs 93 | logs 94 | *.log 95 | 96 | # Runtime data 97 | pids 98 | *.pid 99 | *.seed 100 | 101 | 102 | # app ready for distribution 103 | dist 104 | 105 | # build/ 106 | 107 | # Dependency directory 108 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 109 | node_modules 110 | 111 | 112 | .idea 113 | # Notes 114 | 115 | # notes.md 116 | 117 | .env 118 | 119 | # mac file system 120 | .DS_Store 121 | 122 | # used for packaging Adobe CEP extension, before packaging and signing, exclude to avoid conflice 123 | adobe-panel-build/ 124 | 125 | # self signed certificate needed for Adobe CEP Panel 126 | ccextensionsmac/certificate.p12 127 | 128 | # including ZXPSignCmd comand 129 | # ccextensionsmac/ZXPSignCmd 130 | 131 | # Packaged app for Adobe CEP Panel Exchange site submission or distribution. 132 | dist/com.autoedit2.it.zxp 133 | 134 | 135 | # dotenv ENV var 136 | .env 137 | 138 | .vscode 139 | 140 | build/ 141 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | lts/dubnium -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.workingDirectories": [ 3 | { 4 | "directory": "digital-paper-edit-electron", 5 | "changeProcessCWD": true 6 | } 7 | ] 8 | } -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # CONTRIBUTING - Draft 2 | 3 | This project has a [Code of Conduct](./CODE_OF_CONDUCT.md) that we expect all of our contributors to abide by, please check it out before contributing. 4 | 5 | ## Contributor license agreement 6 | By submitting code as an individual or as an entity you agree that your code is licensed the same as the [Digital Paper Edit](./LICENCE.md). 7 | 8 | ## Pull requests and branching 9 | 10 | 1. [Feel free to start by raising an issue](https://github.com/bbc/digital-paper-edit-electron/issues/new?template=feature_request.md) so that others can be aware of areas where there is active development, and if needed we can synchronies the effort. 11 | 12 | 2. [Fork the repo](https://help.github.com/articles/fork-a-repo/) 13 | 14 | 3. Before working on a feature **always** create a new branch first. Createa a branch with a meaningful name. 15 | 4. Branches should be short lived - consider doing multiple PR breaking down functionalities as opposed to one big change. 16 | 5. If you've added code that should be tested, add tests, if you need help with automated testing, feel free to raise an [issue](https://github.com/bbc/digital-paper-edit-electron/issues/new?template=feature_request.md). 17 | 6. Ensure the test suite passes. 18 | 7. Make sure your code lints. 19 | 8. If you've changed APIs, consider [updating the documentation](https://github.com/bbc/digital-paper-edit-electron#documentation) and QA Testing docs. 20 | 9. Once the work is complete push the branch up on to GitHub for review. Make sure your branch is up to date with `master` before making a pull request. eg use [`git merge origin/master`](https://git-scm.com/docs/git-merge) or [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) 21 | 10. Once a branch has been merged into `master`, delete it. 22 | 23 | `master` is rarely committed to directly unless the change is quite trivial or a code review is unnecessary (code formatting or documentation updates for example). 24 | 25 | ## Code Quality 26 | - Aim for solutions that are easy to explain and reason around so that others can contribute to it. 27 | - Use meaningfull descriptive variables and function names. eg avoid using `x`,`y`,`z` as variable names. 28 | - Keep lines short 29 | - Keep functions small and avoid [side effects](https://en.wikipedia.org/wiki/Side_effect_(computer_science)) when possible. 30 | - etc.. 31 | 32 | See [this blog post for more on this](https://medium.com/mindorks/how-to-write-clean-code-lessons-learnt-from-the-clean-code-robert-c-martin-9ffc7aef870c) 33 | 34 | ## Contributing checklist 35 | 36 | - [ ] Fork the repository 37 | - [ ] Create a branch with a meaningful name 38 | - [ ] Add automated tests where appropriate 39 | - [ ] Ensure test suite passes (`npm run test`) 40 | - [ ] Make sure your code lints. (`npm run lint`) 41 | - [ ] consider re-factoring for code quality and readability 42 | - [ ] Update documentation and QA docs where appropriate - [see updating the documentation](https://github.com/bbc/digital-paper-edit-electron#documentation) 43 | - [ ] Setup your PR for review 44 | 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Pietro Passarelli CC0 BBC 2019 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Digital Paper Edit - Electron app 2 | 3 | Electron Cross Platform Desktop app 4 | 5 | ---> _Work in progress_ <-- 6 | 7 | For a ready to use release of the desktop application, checkout the [user manual](https://autoedit.gitbook.io/digital-paper-edit-user-manual/installing) for more details on how to get started. 8 | 9 | [See here for overall project architecture info](https://github.com/bbc/digital-paper-edit-client#project-architecture) 10 | 11 | [Github project board (for my forks) - across linked repos](https://github.com/users/pietrop/projects/1) 12 | 13 | ## Setup 14 | 15 | 17 | 18 | ``` 19 | git clone git@github.com:bbc/digital-paper-edit-electron.git 20 | ``` 21 | 22 | ``` 23 | cd digital-paper-edit-electron 24 | ``` 25 | 26 | Optional step to setup [nvm](https://github.com/nvm-sh/nvm) to use node version 10, otherwise just use node version 10 27 | 28 | ``` 29 | nvm use || nvm install` 30 | ``` 31 | 32 | in root of project 33 | 34 | ``` 35 | npm install 36 | ``` 37 | 38 | ## Usage 39 | 40 | ``` 41 | npm start 42 | ``` 43 | 44 | ## System Architecture 45 | 46 | 47 | 48 | Electron Cross platform desktop app 49 | 50 | ## Development env 51 | 52 | 57 | 58 | - [ ] npm > `6.1.0` 59 | - [ ] node v 10 - [lts/dubnium](https://scotch.io/tutorials/whats-new-in-node-10-dubnium) 60 | - [ ] see [`.eslintrc`](./.eslintrc) in the various packages for linting rules 61 | 62 | Node version is set in node version manager [`.nvmrc`](https://github.com/creationix/nvm#nvmrc) 63 | 64 | ## Build 65 | 66 | 67 | 68 | 89 | 90 | _TBC_ 91 | 92 | ## Tests 93 | 94 | _TBC_ 95 | 96 | ## Deployment 97 | 98 | 99 | 100 | We use [Github actions](https://pietropassarelli.com/electron-github-actions.html) to build. And add new versions to [github releases](https://github.com/pietrop/digital-paper-edit-electron/releases). Every time a new commit to master is pushed with a version tag. 101 | 102 | 103 | 1. Update the version in your project's package.json file (e.g. `1.2.3`) 104 | 2. Commit that change (`git commit -m"1.2.3" -m"optional message"`) 105 | 3. Tag your commit (`git tag 1.2.3`). Make sure your tag name's format is `*.*.*`. 106 | 1. Your workflow will use this tag to detect when to create a release 107 | 4. Push your changes to GitHub (`git push && git push origin v1.2.3`) 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | ## Running a local electron build 116 | 117 | However if you want to run a build and package the app locally you can use the npm scripts 118 | 119 |
120 | Instructions for funning a local electron build 121 | 122 | 123 | 124 | To build for mac, windows, and linux 125 | 126 | ``` 127 | npm run build:mwl 128 | ``` 129 | 130 | To build for mac only 131 | 132 | ``` 133 | npm run build:m 134 | ``` 135 | 136 | To build for windows only 137 | 138 | ``` 139 | npm run build:w 140 | ``` 141 | 142 | To build for linux only 143 | 144 | ``` 145 | npm run build:l 146 | ``` 147 | 148 | The build, packaged app will be in the `/dist` folder. 149 | 150 |
-------------------------------------------------------------------------------- /assets/README.md: -------------------------------------------------------------------------------- 1 | Icon from http://www.iconarchive.com/show/atrous-icons-by-iconleak/movie-icon.html -------------------------------------------------------------------------------- /assets/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/assets/background.png -------------------------------------------------------------------------------- /assets/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/assets/icon.icns -------------------------------------------------------------------------------- /assets/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/assets/icon.ico -------------------------------------------------------------------------------- /assets/movie-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/assets/movie-icon.png -------------------------------------------------------------------------------- /docs/ADR/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/docs/ADR/.keep -------------------------------------------------------------------------------- /docs/ADR/13-12-2019-deepspeech-stt-electron-integration-adr.md: -------------------------------------------------------------------------------- 1 | # Deepspeech STT Electron Integration ADR 2 | 3 | adding support for Mozilla DeepSpeech, for higher quality STT for offline recognition. 4 | [`deepspeech-node-wrapper`](https://github.com/pietrop/deepspeech-node-wrapper) 5 | 6 | Problem as discussed in [ADR in that repository](https://github.com/pietrop/deepspeech-node-wrapper/blob/master/docs/ADR/2019-12-10-deepspeech-stt.md) is how to package the model, as it's size is 1.8gb 7 | 8 | previously open source offline STT integrated with electron [pocketsphinx](https://github.com/OpenNewsLabs/pocketsphinx-stt) where model is self contained in npm, as it's not very big (40MB). And Gentle, that [requires spinning up a separate app](https://autoedit.gitbook.io/user-manual), eg as used in [autoEdit](http://www.autoedit.io/). 9 | 10 | 11 | 12 | Decided to add option in settings for downloading Deepspeech as opposed to package it with the electron app, so that it can be optional setup for user once app is installed. 13 | 14 | - [x] add `deepspeech-node-wrapper` 15 | - [x] add logic to download model under settings in `deepspeech-node-wrapper` 16 | - [x] add logic to download model under settings in electron app 17 | - [x] package/deploy and test -------------------------------------------------------------------------------- /docs/ADR/ADR-Template.md: -------------------------------------------------------------------------------- 1 | # [short title of solved problem and solution] 2 | 3 | * Status: [accepted | superseded by [ADR-0005](0005-example.md) | deprecated | …] 4 | * Deciders: [list everyone involved in the decision] 5 | * Date: [YYYY-MM-DD when the decision was last updated] 6 | 7 | Technical Story: [description | ticket/issue URL] 8 | 9 | ## Context and Problem Statement 10 | 11 | [Describe the context and problem statement, e.g., in free form using two to three sentences. You may want to articulate the problem in form of a question.] 12 | 13 | ## Decision Drivers 14 | 15 | * [driver 1, e.g., a force, facing concern, …] 16 | * [driver 2, e.g., a force, facing concern, …] 17 | * … 18 | 19 | ## Considered Options 20 | 21 | * [option 1] 22 | * [option 2] 23 | * [option 3] 24 | * … 25 | 26 | ## Decision Outcome 27 | 28 | Chosen option: "[option 1]", because [justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force force | … | comes out best (see below)]. 29 | 30 | ### Positive Consequences 31 | 32 | * [e.g., improvement of quality attribute satisfaction, follow-up decisions required, …] 33 | * … 34 | 35 | ### Negative consequences 36 | 37 | * [e.g., compromising quality attribute, follow-up decisions required, …] 38 | * … 39 | 40 | ## Pros and Cons of the Options 41 | 42 | ### [option 1] 43 | 44 | [example | description | pointer to more information | …] 45 | 46 | * Good, because [argument a] 47 | * Good, because [argument b] 48 | * Bad, because [argument c] 49 | * … 50 | 51 | ### [option 2] 52 | 53 | [example | description | pointer to more information | …] 54 | 55 | * Good, because [argument a] 56 | * Good, because [argument b] 57 | * Bad, because [argument c] 58 | * … 59 | 60 | ### [option 3] 61 | 62 | [example | description | pointer to more information | …] 63 | 64 | * Good, because [argument a] 65 | * Good, because [argument b] 66 | * Bad, because [argument c] 67 | * … 68 | 69 | ## Links 70 | 71 | * [Link type] [Link to ADR] 72 | * … -------------------------------------------------------------------------------- /docs/guides/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/docs/guides/.keep -------------------------------------------------------------------------------- /docs/guides/electron-debug.md: -------------------------------------------------------------------------------- 1 | # Debugging Electron 2 | 3 | [Site Point article](https://www.sitepoint.com/debugging-electron-application/) 4 | 5 | ## Renderer 6 | 7 | Use **Chrome Debugger Tool**. 8 | 9 | Debug the renderer process using the Chrome Debugger Tool by using the shortcut `Option + Command + I` 10 | Apparently you can also disable this if you want by [customising your menu](https://www.christianengvall.se/electron-menu/). 11 | 12 | ## Main process 13 | 14 | ### Electron's Inspect 15 | 16 | Use **[Electron's debug option](https://electronjs.org/docs/tutorial/debugging-main-process) by passing the `--inspect`** option, like so: 17 | 18 | ```js 19 | electron --inspect=5858 your/app 20 | ``` 21 | 22 | ### VSCode 23 | 24 | Use [VS Code](https://electronjs.org/docs/tutorial/debugging-main-process-vscode) 25 | 26 | Add the following to VSCode, as `.vscode/launch.json`: 27 | 28 | ```json 29 | { 30 | "version": "0.2.0", 31 | "configurations": [ 32 | { 33 | "name": "Debug Main Process", 34 | "type": "node", 35 | "request": "launch", 36 | "cwd": "${workspaceFolder}", 37 | "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron", 38 | "windows": { 39 | "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/electron.cmd" 40 | }, 41 | "args" : ["."], 42 | "outputCapture": "std" 43 | } 44 | ] 45 | } 46 | ``` 47 | 48 | Then start adding breakpoints in your application, and run debug in VSCode. -------------------------------------------------------------------------------- /docs/notes/2019-04-16-name-change-dpe-to-autoEdit-3.md: -------------------------------------------------------------------------------- 1 | # name change - dpe to autoEdit 3 2 | Decide to change the name of the app to `autoEdit 3`, to use the `autoEdit.io` domain, and encourage `autoEdit2` users to move onto this version of the app. 3 | 4 | However would rather avoid introducing breaking changes for existing `digital-paper-edit-electron` users. 5 | so in `package.json` the `name` of the app will remain to `digital-paper-edit-electron`. but will change the `productName`. 6 | 7 | >`productName` String - As `name`, but allows you to specify a product name for your executable which contains spaces and other special characters not allowed in the name property. 8 | 9 | [see electron builder docs for more details](https://www.electron.build/configuration/configuration#configuration) 10 | 11 | in `package.json` added 12 | ```json 13 | "productName":"autoEdit 3", 14 | ``` 15 | 16 | and in `src/electron-main.js`, set the `userData` manually. 17 | 18 | 19 | `appData` on mac is `~/Library/Application Support` 20 | while `userData` is the folder within `appData`, which would default to `name` or `productName` in `package.json` 21 | 22 | ```js 23 | // set userData to use `digital-paper-edit-electron` to be backward compatible before name change from `digital-paper-edit-electron` to `autoEdit 3`; 24 | 25 | // const userDataPath = app.getPath ('userData'); 26 | const appData = app.getPath ('appData'); 27 | app.setPath ('userData', path.join(appData,"digital-paper-edit-electron")); 28 | ``` 29 | 30 | for more background info see 31 | 32 | - [electron docs - `app.setPath(name, path)`](https://www.electronjs.org/docs/api/app#appsetpathname-path) 33 | - [stackoverflow- Electron: How to set a custom directory for user data (--user-data-dir)](https://stackoverflow.com/questions/48587035/electron-how-to-set-a-custom-directory-for-user-data-user-data-dir) 34 | - [electron docs - `app.getPath(name)`](https://github.com/electron/electron/blob/master/docs/api/app.md#appgetpathname) 35 | 36 | 37 | ## side notes 38 | one concern is if someone downloads an electron build form `bbc/digital-paper-edit-electron` and wants to run it along side `autoEdit 3`. 39 | They'd be using the same `userData` folder. 40 | 41 | However since `bbc/digital-paper-edit-electron` electron version is not being activly developed, in favour of a web version, this seems to be an edge case for now. 42 | 43 | 44 | Another note, is that keeping the name of the github repos to `digital-paper-edit-*` to avoid renaming all of the forks, might cause confusion amongst developers who might want to contribute to the project, so might need to add a note or explanation somewhere, or even link to this now. While at the user facing level, adjsuting the name in the user manual, and with the new landing page it should be fairly straightforward. -------------------------------------------------------------------------------- /docs/notes/2019-12-23-node-windows-path-parse-join-issue.md: -------------------------------------------------------------------------------- 1 | # node windows path parse join issue 2 | 3 | Some notes about troubleshooting of node and path for windows electron from issue 4 | [bbc/digital-paper-edit-electron/issues/10](https://github.com/bbc/digital-paper-edit-electron/issues/10) 5 | 6 | main issue is that when converting to audio, it tries write the new audio file at path destination with double `C:\C:\`. 7 | 8 | 9 | Most likely due to issues when parsing and re-building the destination path on widows. 10 | 11 | 12 | In `convertToAudio` the function `wavFileExtension`, 13 | 14 | ```js 15 | /** 16 | * Adding an helper function to force the file extension to be `.wav` 17 | * this also allows the file extension in output file name/path to be optional 18 | * @param {string} path - path to an audio file 19 | */ 20 | function wavFileExtension(filePath) { 21 | let audioFileOutputPath = filePath; 22 | // https://nodejs.org/api/path.html#path_path_parse_path 23 | const pathParsed = path.parse(audioFileOutputPath); 24 | if (pathParsed.ext !== '.wav') { 25 | audioFileOutputPath = path.join(pathParsed.root, pathParsed.dir, `${ pathParsed.name }.wav`); 26 | } 27 | 28 | return audioFileOutputPath; 29 | } 30 | ``` 31 | 32 | `path.parse` 33 | 34 | >`> path.parse('/Users/userName/someFolder/file.mov')` 35 | 36 | ```js 37 | { 38 | root: '/', 39 | dir: '/Users/userName/someFolder', 40 | base: 'file.mov', 41 | ext: '.mov', 42 | name: 'file' 43 | } 44 | ``` 45 | 46 | `path.join` 47 | 48 | ```js 49 | path.join(pathParsed.root, pathParsed.dir, `${ pathParsed.name }.wav`); 50 | ``` 51 | Adding root and dir on windows, it adds `C:\` twice. 52 | 53 | 54 | `path.format` could be a good way to tackle this, for now trying just by removing `.root` in `path.join`. 55 | 56 | ```js 57 | function wavFileExtension(filePath) { 58 | let audioFileOutputPath = filePath; 59 | const pathParsed = path.parse(audioFileOutputPath); 60 | if (pathParsed.ext !== '.wav') { 61 | audioFileOutputPath = path.join(pathParsed.dir, `${ pathParsed.name }.wav`); 62 | } 63 | 64 | return audioFileOutputPath; 65 | } 66 | ``` 67 | -------------------------------------------------------------------------------- /docs/notes/2020-02-24-electron-ipc-and-stt.md: -------------------------------------------------------------------------------- 1 | # Electron and STT 2 | 3 | offloading STT to a hidden window render process. 4 | 5 | 6 | more here 7 | 8 | - https://medium.com/swlh/how-to-run-background-worker-processes-in-an-electron-app-e0dc310a93cc 9 | - https://www.electronjs.org/docs/api/ipc-main#ipcmain 10 | - https://www.electronjs.org/docs/api/ipc-main -------------------------------------------------------------------------------- /docs/notes/2021-07-26-github-actions-release.md: -------------------------------------------------------------------------------- 1 | 2 | >When you want to create a new release, follow these steps: 3 | > 4 | >1. Update the version in your project's package.json file (e.g. 1.2.3) 5 | >2. Commit that change (git commit -am v1.2.3) 6 | >3. Tag your commit (git tag v1.2.3). Make sure your tag name's format is v*.*.*. Your workflow will use this tag to detect when to create a release 7 | >4. Push your changes to GitHub (git push && git push --tags) 8 | >After building successfully, the action will publish your release artifacts. By default, a new release draft will be created on GitHub with download links for your app. If you want to change this behavior, have a look at the electron-builder docs. 9 | 10 | 11 | - [Electron Builder Action](https://github.com/marketplace/actions/electron-builder-action) 12 | - [electron-builder](https://www.electron.build/) 13 | - [Packaging and Publishing an Electron App](https://samuelmeuli.com/blog/2019-04-07-packaging-and-publishing-an-electron-app/) 14 | - [Building an electron app on github actions! Windows and MacOS](https://medium.com/@johnjjung/building-an-electron-app-on-github-actions-windows-and-macos-53ab69703f7c) 15 | - [List of all macOS versions - including the latest macOS](https://www.macworld.co.uk/feature/os-x-macos-versions-3662757/) 16 | - [2.6 Git Basics - Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging) 17 | - [Git tag](https://www.atlassian.com/git/tutorials/inspecting-a-repository/git-tag) 18 | 19 | 20 | 21 | --- 22 | ``` 23 | npm install electron-updater 24 | ``` 25 | 26 | `main.js` 27 | ```js 28 | const autoUpdater = require("electron-updater"); 29 | 30 | app.on("ready", () => { 31 | autoUpdater.checkForUpdatesAndNotify(); 32 | }); 33 | ``` 34 | - [auto updater](https://samuelmeuli.com/blog/2019-04-07-packaging-and-publishing-an-electron-app/) -------------------------------------------------------------------------------- /src/ElectronWrapper/db/annotations.json: -------------------------------------------------------------------------------- 1 | [{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":246.58,"end":249.34,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"example note on this annotation","_id":"72d4ac9d0f16481eac83946a0384d12d","id":"72d4ac9d0f16481eac83946a0384d12d"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":585.66,"end":596.03,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"","_id":"4de867b1f8694235b01f64e4b5628cc1"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":13.86,"end":19.58,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"","_id":"ac440b482b5842a2aa36050ed74cc132"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"29cjw29xii80000ird74yb19swa","start":19.3,"end":24.3,"labelId":"920fa8f97acc43b5bc0694b2e5648080","note":"","_id":"9d78e7fa69274497956f2efbd39351c6"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":116.26,"end":122.62,"labelId":"default","note":"","_id":"c75da56b01aa4f2ab571abcec8b9da92"},{"projectId":"10046281c4ad4938b7d0ae6fa9899bec","transcriptId":"1000cjw29xii80000ird74yb19swa","start":9.48,"end":13.72,"labelId":"default","note":"","_id":"00dd43dbcdd8419e9177784158aac9fa"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":109.41,"end":119.2,"labelId":"default","note":"","_id":"1de06f64ea5a4dd4a7f4b68dfb917d53"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":366.26,"end":368.95,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"","_id":"ef8a71a6ec684c9295b97ded19ebd383"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":55.36,"end":66.47,"labelId":"920fa8f97acc43b5bc0694b2e5648080","note":"","_id":"5c48fb82cfa9416baf480b5bab432521"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":89.86,"end":101.84,"labelId":"920fa8f97acc43b5bc0694b2e5648080","note":"","_id":"139d1ecc3c1c496892955cab9d8d0714"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":86.66,"end":100.87,"labelId":"db055983fabd40ef84dc35fbd3dfb40b","note":"","_id":"2a3e18369d9f497289730ad291ba34b8"},{"projectId":"7c2cc4f0aa0e4fbd87003ff893472911","transcriptId":"10831d28cc804245be78926c909fb6ca","start":14.8,"end":19.5,"labelId":"default","note":"","_id":"6fd2649f608b4ef29c1b5a09c4dd5b69"},{"projectId":"10046281c4ad4938b7d0ae6fa9899bec","transcriptId":"1001cjw29xii80000ird74yb19swa","start":1300.778,"end":1304.118,"labelId":"eab94271d5894c3a8800ee59cc03d7be","note":"","_id":"19fa5a25ae694393aa4a6902096a9345"}] -------------------------------------------------------------------------------- /src/ElectronWrapper/db/labels.json: -------------------------------------------------------------------------------- 1 | [{"_id":"default","id":"default","projectId":"default","value":"default","label":"Default","color":"orange","description":"A default label"},{"value":"darkblue","label":"Computer vision","color":"darkblue","description":"Talking about computer vision in robotics","projectId":"94346281c4ad4938b7d0ae6fa9899bec","_id":"db055983fabd40ef84dc35fbd3dfb40b","id":"db055983fabd40ef84dc35fbd3dfb40b"},{"value":"greenyellow","label":"Bacteria","color":"greenyellow","description":"Talking about Bacteria and technology","projectId":"94346281c4ad4938b7d0ae6fa9899bec","_id":"920fa8f97acc43b5bc0694b2e5648080","id":"920fa8f97acc43b5bc0694b2e5648080"},{"value":"deepskyblue","label":"Test","color":"deepskyblue","description":"Test blue","projectId":"54bae8166afc4b379de5d4e10b77218d","_id":"64b071fefa394b5b968c56f8b14149b7","id":"64b071fefa394b5b968c56f8b14149b7"},{"value":"crimson","label":"Robotics","color":"crimson","description":"when they speak about robotics","projectId":"94346281c4ad4938b7d0ae6fa9899bec","_id":"cb10e79c20af4a7f8b3fe8a4c789d43e","id":"cb10e79c20af4a7f8b3fe8a4c789d43e"},{"value":"deepskyblue","label":"Ethics","color":"deepskyblue","description":"","projectId":"10046281c4ad4938b7d0ae6fa9899bec","_id":"eab94271d5894c3a8800ee59cc03d7be","id":"eab94271d5894c3a8800ee59cc03d7be"},{"value":"yellow","label":"Test","color":"yellow","description":"","projectId":"94346281c4ad4938b7d0ae6fa9899bec","_id":"bddffe16cf024b2dbe74be4d64eb0ed4","id":"bddffe16cf024b2dbe74be4d64eb0ed4"}] -------------------------------------------------------------------------------- /src/ElectronWrapper/db/projects.json: -------------------------------------------------------------------------------- 1 | [{"title":"Ted Talks","description":"Ted Talks - sample project","_id":"94346281c4ad4938b7d0ae6fa9899bec"},{"title":"PBS Frontline - The Facebook Dilemma","description":"Interviews from PBS Frontline documentary, The Facebook Dilemma - sample project.","_id":"10046281c4ad4938b7d0ae6fa9899bec"}] -------------------------------------------------------------------------------- /src/ElectronWrapper/dbWrapper.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const fs = require('fs'); 3 | const diskdb = require('diskdb'); 4 | const { ipcRenderer } = require('electron'); 5 | const appPath = ipcRenderer.sendSync('synchronous-message-get-app-path', 'ping'); 6 | const dataPath = ipcRenderer.sendSync('synchronous-message-get-user-data-folder', 'ping'); 7 | 8 | const models = ['projects', 'transcripts', 'annotations', 'labels', 'paperedits']; 9 | /* eslint-disable class-methods-use-this */ 10 | class DBWrapper { 11 | constructor() { 12 | // TODO: move to user data folder, so that is in the system but not inside the app 13 | // easier to persist data between upgrades of the app 14 | let pathToDiskDb; 15 | if (process.env.NODE_ENV === 'development') { 16 | pathToDiskDb = path.join(`${appPath}`, 'src', 'ElectronWrapper', 'db'); 17 | } else { 18 | // if production - check if folder exists 19 | pathToDiskDb = path.join(dataPath, 'db'); 20 | const isDbFolderPresent = fs.existsSync(pathToDiskDb); 21 | if (!isDbFolderPresent) { 22 | fs.mkdirSync(pathToDiskDb); 23 | // seed db with demo projects 24 | models.forEach(model => { 25 | fs.copyFileSync(path.join(appPath, 'src', 'ElectronWrapper', 'seed-db', `${model}.json`), path.join(dataPath, 'db', `${model}.json`)); 26 | }); 27 | } 28 | } 29 | this.diskdb = diskdb.connect(pathToDiskDb, models); 30 | } 31 | 32 | getAll(model, id) { 33 | if (id) { 34 | return this.diskdb[model].find({ ...id }); 35 | } 36 | 37 | return this.diskdb[model].find(); 38 | } 39 | 40 | get(model, id) { 41 | return this.diskdb[model].findOne({ ...id }); 42 | } 43 | 44 | create(model, data) { 45 | return this.diskdb[model].save(data); 46 | } 47 | 48 | update(model, id, data) { 49 | return this.diskdb[model].update( 50 | { ...id }, 51 | { ...data }, 52 | { 53 | multi: false, // update multiple - default false 54 | upsert: false, // if object is not found, add it (update-insert) - default false 55 | } 56 | ); 57 | } 58 | 59 | delete(model, id) { 60 | // remove only the first match 61 | return this.diskdb[model].remove({ ...id }, false); 62 | } 63 | } 64 | const db = new DBWrapper(); 65 | Object.freeze(db); 66 | module.exports = db; 67 | -------------------------------------------------------------------------------- /src/ElectronWrapper/ffmpeg-remix/index.js: -------------------------------------------------------------------------------- 1 | const async = require('async'); 2 | const ffmpeg = require('fluent-ffmpeg'); 3 | const tmp = require('tmp'); 4 | const debug = require('debug'); 5 | const d = debug('ffmpeg-remix'); 6 | tmp.setGracefulCleanup(); 7 | 8 | const ingest = (data, tmpDir,waveForm, waveFormMode, waveFormColor) => { 9 | console.log('ingest', data, tmpDir,waveForm, waveFormMode, waveFormColor); 10 | if(data.ffmpegPath){ 11 | ffmpeg.setFfmpegPath(data.ffmpegPath); 12 | } 13 | return (input, callback) => { 14 | const ff = ffmpeg(input.source); 15 | 16 | if (input.start) { 17 | ff.seekInput(input.start); 18 | } else { 19 | input.start = 0; 20 | } 21 | 22 | if (input.end) input.duration = input.end - input.start; 23 | if (input.duration) ff.duration(input.duration); 24 | 25 | input.path = tmp.fileSync({ 26 | dir: tmpDir.name, 27 | prefix: 'ingest-', 28 | postfix: '.ts' 29 | }).name; 30 | 31 | // ff.audioCodec('copy').videoCodec('copy'); 32 | ff.videoCodec('libx264').audioCodec('aac') 33 | 34 | if(waveForm){ 35 | // default for waveform mode type 36 | let tmpWaveFormMode = 'p2p'; 37 | // but also option to customise, within available options 38 | if(waveFormMode &&(waveFormMode==='p2p'|| waveFormMode==='cline'||waveFormMode==='point'||waveFormMode==='line')){ 39 | tmpWaveFormMode = waveFormMode; 40 | } 41 | let tmpWaveFormColor = 'Red'; 42 | if(waveFormColor){ 43 | tmpWaveFormColor = waveFormColor; 44 | } 45 | // wave form reference https://trac.ffmpeg.org/wiki/Waveform 46 | // https://ffmpeg.org/ffmpeg-filters.html#showwaves 47 | // TODO: colour, and mode could be optional parameter, for mode eg line, point,p2p,cline. 48 | ff.complexFilter(`[0:a]showwaves=s=1920x1080:colors=${tmpWaveFormColor}:mode=${tmpWaveFormMode},format=yuv420p[v]`) 49 | // ff.complexFilter('[0:a]showwaves=s=1920x1080:colors=DodgerBlue:mode=cline,format=yuv420p[v]') 50 | ff.outputOption(['-map [v]','-map', '0:a']) 51 | } 52 | ff.output(input.path); 53 | 54 | ff.on('start', (commandLine) => { 55 | d(`Spawned: ${commandLine}`); 56 | }); 57 | 58 | ff.on('error', (err, stdout, stderr) => { 59 | d(err); 60 | callback(err, null); 61 | }); 62 | 63 | ff.on('end', () => { 64 | d(`Created: ${input.path}`); 65 | callback(null, input); 66 | }); 67 | 68 | ff.run(); 69 | }; 70 | }; 71 | 72 | 73 | const concat = (data, tmpDir, callback) => { 74 | if(data.ffmpegPath){ 75 | ffmpeg.setFfmpegPath(data.ffmpegPath); 76 | } 77 | return (err, ingest) => { 78 | const ff = ffmpeg(); 79 | 80 | const input = []; 81 | for (const segment of ingest) { 82 | input.push(segment.path); 83 | } 84 | 85 | ff.input(`concat:${input.join('|')}`); 86 | ff.output(data.output); 87 | 88 | ff.on('start', (commandLine) => { 89 | d(`Spawned: ${commandLine}`); 90 | }); 91 | 92 | ff.on('error', (err, stdout, stderr) => { 93 | d(err); 94 | tmpDir.removeCallback(); 95 | callback(err); 96 | }); 97 | 98 | ff.on('end', () => { 99 | d(`Created: ${data.output}`); 100 | tmpDir.removeCallback(); 101 | callback(null, data); 102 | }); 103 | 104 | ff.run(); 105 | }; 106 | }; 107 | 108 | 109 | module.exports = function (data,waveForm, waveFormMode,waveFormColor, callback) { 110 | console.log('exports',data,waveForm, waveFormMode,waveFormColor,); 111 | const tmpDir = tmp.dirSync({ 112 | unsafeCleanup: true 113 | }); 114 | 115 | if (data.limit) { 116 | async.mapLimit(data.input, data.limit, ingest(data, tmpDir,waveForm, waveFormMode, waveFormColor), concat(data, tmpDir, callback)); 117 | } else { 118 | async.map(data.input, ingest(data, tmpDir,waveForm, waveFormMode, waveFormColor), concat(data, tmpDir, callback)); 119 | } 120 | } -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/av-metadata-reader/README.md: -------------------------------------------------------------------------------- 1 | # Video Metadata Reader 2 | 3 | Read metadata for EDL such as camera timecode, video file name, card name/reel name, fps from a video file, using ffmpeg/ffprobe 4 | 5 | Reads metadata available from video and audio file using ffprobe. 6 | 7 | ```js 8 | var metadataReader = require('./index.js'); 9 | 10 | var sampleVideo = "/Users/pietropassarelli/INCOMING_FILES/autoEdit_demo_videos/RecodeLiveEditing_test/Bowman.mov"; 11 | //optional link to ffprobe 12 | var exampleFfprobePath = "/Users/pietropassarelli/Dropbox/CODE/Vox/SubtitleBurner_project/SubtitleBurner/bin/ffprobe"; 13 | 14 | metadataReader.read({ 15 | file: sampleVideo, 16 | ffprobePath: exampleFfprobePath, 17 | callback: function(resp){ 18 | console.log(JSON.stringify(resp)); 19 | } 20 | }); 21 | ``` 22 | 23 | Given a video it returns a json with metadata info needed for EDL. 24 | 25 | ```json 26 | { 27 | "filePathName": "/Users/pietropassarelli/INCOMING_FILES/autoEdit_demo_videos/RecodeLiveEditing_test/Bowman.mov", 28 | "fileName": "Bowman.mov", 29 | "date": "2016-02-18 16:38:20", 30 | "reelName": "time", 31 | "timecode": "00:01:18:56", 32 | "fps": "1/60000", 33 | "duration": 2287.285 34 | } 35 | ``` 36 | 37 | 38 | See [./index_example.js](./index_example) for example usage. And example folder for example of output. 39 | 40 | Use `readMetadata` to get a json containing all available metadata. 41 | 42 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/av-metadata-reader/example-usage.js: -------------------------------------------------------------------------------- 1 | const { readMetadataForEDL, readMetadata } = require('./index.js'); 2 | //TODO: how to test this module without testing the ffprobe binary? What is a good way to deal with the media dependency to run the test? eg you need an audio or video file to run the test. 3 | // var sampleVideo = '/Users/passap02/Documents/sample-media/PBS_Frontline/The\ Putin\ Files\ -\ Julia\ Ioffe-b1HWNcLDK88.mp4'; 4 | // const sampleVideo = 5 | // '/Users/passap02/Dropbox (BBC)/BBC News Labs/Projects/digital paper edit/demo-material/PBS Frontline - The Facebook Dilemma - interviews/video/The Facebook Dilemma - Naomi Gleit-l-Ivr6kq6fk.mp4'; 6 | const sampleVideo = '/Users/passarellip/Downloads/P1660367.MP4'; 7 | 8 | const ffprobePath = require('ffprobe-static-electron').path; 9 | 10 | readMetadataForEDL({ 11 | file: sampleVideo, 12 | ffprobePath: ffprobePath, 13 | }).then(res => { 14 | console.log(res); 15 | }); 16 | 17 | // readMetadata({ 18 | // file: sampleVideo, 19 | // ffprobePath: ffprobePath, 20 | // }).then(res => { 21 | // console.log(JSON.stringify(res, null, 2)); 22 | // }); 23 | 24 | // Guy Rosen 25 | // metadataData: '2018-11-16 19:37:41', 26 | // reelName: 'NA', 27 | // timecode: 'NA', 28 | // fps: 23.98, 29 | // duration: 1532.197333, 30 | // sampleRate: 44100 31 | 32 | // fileName: 'The Facebook Dilemma - Naomi Gleit-l-Ivr6kq6fk.mp4', 33 | // date: '2018-11-16 18:11:27', 34 | // reelName: 'NA', 35 | // timecode: 'NA', 36 | // fps: 23.98, 37 | // duration: 1643.224917, 38 | // sampleRate: 44100 39 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/av-metadata-reader/examples/edlMetadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "filePathName": "/Users/pietropassarelli/INCOMING_FILES/autoEdit_demo_videos/RecodeLiveEditing_test/Bowman.mov", 3 | "fileName": "Bowman.mov", 4 | "date": "2016-02-18 16:38:20", 5 | "reelName": "time", 6 | "timecode": "00:01:18:56", 7 | "fps": "1/60000", 8 | "duration": 2287.285 9 | } 10 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/convert-to-audio/example-usage.js: -------------------------------------------------------------------------------- 1 | const convertToAudio = require('./index.js'); 2 | 3 | const url = 'https://download.ted.com/talks/KateDarling_2018S-950k.mp4'; 4 | const audioFileOutput = './ted-talk.wav'; 5 | 6 | convertToAudio(url, audioFileOutput) 7 | .then((newFile) => { 8 | console.log(newFile); 9 | }) 10 | .catch((err)=>{ 11 | console.error(err) 12 | }) 13 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/convert-to-audio/index.js: -------------------------------------------------------------------------------- 1 | // originally from https://github.com/OpenNewsLabs/autoEdit_2/blob/master/lib/interactive_transcription_generator/transcriber/convert_to_audio.js 2 | 3 | /** 4 | * @module convertToAudio 5 | * @description Converts video or audio file into `.wav` (or any ffmpeg supported input) 6 | * takes in input file, output destination file, and returns a promise. 7 | * It converts into an audio file that meets the specs for STT services 8 | * @requires fluent-ffmpeg 9 | * @requires ffmpeg-static-electron 10 | */ 11 | 12 | const path = require('path'); 13 | const ffmpeg = require('fluent-ffmpeg'); 14 | const ffmpegBin = require('ffmpeg-static-electron'); 15 | const ffmpegBinPath = ffmpegBin.path; 16 | ffmpeg.setFfmpegPath(ffmpegBinPath); 17 | 18 | /** 19 | * Adding an helper function to force the file extension to be `.wav` 20 | * this also allows the file extension in output file name/path to be optional 21 | * @param {string} path - path to an audio file 22 | */ 23 | function wavFileExtension(filePath, uid) { 24 | let audioFileOutputPath = filePath; 25 | // https://nodejs.org/api/path.html#path_path_parse_path 26 | const pathParsed = path.parse(audioFileOutputPath); 27 | if (pathParsed.ext !== '.wav') { 28 | // audioFileOutputPath = path.join(pathParsed.root, pathParsed.dir, `${ pathParsed.name }.wav`); 29 | if(uid){ 30 | audioFileOutputPath = path.join(pathParsed.dir, `${ pathParsed.name }.${uid}.wav`); 31 | } 32 | else{ 33 | audioFileOutputPath = path.join(pathParsed.dir, `${ pathParsed.name }.wav`); 34 | } 35 | 36 | } 37 | 38 | return audioFileOutputPath; 39 | } 40 | 41 | /** 42 | * @function convertToAudio 43 | * @param {string} file - path to audio or viceo file to convert to wav 44 | * @param {string} audioFileOutput - path to output wav audio file - needs to have .wav extension 45 | * @returns {callback} callback - callback to return audio file path as string. 46 | */ 47 | function convertToAudio(file, audioFileOutput, uid) { 48 | const audioFileOutputPath = wavFileExtension(audioFileOutput, uid); 49 | 50 | return new Promise((resolve, reject) => { 51 | ffmpeg(file) 52 | .noVideo() 53 | .audioCodec('pcm_s16le') 54 | .audioChannels(1) 55 | .audioFrequency(16000) 56 | .output(audioFileOutputPath) 57 | .on('end', () => { 58 | resolve(audioFileOutputPath); 59 | }) 60 | .on('error', (err) => { 61 | reject(err); 62 | }) 63 | .run(); 64 | }); 65 | } 66 | 67 | module.exports = convertToAudio; 68 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/convert-to-video/example-usage.js: -------------------------------------------------------------------------------- 1 | const convertToVideo = require('./index.js'); 2 | // const videoFile = 'https://www.html5rocks.com/en/tutorials/video/basics/devstories.webm'; 3 | const videoFile = '/Users/passap02/Movies/The\ Paper\ Edit\ -\ video\ -\ youtube\ /The\ Paper\ Edit\ -\ Lesson\ 2\ of\ 4\ Building\ a\ Cut\ Sheet-USEJp5H3rsI.webm'; 4 | const videoHtml5OutputPathName = './paperEditTest.mp4'; 5 | 6 | convertToVideo({ 7 | src: videoFile, 8 | outputFullPathName: videoHtml5OutputPathName 9 | }) 10 | .then((newFile) => { 11 | console.log(newFile); 12 | }) 13 | .catch((err) => { 14 | console.error(err); 15 | }); 16 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/convert-to-video/index.js: -------------------------------------------------------------------------------- 1 | // originally from https://github.com/OpenNewsLabs/autoEdit_2/blob/master/lib/interactive_transcription_generator/video_to_html5/index.js 2 | /** 3 | * @module convertToVideo 4 | * @description Converts audio or video file into a HTML5 video mp4. 5 | * previous version was using webm as explained here: 6 | * uses code from [this issue/question from fluent-ffmepg](https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/274) 7 | * to understand the ffmpeg used to encode webm video see [this guide](https://trac.ffmpeg.org/wiki/Encode/VP8) 8 | * 9 | * now uses: mp4 10 | * @example Example usage 11 | 12 | convertToVideo({ 13 | src: videoFile, 14 | outputFullPathName: videoHtml5OutputPathName 15 | }) 16 | .then((newFile) => { 17 | console.log(newFile); 18 | }) 19 | .catch((err) => { 20 | console.error(err); 21 | }); 22 | 23 | * @example Example of object retunred video webm html5 24 | { 25 | videoOgg: "path/to/video/webmFile.webm", 26 | processedVideo: true 27 | } 28 | * @requires fluent-ffmpeg 29 | * @requires an ffmpeg binary. For example if packaged inside a nwjs app. This can be set in config attributes options. 30 | */ 31 | 'use strict'; 32 | const ffmpegBin = require('ffmpeg-static-electron'); 33 | const ffmpegBinPath = ffmpegBin.path; 34 | const ffmpeg = require('fluent-ffmpeg'); 35 | ffmpeg.setFfmpegPath(ffmpegBinPath); 36 | 37 | /** 38 | * @function convert 39 | * @description Takes in a config object with propreties: src, outputFullPathName, ffmpegBin and optional callback. 40 | * @param {object} config - The parameter containting attribute options. 41 | * @param {string} config.src - full path of video or audio to convert. 42 | * @param {string} config.outputFullPathName - full path of video file name, needs to have `.webm` extension. 43 | * @returns {callback} config.callback - Optional callback to return when video done processing. It returns the converted webm path name. Same as `config.outputFullPathName` input. 44 | */ 45 | const convertToVideo = function({ src, outputFullPathName }) { 46 | 47 | // ffmpeg -i inputfile -vf "scale=-1:360" -c:v libx264 -preset ultrafast -crf 40 output.mp4 48 | // executing ffmpeg comand - mp4 49 | 50 | return new Promise((resolve, reject) => { 51 | ffmpeg(src) 52 | .output(outputFullPathName) 53 | .withVideoCodec('libx264') 54 | // for details on the ffmpeg flags see https://trac.ffmpeg.org/wiki/Encode/H.264 55 | // removing '-vf scale=-1:360' to make it compatible with vertical videos. In vertical video it would work as '-vf scale=360:-1' 56 | .addOptions([ '-preset ultrafast', '-f mp4', '-crf 28', '-tune zerolatency', '-movflags +faststart' ]) 57 | // .withVideoBitrate(1024) 58 | .withAudioCodec('aac') 59 | .on('end', () => { 60 | resolve(outputFullPathName); 61 | }) 62 | .on('error', (err) => { 63 | reject(err); 64 | }) 65 | .run(); 66 | }); 67 | }; 68 | 69 | module.exports = convertToVideo; -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/assemblyai/assemblyai-to-dpe/example-usage.js: -------------------------------------------------------------------------------- 1 | const convert = require('./index.js'); 2 | // const sampleJson = require('./assemblyai-sample.json'); 3 | const sampleJson = require('./assemblyai-speakers-sample.json'); 4 | 5 | const json = convert(sampleJson); 6 | 7 | console.log(json); 8 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/assemblyai/assemblyai-to-dpe/index.js: -------------------------------------------------------------------------------- 1 | function convertMillisecondToSecond(millisecond) { 2 | var second = millisecond / 1000; 3 | 4 | return second; 5 | } 6 | 7 | function reorganisedWords(words) { 8 | return words.map((sw, index) => { 9 | return { 10 | id: index, 11 | text: sw.text, 12 | start: parseFloat(convertMillisecondToSecond(sw.start)), 13 | end: parseFloat(convertMillisecondToSecond(sw.end)), 14 | }; 15 | }); 16 | } 17 | 18 | const addSpeakerIdToWords = words => { 19 | const wordsResults = []; 20 | let paragraphId = 0; 21 | const reorgedWords = reorganisedWords(words); 22 | reorgedWords.forEach(word => { 23 | // if word contains punctuation 24 | if (/[.?!]/.test(word.text)) { 25 | word.paragraphId = paragraphId; 26 | wordsResults.push(word); 27 | paragraphId += 1; 28 | } else { 29 | word.paragraphId = paragraphId; 30 | wordsResults.push(word); 31 | } 32 | }); 33 | 34 | return wordsResults; 35 | }; 36 | 37 | const generateDpeParagraphs = words => { 38 | const wordsList = addSpeakerIdToWords(words); 39 | const paragraphs = []; 40 | let paragraph = {}; 41 | 42 | const paragraphIdsList = wordsList.map(paragraph => { 43 | return paragraph.paragraphId; 44 | }); 45 | 46 | const paragraphIdsListUniqueValues = [...new Set(paragraphIdsList)]; 47 | 48 | paragraphIdsListUniqueValues.forEach(paraId => { 49 | const wordsListForParagraph = wordsList.filter(word => { 50 | return word.paragraphId == paraId; 51 | }); 52 | 53 | const firstWord = wordsListForParagraph[0]; 54 | 55 | const lastWord = wordsListForParagraph[wordsListForParagraph.length - 1]; 56 | 57 | paragraph.start = firstWord.start; 58 | paragraph.end = lastWord.end; 59 | paragraph.speaker = 'U_UKN'; 60 | paragraphs.push(paragraph); 61 | paragraph = {}; 62 | }); 63 | 64 | return paragraphs; 65 | }; 66 | 67 | const getDpeParagraphsFromUtterances = utterances => { 68 | return utterances.map(paragraph => { 69 | const { end, start, speaker } = paragraph; 70 | return { 71 | end: convertMillisecondToSecond(end), 72 | start: convertMillisecondToSecond(start), 73 | // speaker info/label comes as a letter, eg 'A', 'B','C' etc.. 74 | speaker: `SPEAKER_${speaker}`, 75 | }; 76 | }); 77 | }; 78 | 79 | const convert = data => { 80 | const { words } = data; 81 | const wordsReorged = reorganisedWords(words); 82 | let paragraphs; 83 | // fallback if the speaker diarization / utterances are not present, just splits on paragraphs 84 | if (data.utterances) { 85 | paragraphs = getDpeParagraphsFromUtterances(data.utterances); 86 | } else { 87 | paragraphs = generateDpeParagraphs(data.words); 88 | } 89 | 90 | return { words: wordsReorged, paragraphs }; 91 | }; 92 | module.exports = convert; 93 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/assemblyai/index.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const assemblyai = require('@pietrop/assemblyai'); 3 | 4 | const { getCredentials, areCredentialsSet } = require('../../../../stt-settings/credentials.js'); 5 | 6 | // const sampleJson = require('./assemblyai-to-dpe/assemblyai-sample.json'); 7 | 8 | async function assemblyAiStt(filePath, language, languageModel) { 9 | let assemblyAiCredentials; 10 | if (areCredentialsSet('AssemblyAI')) { 11 | assemblyAiCredentials = getCredentials('AssemblyAI'); 12 | const ApiKey = assemblyAiCredentials.sttAPIKey; 13 | console.log('language', language, 'languageModel', languageModel); 14 | try { 15 | const response = await assemblyai({ 16 | ApiKey, 17 | filePath, 18 | languageModel: languageModel, 19 | acousticModel: language, 20 | }); 21 | // console.log('assemblyAi response', response); 22 | // fs.writeFileSync('asssemblyAIoutput.json', JSON.stringify(response, null, 2)); 23 | return response; 24 | // } 25 | } catch (e) { 26 | // TODO: Do some error handling here 27 | console.error('error calling AssemblyAi SDK', e); 28 | } 29 | } else { 30 | throw new Error('No credentials found for AssemblyAI'); 31 | } 32 | } 33 | 34 | module.exports = assemblyAiStt; 35 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/deepspeech/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | // const deepSpeechSttWrapper = require('deepspeech-node-wrapper'); 3 | // const convertPoketsphinxOutputToJson = require('./pocketsphinx-output-to-json/index.js'); 4 | /** 5 | * @function transcribe 6 | * @description transcribes 7 | * @param {object} config - The parameter containting attribute options. 8 | * @param {object} config.audio - file path to audio 9 | * @param {callback} cb - 10 | */ 11 | function transcribe(audioFile, models) { 12 | // console.log('deepspeech: getting started'); 13 | 14 | // return new Promise((resolve, reject) => { 15 | // // TODO: convert to audio wav specs first 16 | // deepSpeechSttWrapper(audioFile, models) 17 | // .then((res) => { 18 | // console.info('deepspeech: response '); 19 | // resolve(res); 20 | // }).catch((error) => { 21 | // console.log(error); 22 | // reject(error); 23 | // }); 24 | // }); 25 | } 26 | 27 | module.exports = transcribe; -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/index.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-case-declarations */ 2 | const fs = require("fs"); 3 | const path = require("path"); 4 | const convertToAudio = require("../convert-to-audio/index.js"); 5 | const convertAssemblyAIToDpeJson = require("./assemblyai/assemblyai-to-dpe/index.js"); 6 | const assemblyAiStt = require("./assemblyai/index"); 7 | const speechmaticsSTT = require("./speechmatics/index.js"); 8 | const convertSpeechmaticsDpe = require("./speechmatics/speechmatics-to-dpe/index.js"); 9 | const pocketsphinxSTT = require("./pocketsphinx-stt/index.js"); 10 | // const deepspeechSTT = require("./deepspeech/index.js"); 11 | const convertPocketsphinxOutputToDpe = require("./pocketsphinx-stt/pocketsphinx-to-dpe/index.js"); 12 | const { getDefaultStt } = require("../../../stt-settings/default-stt.js"); 13 | const { getDeepSpeechModelPath } = require("../../../stt-settings/credentials.js"); 14 | 15 | function getDefaultSttAndLanguage() { 16 | // const pathToDefaultStt = path.join(dataPath, 'default-stt.json'); 17 | // const defaultStt = JSON.parse(fs.readFileSync(pathToDefaultStt).toString()); 18 | const defaultStt = getDefaultStt(); 19 | console.log("getDefaultSttAndLanguage", defaultStt); 20 | 21 | return defaultStt; 22 | } 23 | 24 | const transcriber = async (data, mediaDir) => { 25 | const inputFilePath = data.path; 26 | const uid = data.id; 27 | // default stt engine and language 28 | const { provider, language, languageModel } = getDefaultSttAndLanguage(); 29 | if (!provider) { 30 | // TODO: should probably do this check and throw this error before converting video preview as well? 31 | throw new Error("Default STT Engine has not been set"); 32 | } 33 | const defaultSttEngine = provider; 34 | // returning the data from the transcription 35 | // as a way to preserve the id for this transcription job 36 | const response = {...data}; 37 | // check media folder exits 38 | if (!fs.existsSync(mediaDir)) { 39 | fs.mkdirSync(mediaDir); 40 | } 41 | 42 | // convert to audio 43 | const inputFileName = path.parse(inputFilePath).name; 44 | const inputFileNameWithExtension = `${inputFileName}${ 45 | path.parse(inputFilePath).ext 46 | }`; 47 | const audioFileOutput = path.join(mediaDir, inputFileName); 48 | 49 | // TODO: add try catch 50 | const newAudioFile = await convertToAudio(inputFilePath, audioFileOutput, uid); 51 | response.url = await newAudioFile; 52 | 53 | // transcribe 54 | switch (defaultSttEngine) { 55 | case "AssemblyAI": 56 | const assemblyAITranscript = await assemblyAiStt(newAudioFile, language, languageModel); 57 | response.transcript = await convertAssemblyAIToDpeJson( 58 | assemblyAITranscript 59 | ); 60 | response.clipName = inputFileNameWithExtension; 61 | response.sttEngine = "AssemblyAI"; 62 | return response; 63 | case "Speechmatics": 64 | // language 65 | // const transcript = await speechmaticsSTT(newAudioFile); 66 | const speechmaticsTranscript = await speechmaticsSTT( 67 | newAudioFile, 68 | language 69 | ); 70 | console.log("speechmaticsTranscript", speechmaticsTranscript); 71 | // TODO: convertSpeechmaticsToDpeJson 72 | response.transcript = convertSpeechmaticsDpe(speechmaticsTranscript); 73 | response.clipName = inputFileNameWithExtension; 74 | response.sttEngine = "Speechmatics"; 75 | return response; 76 | case "pocketsphinx": 77 | const pocketsphinxTranscript = await pocketsphinxSTT(newAudioFile); 78 | console.log("pocketsphinxTranscript", pocketsphinxTranscript); 79 | response.transcript = convertPocketsphinxOutputToDpe( 80 | pocketsphinxTranscript 81 | ); 82 | response.clipName = inputFileNameWithExtension; 83 | console.log("pocketsphinxTranscript", response); 84 | response.sttEngine = "pocketsphinx"; 85 | return response; 86 | case "deepspeech": 87 | console.log('transcriber:deepspeech') 88 | const deepspeechModelsPath = getDeepSpeechModelPath(); 89 | const deepspeechTranscript = await deepspeechSTT(newAudioFile, deepspeechModelsPath); 90 | const { dpeResult } = await deepspeechTranscript; 91 | console.log("deepspeechTranscript", deepspeechTranscript, dpeResult); 92 | response.transcript = dpeResult; 93 | response.clipName = inputFileNameWithExtension; 94 | console.log("deepspeechTranscript", response); 95 | response.sttEngine = "deepspeech"; 96 | return response; 97 | default: 98 | throw new Error( 99 | "A valid STT engine wasn't specified in the transcriber module" 100 | ); 101 | } 102 | // return transcription 103 | }; 104 | 105 | module.exports = transcriber; 106 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/README.md: -------------------------------------------------------------------------------- 1 | # Pocketsphinx offline STT 2 | 3 | 4 | ## TODO: 5 | 6 | - [ ] add `strict` to all pages and check if it still works 7 | - [?] move/copy pocketsphinx bin in `/lib/bin`. 8 | - [ ] add pocketsphinx bin as a var in cofig 9 | - [ ] add test in `/spec` folder eg "pocketsphinx" 10 | - [x] add folder and index for pockesphinx inside transcriber, option in transcription view. + check it get return hardcoded text. 11 | - [x] change parser so that it can parse into autoEdit specs. 12 | - [ ] account for paragraph, line, etc.. in parsing pocketsphinx output. 13 | 14 | 15 | [ 16 | { 17 | "id": 0, 18 | "speaker": "Unnamed Speaker", 19 | "paragraph": [ 20 | 21 | { 22 | "line": [ <-- 23 | 24 | { 25 | "id": 0, <-- 26 | startTime<-- 27 | endTime <-- 28 | text 29 | 30 | 31 | Running test on a 5 min clip, in autoEdit with pocketsphinx took:? 32 | 33 | 34 | 35 | --- 36 | 37 | ## General transcriber module 38 | 39 | - Convert to audio (stt specs) 40 | - split // into 5 min chunks 41 | - send // to STT 42 | - parse // convert results into autoEdit json spec 43 | - write out // reconnect results into one json 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/example-usage.js: -------------------------------------------------------------------------------- 1 | const pocketsphinx_transcribe = require('./index.js'); 2 | 3 | const audioFile = '/Users/passap02/seed-demo/audio/TEST.wav'; 4 | 5 | pocketsphinx_transcribe(audioFile).then((result) => { 6 | console.log(JSON.stringify(result, null, 2)); 7 | }).catch((error) => { 8 | console.log(error); 9 | }); -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @module transcribe 3 | * @description SDK to use pocketsphinx 4 | * @todo refactor with promisses. 5 | * @example Example transcribing audio 6 | 7 | pocketsphinx_transcribe(audioFile).then((result)=>{ 8 | console.log(JSON.stringify(result,null,2)); 9 | }).catch((error)=>{ 10 | console.log(error); 11 | }) 12 | 13 | * 14 | */ 15 | 16 | 'use strict'; 17 | //pockesphinx needs audio to be converted in a specific way fot it to be recognised by stt. 18 | const audioToText = require('./pocketsphinx.js'); 19 | const convertPoketsphinxOutputToJson = require('./pocketsphinx-output-to-json/index.js'); 20 | /** 21 | * @function transcribe 22 | * @description transcribes 23 | * @param {object} config - The parameter containting attribute options. 24 | * @param {object} config.audio - file path to audio 25 | * @param {callback} cb - 26 | */ 27 | function transcribe(audioFile) { 28 | console.log('pocketsphinx: getting started'); 29 | 30 | return new Promise((resolve, reject) => { 31 | audioToText(audioFile) 32 | .then((text) => { 33 | console.log('pocketsphinx: audio to text'); 34 | const res = convertPoketsphinxOutputToJson(text); 35 | console.info('pocketsphinx: convert to json'); 36 | resolve(res); 37 | }).catch((error) => { 38 | console.log(error); 39 | reject(error); 40 | }); 41 | }); 42 | } 43 | 44 | module.exports = transcribe; -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx-output-to-json/example-usage.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const convertPocketsphinxOutputToJson = require('./index.js'); 4 | 5 | const pocketsphinxOutput = fs.readFileSync(path.join(__dirname, 'example-pocketsphinx-output.txt')).toString(); 6 | 7 | const res = convertPocketsphinxOutputToJson(pocketsphinxOutput); 8 | console.log(JSON.stringify(res, null, 2)); 9 | 10 | fs.writeFileSync('./src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx-to-dpe/example-output.sample.json', JSON.stringify(res, null, 2) ); -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx-output-to-json/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @module convertPocketsphinxOutputToJson 3 | * @description Function to converts pocketSphinx transcription into autoEdit transcription json 4 | * it has not dependencies as it is only parsing the text. 5 | * @author Pietro Passarelli 6 | * 7 | * @example Example Pocketsphinx output 8 | 9 | and then may dispose of this that you could this victim in chest when you read back when the government accountability project 10 | 0.070 0.090 0.996306 11 | and 0.100 0.230 0.850170 12 | then 0.240 0.530 0.927457 13 | 0.540 0.940 0.996306 14 | may 0.950 1.250 0.063430 15 | dispose 1.260 1.750 0.045837 16 | of 1.760 2.010 0.093905 17 | this 2.020 2.290 0.128293 18 | that(2) 2.300 2.480 0.291638 19 | you 2.490 2.610 0.338197 20 | could 2.620 2.830 0.151054 21 | 2.840 2.960 0.837093 22 | this 2.970 3.340 0.669820 23 | 3.350 3.380 0.565092 24 | victim 3.390 3.860 0.109049 25 | in 3.870 4.300 0.197427 26 | 27 | ... 28 | 29 | * to autoEdit json 30 | * @example Example usage 31 | [ 32 | { 33 | "id": 0, 34 | "text": "and", 35 | "startTime": 12.09, 36 | "endTime": 12.36 37 | }, 38 | { 39 | "id": 1, 40 | "text": "like", 41 | "startTime": 12.36, 42 | "endTime": 12.53 43 | }, 44 | 45 | ... 46 | */ 47 | 'use strict'; 48 | 49 | /** 50 | * @function convertPocketsphinxOutputToJson 51 | * @description converts pocketSphinx transcription into autoEdit transcription json 52 | * @param {string} data - string, pocketsphinx speech to text recognition, see example above. 53 | * @returns {callback} - reutns an autoEdit json transcription, see example. Callback optional if synchronous. 54 | */ 55 | function convertPocketsphinxOutputToJson(data) { 56 | var pocketsphinxTimecodedLine = /|<\/s>/g; 57 | var pocketSphinxResultArray = data.split(pocketsphinxTimecodedLine); 58 | const wordsResults = []; 59 | let lineResults = []; 60 | let wordIdCounter = 0; 61 | pocketSphinxResultArray.forEach(function (line) { 62 | //excluding pocketsphinx sentences 63 | if (line.split('\n').length > 3 ) { 64 | var lineAr = line.split('\n'); 65 | //iterating over words 66 | lineAr.forEach((pocketSphinxWordString) => { 67 | if (pocketSphinxWordString !== '') { 68 | const wordAr = pocketSphinxWordString.split(' '); 69 | const text = wordAr[0]; 70 | //a condition if word is not a empty string. and other pocketsphinx symbols 71 | if (text !== '' && text !== '' && text !== '[SPEECH]') { 72 | const word = { 73 | text: text.replace(/\([0-9]+\)/g, ''), 74 | start: parseFloat(wordAr[1]), 75 | end: parseFloat(wordAr[2]), 76 | accuracy: parseFloat(wordAr[3]), 77 | id: wordIdCounter 78 | }; 79 | //removing (2) (3) accourances, which are pocketsphinx notice of use of alternate word in dictionary / model. 80 | wordIdCounter += 1; 81 | lineResults.push(word); 82 | } 83 | } 84 | }); 85 | wordsResults.push(lineResults); 86 | lineResults = []; 87 | } 88 | }); 89 | 90 | return wordsResults; 91 | } 92 | 93 | module.exports = convertPocketsphinxOutputToJson; -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx-to-dpe/example-usage.js: -------------------------------------------------------------------------------- 1 | const convertPocketsphinxOutputToDpe = require('./index.js'); 2 | const jsonData = require('./example-output.sample.json'); 3 | 4 | const res = convertPocketsphinxOutputToDpe(jsonData); 5 | console.log(res); -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx-to-dpe/index.js: -------------------------------------------------------------------------------- 1 | function flatten2DArray(oldArray) { 2 | return Array.prototype.concat.apply([], oldArray); 3 | } 4 | 5 | // at the moment this uses the 'sentence boundaries' as decided by pocketsphinx, 6 | // it doesn't use punctuation to calculate the paragraphs. 7 | function generateParagraphs(lines) { 8 | return lines.map((line, index) => { 9 | return { 10 | 'id': index, 11 | 'start': line[0].start, 12 | 'end': line[line.length - 1].end, 13 | 'speaker': 'U_UKN' 14 | }; 15 | }); 16 | } 17 | 18 | function convertPocketsphinxOutputToDpe(lines) { 19 | 20 | const paragraphs = generateParagraphs(lines); 21 | const words = flatten2DArray(lines); 22 | 23 | return { words, paragraphs }; 24 | } 25 | module.exports = convertPocketsphinxOutputToDpe; -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/bin/pocketsphinx_batch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/bin/pocketsphinx_batch -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/bin/pocketsphinx_continuous: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/bin/pocketsphinx_continuous -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/bin/pocketsphinx_mdef_convert: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/bin/pocketsphinx_mdef_convert -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/include/pocketsphinx/pocketsphinx_export.h: -------------------------------------------------------------------------------- 1 | #ifndef __POCKETSPHINX_EXPORT_H__ 2 | #define __POCKETSPHINX_EXPORT_H__ 3 | 4 | /* Win32/WinCE DLL gunk */ 5 | #if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(_WIN32_WP) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__WINSCW__) && !defined(__SYMBIAN32__) 6 | #ifdef POCKETSPHINX_EXPORTS /* Visual Studio */ 7 | #define POCKETSPHINX_EXPORT __declspec(dllexport) 8 | #else 9 | #define POCKETSPHINX_EXPORT __declspec(dllimport) 10 | #endif 11 | #else /* !_WIN32 */ 12 | #define POCKETSPHINX_EXPORT 13 | #endif 14 | 15 | #endif /* __POCKETSPHINX_EXPORT_H__ */ 16 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/include/pocketsphinx/ps_mllr.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2008 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | /** 39 | * @file ps_mllr.h Model-space linear transforms for speaker adaptation 40 | */ 41 | 42 | #ifndef __PS_MLLR_H__ 43 | #define __PS_MLLR_H__ 44 | 45 | /* SphinxBase headers. */ 46 | #include 47 | #include 48 | 49 | /* PocketSphinx headers. */ 50 | #include 51 | 52 | /** 53 | * Feature space linear transform object. 54 | */ 55 | typedef struct ps_mllr_s ps_mllr_t; 56 | 57 | /** 58 | * Read a speaker-adaptive linear transform from a file. 59 | */ 60 | POCKETSPHINX_EXPORT 61 | ps_mllr_t *ps_mllr_read(char const *file); 62 | 63 | /** 64 | * Retain a pointer to a linear transform. 65 | */ 66 | POCKETSPHINX_EXPORT 67 | ps_mllr_t *ps_mllr_retain(ps_mllr_t *mllr); 68 | 69 | /** 70 | * Release a pointer to a linear transform. 71 | */ 72 | POCKETSPHINX_EXPORT 73 | int ps_mllr_free(ps_mllr_t *mllr); 74 | 75 | #endif /* __PS_MLLR_H__ */ 76 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/libpocketsphinx.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/libpocketsphinx.3.dylib -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/libpocketsphinx.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/libpocketsphinx.a -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/libpocketsphinx.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/libpocketsphinx.dylib -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/libpocketsphinx.la: -------------------------------------------------------------------------------- 1 | # libpocketsphinx.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.5 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libpocketsphinx.3.dylib' 9 | 10 | # Names of this library. 11 | library_names='libpocketsphinx.3.dylib libpocketsphinx.dylib' 12 | 13 | # The name of the static archive. 14 | old_library='libpocketsphinx.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags=' ' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/Users/sam/Projects/pocketsphinx/../sphinxbase/lib -L/Users/sam/Projects/pocketsphinx/../sphinxbase/src/libsphinxad -L/Users/sam/Projects/pocketsphinx/../sphinxbase/src/libsphinxbase /usr/local/lib/libsphinxbase.la -lpthread -lm -lblas -llapack' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libpocketsphinx. 26 | current=3 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/sam/Projects/pocketsphinx/dist/lib' 42 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/pkgconfig/pocketsphinx.pc: -------------------------------------------------------------------------------- 1 | prefix=/Users/sam/Projects/pocketsphinx/dist 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | libs= -lsphinxbase 6 | datarootdir=${prefix}/share 7 | modeldir=${datarootdir}/pocketsphinx/model 8 | 9 | Name: PocketSphinx 10 | Description: Lightweight speech recognition system 11 | Version: 5prealpha 12 | URL: http://cmusphinx.sourceforge.net/ 13 | Requires: sphinxbase >= 5prealpha 14 | Libs: -L${libdir} -lpocketsphinx 15 | Libs.private: ${libs} -lm 16 | Cflags: -I${includedir} -I${includedir}/sphinxbase -I${includedir}/pocketsphinx 17 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | # ==================================================================== 3 | # Copyright (c) 2013 Carnegie Mellon University. All rights 4 | # reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in 15 | # the documentation and/or other materials provided with the 16 | # distribution. 17 | # 18 | # This work was supported in part by funding from the Defense Advanced 19 | # Research Projects Agency and the National Science Foundation of the 20 | # United States of America, and the CMU Sphinx Speech Consortium. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | # ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | # NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # ==================================================================== 35 | 36 | 37 | from pocketsphinx import * 38 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/__init__.pyc -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/__init__.pyo -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/_pocketsphinx.0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/_pocketsphinx.0.so -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/_pocketsphinx.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/_pocketsphinx.a -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/_pocketsphinx.la: -------------------------------------------------------------------------------- 1 | # _pocketsphinx.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.5 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='_pocketsphinx.0.so' 9 | 10 | # Names of this library. 11 | library_names='_pocketsphinx.0.so _pocketsphinx.so' 12 | 13 | # The name of the static archive. 14 | old_library='_pocketsphinx.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags=' ' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -L/Users/sam/Projects/pocketsphinx/../sphinxbase/lib -L/Users/sam/Projects/pocketsphinx/../sphinxbase/src/libsphinxad -L/Users/sam/Projects/pocketsphinx/../sphinxbase/src/libsphinxbase /Users/sam/Projects/pocketsphinx/dist/lib/libpocketsphinx.la /usr/local/lib/libsphinxbase.la -lpthread -lm -lblas -llapack' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for _pocketsphinx. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=yes 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/Users/sam/Projects/pocketsphinx/dist/lib/python2.7/site-packages/pocketsphinx' 42 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/_pocketsphinx.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/_pocketsphinx.so -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.pyc -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/lib/python2.7/site-packages/pocketsphinx/pocketsphinx.pyo -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/man/man1/pocketsphinx_mdef_convert.1: -------------------------------------------------------------------------------- 1 | .TH POCKETSPHINX_MDEF_CONVERT 1 "2007-08-27" 2 | .SH NAME 3 | pocketsphinx_mdef_convert \- Convert text-format model definition files to and from PocketSphinx format 4 | .SH SYNOPSIS 5 | .B pocketsphinx_mdef_convert 6 | [\fI options \fR] 7 | .B INPUT OUTPUT 8 | .SH DESCRIPTION 9 | .PP 10 | This program converts the text format acoustic model definition files 11 | generated by SphinxTrain into the fast binary format used by 12 | PocketSphinx. It can also convert binary files back to text format. 13 | .TP 14 | .B -text 15 | The input is in text format, and is to be converted to binary. 16 | .TP 17 | .B -bin 18 | The input is in binary format, and is to be converted to text. 19 | .SH AUTHOR 20 | Written by David Huggins-Daines . 21 | .SH COPYRIGHT 22 | Copyright \(co 2006 Carnegie Mellon University. See the file 23 | \fICOPYING\fR included with this package for more information. 24 | .br 25 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us-phone.lm.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us-phone.lm.bin -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us.lm.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us.lm.bin -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/README: -------------------------------------------------------------------------------- 1 | /* ==================================================================== 2 | * Copyright (c) 2015 Alpha Cephei Inc. All rights 3 | * reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY ALPHA CEPHEI INC. ``AS IS'' AND. 18 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,. 19 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ALPHA CEPHEI INC. 21 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT. 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,. 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY. 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT. 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE. 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * ==================================================================== 30 | * 31 | */ 32 | 33 | This directory contains generic US english acoustic model trained with 34 | latest sphinxtrain. 35 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/feat.params: -------------------------------------------------------------------------------- 1 | -lowerf 130 2 | -upperf 6800 3 | -nfilt 25 4 | -transform dct 5 | -lifter 22 6 | -feat 1s_c_d_dd 7 | -svspec 0-12/13-25/26-38 8 | -agc none 9 | -cmn current 10 | -varnorm no 11 | -model ptm 12 | -cmninit 40,3,-1 13 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/mdef: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/mdef -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/means: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/means -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/noisedict: -------------------------------------------------------------------------------- 1 | SIL 2 | SIL 3 | SIL 4 | [NOISE] +NSN+ 5 | [SPEECH] +SPN+ 6 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/sendump: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/sendump -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/transition_matrices: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/transition_matrices -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/variances: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/pocketsphinx/share/pocketsphinx/model/en-us/en-us/variances -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_cepview: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_cepview -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_cont_seg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_cont_seg -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_fe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_fe -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_jsgf2fsg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_jsgf2fsg -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_lm_convert: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_lm_convert -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_lm_eval: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_lm_eval -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_lm_sort: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | use strict; 3 | 4 | if ($ARGV[0] eq '-h' or $ARGV[0] eq '-?' or $ARGV[0] eq '--help') { 5 | print "Usage: $0 < INPUT_LM > OUTPUT_LM\n"; 6 | print "\n\tThis program reads an ARPA-format language model and"; 7 | print "\n\tsorts the N-Grams into the order required by Sphinx."; 8 | print "\n\tIt also replaces 'missing' (actually nonexistent)"; 9 | print "\n\tbackoff weights with dummy values in order to satisfy"; 10 | print "\n\tall versions of Sphinx.\n"; 11 | exit 0; 12 | } 13 | 14 | sub print_sorted_ngrams { 15 | my ($print_bo, $grams) = @_; 16 | @$grams = sort {$a->[0] cmp $b->[0]} @$grams; 17 | foreach my $g (@$grams) { 18 | my ($gram, $prob, $bo) = @$g; 19 | if ($print_bo) { 20 | printf("%.4f %s %.4f\n", $prob, $gram, $bo); 21 | } 22 | else { 23 | printf("%.4f %s\n", $prob, $gram); 24 | } 25 | } 26 | print "\n"; 27 | } 28 | 29 | my $in_data; 30 | my ($n, @ngrams); 31 | while (<>) { 32 | if (/^\\data\\/) { 33 | print; 34 | $in_data = 1; 35 | next; 36 | } 37 | unless ($in_data) { 38 | print; 39 | next; 40 | } 41 | if (/ngram (\d+)=(\d+)/) { 42 | print; 43 | next; 44 | } 45 | if (/\\(\d+)-grams:/) { 46 | print_sorted_ngrams(1,\@ngrams); 47 | $n = $1; 48 | @ngrams = (); 49 | print; 50 | next; 51 | } 52 | unless (defined($n)) { 53 | print; 54 | next; 55 | } 56 | if (/^\\end\\/) { 57 | print_sorted_ngrams(0,\@ngrams); 58 | undef $n; 59 | print; 60 | next; 61 | } 62 | my (@parts) = split; 63 | unless (@parts) { 64 | next; 65 | } 66 | my $prob = shift @parts; 67 | my $bo = 0; 68 | if (@parts == $n + 1) { 69 | $bo = pop @parts; 70 | } 71 | push @ngrams, ["@parts", $prob, $bo]; 72 | } 73 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_pitch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/bin/sphinx_pitch -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/ad.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1999-2014 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | /** \file ad.h 38 | * \brief generic live audio interface for recording and playback 39 | */ 40 | 41 | #ifndef _AD_H_ 42 | #define _AD_H_ 43 | 44 | #include 45 | 46 | #include 47 | #include 48 | 49 | #ifdef __cplusplus 50 | extern "C" { 51 | #endif 52 | #if 0 53 | /* Fool Emacs. */ 54 | } 55 | #endif 56 | 57 | #define DEFAULT_SAMPLES_PER_SEC 16000 58 | 59 | /* Return codes */ 60 | #define AD_OK 0 61 | #define AD_EOF -1 62 | #define AD_ERR_GEN -1 63 | #define AD_ERR_NOT_OPEN -2 64 | #define AD_ERR_WAVE -3 65 | 66 | typedef struct ad_rec_s ad_rec_t; 67 | 68 | /** 69 | * Open a specific audio device for recording. 70 | * 71 | * The device is opened in non-blocking mode and placed in idle state. 72 | * 73 | * @return pointer to read-only ad_rec_t structure if successful, NULL 74 | * otherwise. The return value to be used as the first argument to 75 | * other recording functions. 76 | */ 77 | SPHINXBASE_EXPORT 78 | ad_rec_t *ad_open_dev ( 79 | const char *dev, /**< Device name (platform-specific) */ 80 | int32 samples_per_sec /**< Samples per second */ 81 | ); 82 | 83 | /** 84 | * Open the default audio device with a given sampling rate. 85 | */ 86 | SPHINXBASE_EXPORT 87 | ad_rec_t *ad_open_sps ( 88 | int32 samples_per_sec /**< Samples per second */ 89 | ); 90 | 91 | 92 | /** 93 | * Open the default audio device. 94 | */ 95 | SPHINXBASE_EXPORT 96 | ad_rec_t *ad_open ( void ); 97 | 98 | 99 | /* Start audio recording. Return value: 0 if successful, <0 otherwise */ 100 | SPHINXBASE_EXPORT 101 | int32 ad_start_rec (ad_rec_t *); 102 | 103 | 104 | /* Stop audio recording. Return value: 0 if successful, <0 otherwise */ 105 | SPHINXBASE_EXPORT 106 | int32 ad_stop_rec (ad_rec_t *); 107 | 108 | 109 | /* Close the recording device. Return value: 0 if successful, <0 otherwise */ 110 | SPHINXBASE_EXPORT 111 | int32 ad_close (ad_rec_t *); 112 | 113 | /* 114 | * Read next block of audio samples while recording; read upto max samples into buf. 115 | * Return value: # samples actually read (could be 0 since non-blocking); -1 if not 116 | * recording and no more samples remaining to be read from most recent recording. 117 | */ 118 | SPHINXBASE_EXPORT 119 | int32 ad_read (ad_rec_t *, int16 *buf, int32 max); 120 | 121 | 122 | #ifdef __cplusplus 123 | } 124 | #endif 125 | 126 | #endif 127 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/byteorder.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1999-2001 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | /* 39 | * byteorder.h -- Byte swapping ordering macros. 40 | * 41 | * ********************************************** 42 | * CMU ARPA Speech Project 43 | * 44 | * Copyright (c) 1996 Carnegie Mellon University. 45 | * ALL RIGHTS RESERVED. 46 | * ********************************************** 47 | * 48 | * HISTORY 49 | * 50 | * $Log: byteorder.h,v $ 51 | * Revision 1.8 2005/09/01 21:09:54 dhdfu 52 | * Really, actually, truly consolidate byteswapping operations into 53 | * byteorder.h. Where unconditional byteswapping is needed, SWAP_INT32() 54 | * and SWAP_INT16() are to be used. The WORDS_BIGENDIAN macro from 55 | * autoconf controls the functioning of the conditional swap macros 56 | * (SWAP_?[LW]) whose names and semantics have been regularized. 57 | * Private, adhoc macros have been removed. 58 | * 59 | */ 60 | 61 | #ifndef __S2_BYTEORDER_H__ 62 | #define __S2_BYTEORDER_H__ 1 63 | 64 | /* Macro to byteswap an int16 variable. x = ptr to variable */ 65 | #define SWAP_INT16(x) *(x) = ((0x00ff & (*(x))>>8) | (0xff00 & (*(x))<<8)) 66 | 67 | /* Macro to byteswap an int32 variable. x = ptr to variable */ 68 | #define SWAP_INT32(x) *(x) = ((0x000000ff & (*(x))>>24) | \ 69 | (0x0000ff00 & (*(x))>>8) | \ 70 | (0x00ff0000 & (*(x))<<8) | \ 71 | (0xff000000 & (*(x))<<24)) 72 | 73 | /* Macro to byteswap a float32 variable. x = ptr to variable */ 74 | #define SWAP_FLOAT32(x) SWAP_INT32((int32 *) x) 75 | 76 | /* Macro to byteswap a float64 variable. x = ptr to variable */ 77 | #define SWAP_FLOAT64(x) { int *low = (int *) (x), *high = (int *) (x) + 1,\ 78 | temp;\ 79 | SWAP_INT32(low); SWAP_INT32(high);\ 80 | temp = *low; *low = *high; *high = temp;} 81 | 82 | #ifdef WORDS_BIGENDIAN 83 | #define SWAP_BE_64(x) 84 | #define SWAP_BE_32(x) 85 | #define SWAP_BE_16(x) 86 | #define SWAP_LE_64(x) SWAP_FLOAT64(x) 87 | #define SWAP_LE_32(x) SWAP_INT32(x) 88 | #define SWAP_LE_16(x) SWAP_INT16(x) 89 | #else 90 | #define SWAP_LE_64(x) 91 | #define SWAP_LE_32(x) 92 | #define SWAP_LE_16(x) 93 | #define SWAP_BE_64(x) SWAP_FLOAT64(x) 94 | #define SWAP_BE_32(x) SWAP_INT32(x) 95 | #define SWAP_BE_16(x) SWAP_INT16(x) 96 | #endif 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/case.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1999-2004 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | /* 38 | * case.h -- Upper/lower case conversion routines 39 | * 40 | * ********************************************** 41 | * CMU ARPA Speech Project 42 | * 43 | * Copyright (c) 1999 Carnegie Mellon University. 44 | * ALL RIGHTS RESERVED. 45 | * ********************************************** 46 | * 47 | * HISTORY 48 | * $Log: case.h,v $ 49 | * Revision 1.7 2005/06/22 02:58:54 arthchan2003 50 | * Added keyword 51 | * 52 | * Revision 1.3 2005/03/30 01:22:48 archan 53 | * Fixed mistakes in last updates. Add 54 | * 55 | * 56 | * 18-Jun-97 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon 57 | * Added strcmp_nocase, UPPER_CASE and LOWER_CASE definitions. 58 | * 59 | * 16-Feb-97 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon 60 | * Created. 61 | */ 62 | 63 | 64 | /** 65 | * @file case.h 66 | * @brief Locale-independent implementation of case swapping operation. 67 | * 68 | * This function implements ASCII-only case switching and comparison 69 | * related operations, which do not depend on the locale and are 70 | * guaranteed to exist on all versions of Windows. 71 | */ 72 | 73 | #ifndef _LIBUTIL_CASE_H_ 74 | #define _LIBUTIL_CASE_H_ 75 | 76 | #include 77 | 78 | #include 79 | #include 80 | 81 | #ifdef __cplusplus 82 | extern "C" { 83 | #endif 84 | #if 0 85 | /* Fool Emacs. */ 86 | } 87 | #endif 88 | 89 | /** 90 | * Return upper case form for c 91 | */ 92 | #define UPPER_CASE(c) ((((c) >= 'a') && ((c) <= 'z')) ? (c-32) : c) 93 | 94 | /** 95 | * Return lower case form for c 96 | */ 97 | #define LOWER_CASE(c) ((((c) >= 'A') && ((c) <= 'Z')) ? (c+32) : c) 98 | 99 | 100 | /** 101 | * Convert str to all upper case. 102 | * @param str is a string. 103 | */ 104 | SPHINXBASE_EXPORT 105 | void ucase(char *str); 106 | 107 | /** 108 | * Convert str to all lower case 109 | * @param str is a string. 110 | */ 111 | SPHINXBASE_EXPORT 112 | void lcase(char *str); 113 | 114 | /** 115 | * (FIXME! The implementation is incorrect!) 116 | * Case insensitive string compare. Return the usual -1, 0, +1, depending on 117 | * str1 <, =, > str2 (case insensitive, of course). 118 | * @param str1 is the first string. 119 | * @param str2 is the second string. 120 | */ 121 | SPHINXBASE_EXPORT 122 | int32 strcmp_nocase(const char *str1, const char *str2); 123 | 124 | /** 125 | * Like strcmp_nocase() but with a maximum length. 126 | */ 127 | SPHINXBASE_EXPORT 128 | int32 strncmp_nocase(const char *str1, const char *str2, size_t len); 129 | 130 | 131 | #ifdef __cplusplus 132 | } 133 | #endif 134 | 135 | #endif 136 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/clapack_lite.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | #ifndef __CLAPACK_LITE_H 3 | #define __CLAPACK_LITE_H 4 | 5 | #include "f2c.h" 6 | 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | #if 0 12 | /* Fool Emacs. */ 13 | } 14 | #endif 15 | 16 | /* Subroutine */ int sgemm_(char *transa, char *transb, integer *m, integer * 17 | n, integer *k, real *alpha, real *a, integer *lda, real *b, integer * 18 | ldb, real *beta, real *c__, integer *ldc); 19 | /* Subroutine */ int sgemv_(char *trans, integer *m, integer *n, real *alpha, 20 | real *a, integer *lda, real *x, integer *incx, real *beta, real *y, 21 | integer *incy); 22 | /* Subroutine */ int ssymm_(char *side, char *uplo, integer *m, integer *n, 23 | real *alpha, real *a, integer *lda, real *b, integer *ldb, real *beta, 24 | real *c__, integer *ldc); 25 | 26 | /* Subroutine */ int sposv_(char *uplo, integer *n, integer *nrhs, real *a, 27 | integer *lda, real *b, integer *ldb, integer *info); 28 | /* Subroutine */ int spotrf_(char *uplo, integer *n, real *a, integer *lda, 29 | integer *info); 30 | 31 | #ifdef __cplusplus 32 | } 33 | #endif 34 | 35 | 36 | #endif /* __CLAPACK_LITE_H */ 37 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/filename.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1999-2004 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | /* 38 | * filename.h -- File and path name operations. 39 | * 40 | * ********************************************** 41 | * CMU ARPA Speech Project 42 | * 43 | * Copyright (c) 1999 Carnegie Mellon University. 44 | * ALL RIGHTS RESERVED. 45 | * ********************************************** 46 | * 47 | * HISTORY 48 | * $Log: filename.h,v $ 49 | * Revision 1.7 2005/06/22 03:01:07 arthchan2003 50 | * Added keyword 51 | * 52 | * Revision 1.3 2005/03/30 01:22:48 archan 53 | * Fixed mistakes in last updates. Add 54 | * 55 | * 56 | * 30-Oct-1997 M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University. 57 | * Started. 58 | */ 59 | 60 | 61 | #ifndef _LIBUTIL_FILENAME_H_ 62 | #define _LIBUTIL_FILENAME_H_ 63 | 64 | /* Win32/WinCE DLL gunk */ 65 | #include 66 | #include 67 | 68 | /**\file filename.h 69 | *\brief File names related operation 70 | */ 71 | #ifdef __cplusplus 72 | extern "C" { 73 | #endif 74 | #if 0 75 | /* Fool Emacs. */ 76 | } 77 | #endif 78 | 79 | /** 80 | * Returns the last part of the path, without modifying anything in memory. 81 | */ 82 | SPHINXBASE_EXPORT 83 | const char *path2basename(const char *path); 84 | 85 | /** 86 | * Strip off filename from the given path and copy the directory name into dir 87 | * Caller must have allocated dir (hint: it's always shorter than path). 88 | */ 89 | SPHINXBASE_EXPORT 90 | void path2dirname(const char *path, char *dir); 91 | 92 | 93 | /** 94 | * Strip off the smallest trailing file-extension suffix and copy 95 | * the rest into the given root argument. Caller must have 96 | * allocated root. 97 | */ 98 | SPHINXBASE_EXPORT 99 | void strip_fileext(const char *file, char *root); 100 | 101 | /** 102 | * Test whether a pathname is absolute for the current OS. 103 | */ 104 | SPHINXBASE_EXPORT 105 | int path_is_absolute(const char *file); 106 | 107 | #ifdef __cplusplus 108 | } 109 | #endif 110 | 111 | 112 | #endif 113 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/listelem_alloc.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 1999-2004 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | #ifndef __LISTELEM_ALLOC_H__ 39 | #define __LISTELEM_ALLOC_H__ 40 | 41 | /** @file listelem_alloc.h 42 | * @brief Fast memory allocator for uniformly sized objects 43 | * @author M K Ravishankar 44 | */ 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | #if 0 49 | /* Fool Emacs. */ 50 | } 51 | #endif 52 | 53 | #include 54 | #ifdef S60 55 | #include 56 | #endif 57 | 58 | /* Win32/WinCE DLL gunk */ 59 | #include 60 | #include 61 | 62 | /** 63 | * List element allocator object. 64 | */ 65 | typedef struct listelem_alloc_s listelem_alloc_t; 66 | 67 | /** 68 | * Initialize and return a list element allocator. 69 | */ 70 | SPHINXBASE_EXPORT 71 | listelem_alloc_t * listelem_alloc_init(size_t elemsize); 72 | 73 | /** 74 | * Finalize and release all memory associated with a list element allocator. 75 | */ 76 | SPHINXBASE_EXPORT 77 | void listelem_alloc_free(listelem_alloc_t *le); 78 | 79 | 80 | SPHINXBASE_EXPORT 81 | void *__listelem_malloc__(listelem_alloc_t *le, char *file, int line); 82 | 83 | /** 84 | * Allocate a list element and return pointer to it. 85 | */ 86 | #define listelem_malloc(le) __listelem_malloc__((le),__FILE__,__LINE__) 87 | 88 | SPHINXBASE_EXPORT 89 | void *__listelem_malloc_id__(listelem_alloc_t *le, char *file, int line, 90 | int32 *out_id); 91 | 92 | /** 93 | * Allocate a list element, returning a unique identifier. 94 | */ 95 | #define listelem_malloc_id(le, oid) __listelem_malloc_id__((le),__FILE__,__LINE__,(oid)) 96 | 97 | /** 98 | * Retrieve a list element by its identifier. 99 | */ 100 | SPHINXBASE_EXPORT 101 | void *listelem_get_item(listelem_alloc_t *le, int32 id); 102 | 103 | /** 104 | * Free list element of given size 105 | */ 106 | SPHINXBASE_EXPORT 107 | void __listelem_free__(listelem_alloc_t *le, void *elem, char *file, int line); 108 | 109 | /** 110 | * Macro of __listelem_free__ 111 | */ 112 | #define listelem_free(le,el) __listelem_free__((le),(el),__FILE__,__LINE__) 113 | 114 | /** 115 | Print number of allocation, numer of free operation stats 116 | */ 117 | SPHINXBASE_EXPORT 118 | void listelem_stats(listelem_alloc_t *le); 119 | 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/mmio.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2006-2007 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | /** 38 | * @file mmio.h 39 | * @brief Memory-mapped I/O wrappers for files. 40 | * @author David Huggins-Daines 41 | **/ 42 | 43 | #ifndef __MMIO_H__ 44 | #define __MMIO_H__ 45 | 46 | #include 47 | 48 | #ifdef __cplusplus 49 | extern "C" { 50 | #endif 51 | #if 0 52 | /* Fool Emacs. */ 53 | } 54 | #endif 55 | 56 | /** 57 | * Abstract structure representing a memory-mapped file. 58 | **/ 59 | typedef struct mmio_file_s mmio_file_t; 60 | 61 | /** 62 | * Memory-map a file for reading. 63 | * @return a mmio_file_t * or NULL for failure. 64 | **/ 65 | SPHINXBASE_EXPORT 66 | mmio_file_t *mmio_file_read(const char *filename); 67 | 68 | /** 69 | * Get a pointer to the memory mapped for a file. 70 | **/ 71 | SPHINXBASE_EXPORT 72 | void *mmio_file_ptr(mmio_file_t *mf); 73 | 74 | /** 75 | * Unmap a file, releasing memory associated with it. 76 | **/ 77 | SPHINXBASE_EXPORT 78 | void mmio_file_unmap(mmio_file_t *mf); 79 | 80 | #ifdef __cplusplus 81 | } 82 | #endif 83 | 84 | 85 | #endif /* __MMIO_H__ */ 86 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/priority_queue.h: -------------------------------------------------------------------------------- 1 | #ifndef __PRIORITY_QUEUE_H__ 2 | #define __PRIORITY_QUEUE_H__ 3 | 4 | #include 5 | #include 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | #if 0 11 | /* Fool Emacs. */ 12 | } 13 | #endif 14 | 15 | /** 16 | * Priority queue for max element tracking. 17 | * The one expects heap here, but for current application 18 | * (sorting of ngram entries one per order, i.e. maximum 10) 19 | * i'll put just and array here, so each operation takes linear time. 20 | * I swear to rework it some day! 21 | * TODOTODOTODOTODOTODOTODOTODOTODOTODOTODOTODOTODOTODOTODO!!!!! 22 | */ 23 | 24 | typedef struct priority_queue_s priority_queue_t; 25 | 26 | SPHINXBASE_EXPORT 27 | priority_queue_t* priority_queue_create(size_t len, int (*compare)(void *a, void *b)); 28 | 29 | SPHINXBASE_EXPORT 30 | void* priority_queue_poll(priority_queue_t *queue); 31 | 32 | SPHINXBASE_EXPORT 33 | void priority_queue_add(priority_queue_t *queue, void *element); 34 | 35 | SPHINXBASE_EXPORT 36 | size_t priority_queue_size(priority_queue_t *queue); 37 | 38 | SPHINXBASE_EXPORT 39 | void priority_queue_free(priority_queue_t *queue, void (*free_ptr)(void *a)); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* __PRIORITY_QUEUE_H__ */ -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/sphinx_config.h: -------------------------------------------------------------------------------- 1 | /* include/sphinx_config.h. Generated from sphinx_config.h.in by configure. */ 2 | /* sphinx_config.h: Externally visible configuration parameters */ 3 | 4 | /* Use fixed-point computation */ 5 | /* #undef FIXED_POINT */ 6 | 7 | /* Default radix point for fixed-point */ 8 | /* #undef DEFAULT_RADIX */ 9 | 10 | /* The size of `long', as computed by sizeof. */ 11 | #define SIZEOF_LONG 8 12 | 13 | /* Define to 1 if the system has the type `long long'. */ 14 | #define HAVE_LONG_LONG 1 15 | 16 | /* The size of `long long', as computed by sizeof. */ 17 | #define SIZEOF_LONG_LONG 8 18 | 19 | /* Enable debugging output */ 20 | /* #undef SPHINX_DEBUG */ 21 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/sphinxbase_export.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPHINXBASE_EXPORT_H__ 2 | #define __SPHINXBASE_EXPORT_H__ 3 | 4 | /* Win32/WinCE DLL gunk */ 5 | #if (defined(_WIN32) || defined(_WIN32_WCE)) && !defined(_WIN32_WP) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__WINSCW__) && !defined(__SYMBIAN32__) 6 | #if defined(SPHINXBASE_EXPORTS) /* Visual Studio */ 7 | #define SPHINXBASE_EXPORT __declspec(dllexport) 8 | #else 9 | #define SPHINXBASE_EXPORT __declspec(dllimport) 10 | #endif 11 | #else /* !_WIN32 */ 12 | #define SPHINXBASE_EXPORT 13 | #endif 14 | 15 | #endif /* __SPHINXBASE_EXPORT_H__ */ 16 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/include/sphinxbase/yin.h: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* 3 | * Copyright (c) 2008 Beyond Access, Inc. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in 14 | * the documentation and/or other materials provided with the 15 | * distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY BEYOND ACCESS, INC. ``AS IS'' AND ANY 18 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BEYOND ACCESS, INC. NOR 21 | * ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | /** 31 | * @file yin.h 32 | * @brief Implementation of pitch estimation 33 | * @author David Huggins-Daines 34 | * 35 | * This implements part of the YIN algorithm: 36 | * 37 | * "YIN, a fundamental frequency estimator for speech and music". 38 | * Alain de Cheveigné and Hideki Kawahara. Journal of the Acoustical 39 | * Society of America, 111 (4), April 2002. 40 | */ 41 | 42 | #ifndef __YIN_H__ 43 | #define __YIN_H__ 44 | 45 | #ifdef __cplusplus 46 | extern "C" 47 | #endif 48 | #if 0 49 | } /* Fool Emacs. */ 50 | #endif 51 | 52 | /* Win32/WinCE DLL gunk */ 53 | #include 54 | #include 55 | 56 | /** 57 | * Frame-based moving-window pitch estimator. 58 | */ 59 | typedef struct yin_s yin_t; 60 | 61 | /** 62 | * Initialize moving-window pitch estimation. 63 | */ 64 | SPHINXBASE_EXPORT 65 | yin_t *yin_init(int frame_size, float search_threshold, 66 | float search_range, int smooth_window); 67 | 68 | /** 69 | * Free a moving-window pitch estimator. 70 | */ 71 | SPHINXBASE_EXPORT 72 | void yin_free(yin_t *pe); 73 | 74 | /** 75 | * Start processing an utterance. 76 | */ 77 | SPHINXBASE_EXPORT 78 | void yin_start(yin_t *pe); 79 | 80 | /** 81 | * Mark the end of an utterance. 82 | */ 83 | SPHINXBASE_EXPORT 84 | void yin_end(yin_t *pe); 85 | 86 | /** 87 | * Store a frame of data to the pitch estimator. 88 | * 89 | * @param pe Pitch estimator. 90 | * @param frame Frame of frame_size (see 91 | * yin_init()) samples of audio data. 92 | */ 93 | SPHINXBASE_EXPORT 94 | void yin_store(yin_t *pe, int16 const *frame); 95 | 96 | /** 97 | * Feed a frame of data to the pitch estimator. 98 | * 99 | * @param pe Pitch estimator. 100 | * @param frame Frame of frame_size (see 101 | * yin_init()) samples of audio data. 102 | */ 103 | SPHINXBASE_EXPORT 104 | void yin_write(yin_t *pe, int16 const *frame); 105 | 106 | /** 107 | * Feed stored frame of data to the pitch estimator. 108 | * (see yin_store()) 109 | * 110 | * @param pe Pitch estimator. 111 | */ 112 | SPHINXBASE_EXPORT 113 | void yin_write_stored(yin_t *pe); 114 | 115 | /** 116 | * Read a raw estimated pitch value from the pitch estimator. 117 | * 118 | * @param pe Pitch estimator. 119 | * @param out_period Output: an estimate of the period (*not* the pitch) 120 | * of the signal in samples. 121 | * @param out_bestdiff Output: the minimum normalized difference value 122 | * associated with *out_pitch, in Q15 123 | * format (i.e. scaled by 32768). This can be 124 | * interpreted as one minus the probability of voicing. 125 | * @return Non-zero if enough data was avaliable to return a pitch 126 | * estimate, zero otherwise. 127 | */ 128 | SPHINXBASE_EXPORT 129 | int yin_read(yin_t *pe, uint16 *out_period, float *out_bestdiff); 130 | 131 | #ifdef __cplusplus 132 | } 133 | #endif 134 | 135 | #endif /* __YIN_H__ */ 136 | 137 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxad.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxad.3.dylib -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxad.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxad.a -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxad.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxad.dylib -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxad.la: -------------------------------------------------------------------------------- 1 | # libsphinxad.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.5 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libsphinxad.3.dylib' 9 | 10 | # Names of this library. 11 | library_names='libsphinxad.3.dylib libsphinxad.dylib' 12 | 13 | # The name of the static archive. 14 | old_library='libsphinxad.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags=' -framework OpenAL' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' /usr/local/lib/libsphinxbase.la -lpthread -lm -lblas -llapack' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libsphinxad. 26 | current=3 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxbase.3.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxbase.3.dylib -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxbase.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxbase.a -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxbase.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxbase.dylib -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/libsphinxbase.la: -------------------------------------------------------------------------------- 1 | # libsphinxbase.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.5 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='libsphinxbase.3.dylib' 9 | 10 | # Names of this library. 11 | library_names='libsphinxbase.3.dylib libsphinxbase.dylib' 12 | 13 | # The name of the static archive. 14 | old_library='libsphinxbase.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags=' ' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' -lpthread -lm -lblas -llapack' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for libsphinxbase. 26 | current=3 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=no 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib' 42 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/pkgconfig/sphinxbase.pc: -------------------------------------------------------------------------------- 1 | prefix=/Users/sam/Projects/sphinxbase/dist 2 | exec_prefix=${prefix} 3 | libdir=${exec_prefix}/lib 4 | includedir=${prefix}/include 5 | libs="-lpthread -lm -lblas -llapack " 6 | 7 | Name: SphinxBase 8 | Description: Shared components for Sphinx speech recognition 9 | Version: 5prealpha 10 | URL: http://www.cmusphinx.org/ 11 | Libs: -L${libdir} -lsphinxbase -lsphinxad -lpthread -lm -lblas -llapack 12 | Libs.private: ${libs} 13 | Cflags: -I${includedir} -I${includedir}/sphinxbase 14 | 15 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/__init__.py: -------------------------------------------------------------------------------- 1 | # -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | # ==================================================================== 3 | # Copyright (c) 2013 Carnegie Mellon University. All rights 4 | # reserved. 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions 8 | # are met: 9 | # 10 | # 1. Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # 13 | # 2. Redistributions in binary form must reproduce the above copyright 14 | # notice, this list of conditions and the following disclaimer in 15 | # the documentation and/or other materials provided with the 16 | # distribution. 17 | # 18 | # This work was supported in part by funding from the Defense Advanced 19 | # Research Projects Agency and the National Science Foundation of the 20 | # United States of America, and the CMU Sphinx Speech Consortium. 21 | # 22 | # THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | # ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | # NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | # 34 | # ==================================================================== 35 | 36 | 37 | from sphinxbase import * 38 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/__init__.pyc -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/__init__.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/__init__.pyo -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/_sphinxbase.0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/_sphinxbase.0.so -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/_sphinxbase.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/_sphinxbase.a -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/_sphinxbase.la: -------------------------------------------------------------------------------- 1 | # _sphinxbase.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.5 3 | # 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # The name that we can dlopen(3). 8 | dlname='_sphinxbase.0.so' 9 | 10 | # Names of this library. 11 | library_names='_sphinxbase.0.so _sphinxbase.so' 12 | 13 | # The name of the static archive. 14 | old_library='_sphinxbase.a' 15 | 16 | # Linker flags that cannot go in dependency_libs. 17 | inherited_linker_flags=' ' 18 | 19 | # Libraries that this one depends upon. 20 | dependency_libs=' /usr/local/lib/libsphinxbase.la -lpthread -lm -lblas -llapack' 21 | 22 | # Names of additional weak libraries provided by this library 23 | weak_library_names='' 24 | 25 | # Version information for _sphinxbase. 26 | current=0 27 | age=0 28 | revision=0 29 | 30 | # Is this an already installed library? 31 | installed=yes 32 | 33 | # Should we warn about portability when linking against -modules? 34 | shouldnotlink=yes 35 | 36 | # Files to dlopen/dlpreopen 37 | dlopen='' 38 | dlpreopen='' 39 | 40 | # Directory that this library needs to be installed in: 41 | libdir='/usr/local/lib/python2.7/site-packages/sphinxbase' 42 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/_sphinxbase.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/_sphinxbase.so -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/sphinxbase.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/sphinxbase.pyc -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/sphinxbase.pyo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pietrop/digital-paper-edit-electron/e79f3187de354045081c9d1a8025914e3d58bcc2/src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/lib/python2.7/site-packages/sphinxbase/sphinxbase.pyo -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/man/man1/sphinx_cepview.1: -------------------------------------------------------------------------------- 1 | .TH SPHINX_CEPVIEW 1 "2007-08-27" 2 | .SH NAME 3 | sphinx_cepview \- View acoustic feature files 4 | .SH SYNOPSIS 5 | .B sphinx_cepview 6 | [\fI options \fR]... 7 | .SH DESCRIPTION 8 | .PP 9 | This program reads acoustic feature files in Sphinx format and 10 | displays their contents as text for inspection. 11 | .TP 12 | .B \-b 13 | The beginning frame 0-based. 14 | .TP 15 | .B \-d 16 | Number of displayed coefficients. 17 | .TP 18 | .B \-describe 19 | Whether description will be shown. 20 | .TP 21 | .B \-e 22 | The ending frame. 23 | .TP 24 | .B \-f 25 | feature file. 26 | .TP 27 | .B \-header 28 | Whether header is shown. 29 | .TP 30 | .B \-i 31 | Number of coefficients in the feature vector. 32 | .TP 33 | .B \-logfn 34 | file (default stdout/stderr) 35 | .SH AUTHOR 36 | Written by numerous people at CMU from 1994 onwards. This manual page 37 | by David Huggins-Daines 38 | .SH COPYRIGHT 39 | Copyright \(co 1994-2007 Carnegie Mellon University. See the file 40 | \fICOPYING\fR included with this package for more information. 41 | .br 42 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/man/man1/sphinx_cont_seg.1: -------------------------------------------------------------------------------- 1 | .TH SPHINX_CONT_SEG 1 "2008-05-12" 2 | .SH NAME 3 | sphinx_cont_seg \- Segment a waveform file into non-silence regions 4 | .SH SYNOPSIS 5 | .B sphinx_cont_seg 6 | [\fI options \fR]... 7 | .SH DESCRIPTION 8 | .PP 9 | This program reads an input file and segments it into individual 10 | non-silence regions. It can process either file or read data from 11 | microphone. Use following arguments: 12 | .TP 13 | .B \-adcdev 14 | of audio device to use for input. 15 | .TP 16 | .B \-alpha 17 | Preemphasis parameter 18 | .TP 19 | .B \-argfile 20 | file giving extra arguments. 21 | .TP 22 | .B \-dither 23 | Add 1/2-bit noise 24 | .TP 25 | .B \-doublebw 26 | Use double bandwidth filters (same center freq) 27 | .TP 28 | .B \-frate 29 | Frame rate 30 | .TP 31 | .B \-infile 32 | of audio file to use for input. 33 | .TP 34 | .B \-input_endian 35 | Endianness of input data, big or little, ignored if NIST or MS Wav 36 | .TP 37 | .B \-lifter 38 | Length of sin-curve for liftering, or 0 for no liftering. 39 | .TP 40 | .B \-logspec 41 | Write out logspectral files instead of cepstra 42 | .TP 43 | .B \-lowerf 44 | Lower edge of filters 45 | .TP 46 | .B \-ncep 47 | Number of cep coefficients 48 | .TP 49 | .B \-nfft 50 | Size of FFT 51 | .TP 52 | .B \-nfilt 53 | Number of filter banks 54 | .TP 55 | .B \-remove_dc 56 | Remove DC offset from each frame 57 | .TP 58 | .B \-remove_noise 59 | Remove noise with spectral subtraction in mel-energies 60 | .TP 61 | .B \-remove_silence 62 | Enables VAD, removes silence frames from processing 63 | .TP 64 | .B \-round_filters 65 | Round mel filter frequencies to DFT points 66 | .TP 67 | .B \-samprate 68 | Sampling rate 69 | .TP 70 | .B \-seed 71 | Seed for random number generator; if less than zero, pick our own 72 | .TP 73 | .B \-singlefile 74 | a single cleaned file. 75 | .TP 76 | .B \-smoothspec 77 | Write out cepstral-smoothed logspectral files 78 | .TP 79 | .B \-transform 80 | Which type of transform to use to calculate cepstra (legacy, dct, or htk) 81 | .TP 82 | .B \-unit_area 83 | Normalize mel filters to unit area 84 | .TP 85 | .B \-upperf 86 | Upper edge of filters 87 | .TP 88 | .B \-vad_postspeech 89 | Num of silence frames to keep after from speech to silence. 90 | .TP 91 | .B \-vad_prespeech 92 | Num of speech frames to keep before silence to speech. 93 | .TP 94 | .B \-vad_startspeech 95 | Num of speech frames to trigger vad from silence to speech. 96 | .TP 97 | .B \-vad_threshold 98 | Threshold for decision between noise and silence frames. Log-ratio between signal level and noise level. 99 | .TP 100 | .B \-verbose 101 | Show input filenames 102 | .TP 103 | .B \-warp_params 104 | defining the warping function 105 | .TP 106 | .B \-warp_type 107 | Warping function type (or shape) 108 | .TP 109 | .B \-wlen 110 | Hamming window length 111 | .SH AUTHOR 112 | Written by M. K. Ravishankar . This (rather lousy) manual page 113 | by David Huggins-Daines 114 | .SH COPYRIGHT 115 | Copyright \(co 1999-2001 Carnegie Mellon University. See the file 116 | \fICOPYING\fR included with this package for more information. 117 | .br 118 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/man/man1/sphinx_lm_convert.1: -------------------------------------------------------------------------------- 1 | .TH SPHINX_LM_CONVERT 1 "2010-03-18" 2 | .SH NAME 3 | sphinx_lm_convert \- Convert and manipulate language model files 4 | .SH SYNOPSIS 5 | .B sphinx_lm_convert 6 | [\fI options \fR]... 7 | .SH DESCRIPTION 8 | .PP 9 | This program converts language model files from one format to 10 | another. It can also be used to change the character encoding 11 | of the text in a language model file and to force word strings 12 | to upper or lower case. 13 | .TP 14 | .B \-case 15 | 'lower' or 'upper' - case fold to lower/upper case (NOT UNICODE AWARE) 16 | .TP 17 | .B \-debug 18 | level for debugging messages 19 | .TP 20 | .B \-help 21 | Shows the usage of the tool 22 | .TP 23 | .B \-i 24 | language model file (required) 25 | .TP 26 | .B \-ifmt 27 | language model format (will guess if not specified) 28 | .TP 29 | .B \-logbase 30 | Base in which all log-likelihoods calculated 31 | .TP 32 | .B \-mmap 33 | Use memory-mapped I/O for reading binary LM files 34 | .TP 35 | .B \-o 36 | language model file (required) 37 | .TP 38 | .B \-ofmt 39 | language model file (will guess if not specified) 40 | .SH AUTHOR 41 | David Huggins-Daines 42 | .SH COPYRIGHT 43 | Copyright \(co 2010 Carnegie Mellon University. See the file 44 | \fICOPYING\fR included with this package for more information. 45 | .br 46 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/man/man1/sphinx_lm_eval.1: -------------------------------------------------------------------------------- 1 | .TH SPHINX_LM_EVAL 1 "2008-05-12" 2 | .SH NAME 3 | sphinx_lm_eval \- Evaluate perplexity of a transcription 4 | .SH SYNOPSIS 5 | .B sphinx_lm_eval 6 | [\fI options \fR]... 7 | .SH DESCRIPTION 8 | .PP 9 | This program evaluates the perplexity of a text file according to a 10 | given language model. The text file is assumed to be in transcript 11 | format, i.e. one utterance per line, delimited by and . 12 | .TP 13 | .B \-help 14 | Shows the usage of the tool 15 | .TP 16 | .B \-lm 17 | model file 18 | .TP 19 | .B \-lmctlfn 20 | file listing a set of language models 21 | .TP 22 | .B \-lmname 23 | of language model in \fB\-lmctlfn\fR to use for all utterances 24 | .TP 25 | .B \-logbase 26 | Base in which all log-likelihoods calculated 27 | .TP 28 | .B \-lsn 29 | file to evaluate 30 | .TP 31 | .B \-lw 32 | Language model weight 33 | .TP 34 | .B \-mmap 35 | Use memory-mapped I/O for reading binary LM files 36 | .TP 37 | .B \-probdef 38 | definition file for classes in LM 39 | .TP 40 | .B \-text 41 | string to evaluate 42 | .TP 43 | .B \-uw 44 | Unigram probability weight (interpolated with uniform distribution) 45 | .TP 46 | .B \-verbose 47 | Print details of perplexity calculation 48 | .TP 49 | .B \-wip 50 | Word insertion probability 51 | .SH AUTHOR 52 | David Huggins-Daines 53 | .SH COPYRIGHT 54 | Copyright \(co 2007-2008 Carnegie Mellon University. See the file 55 | \fICOPYING\fR included with this package for more information. 56 | .br 57 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/man/man1/sphinx_lm_sort.1: -------------------------------------------------------------------------------- 1 | .TH SPHINX_LM_SORT 1 "2008-06-26" 2 | .SH NAME 3 | sphinx_lm_sort \- Order N-Grams in a language model for Sphinx 4 | .SH SYNOPSIS 5 | .B sphinx_lm_sort 6 | < 7 | .I input_lm 8 | > 9 | .I output_lm 10 | .SH DESCRIPTION 11 | .PP 12 | This program arranges the N-Grams in an ARPA-format language model to 13 | be acceptable to Sphinx. This is necessary if you created the 14 | language model with SRILM or any other tool which is not as strict 15 | about ordering N-Grams in its output. 16 | .SH AUTHOR 17 | David Huggins-Daines 18 | .SH COPYRIGHT 19 | Copyright \(co 2008 Carnegie Mellon University. See the file 20 | \fICOPYING\fR included with this package for more information. 21 | .br 22 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/man/man1/sphinx_pitch.1: -------------------------------------------------------------------------------- 1 | .TH SPHINX_PITCH 1 "2007-05-12" 2 | .SH NAME 3 | sphinx_pitch \- Extract pitch from audio files 4 | .SH SYNOPSIS 5 | .B sphinx_pitch 6 | [\fI options \fR]... 7 | .SH DESCRIPTION 8 | .PP 9 | This program reads audio files and analyzes them for pitch and voicing. 10 | .TP 11 | .B \-c 12 | file for batch processing 13 | .TP 14 | .B \-di 15 | directory, input file names are relative to this, if defined 16 | .TP 17 | .B \-do 18 | directory, output files are relative to this 19 | .TP 20 | .B \-ei 21 | extension to be applied to all input files 22 | .TP 23 | .B \-eo 24 | extension to be applied to all output files 25 | .TP 26 | .B \-flen 27 | Number of seconds in each analysis frame (needs to be greater than twice the longest period you wish to detect - to detect down to 80Hz you need a frame length of 2.0/80 = 0.025). 28 | .TP 29 | .B \-fshift 30 | Frame shift: number of seconds between each analysis frame. 31 | .TP 32 | .B \-i 33 | audio input file 34 | .TP 35 | .B \-input_endian 36 | of audio data (will be determined automatically if not given) 37 | .TP 38 | .B \-mswav 39 | Defines input format as Microsoft Wav (RIFF) 40 | .TP 41 | .B \-nist 42 | Defines input format as NIST sphere 43 | .TP 44 | .B \-nskip 45 | If a control file was specified, the number of utterances to skip at the head of the file 46 | .TP 47 | .B \-o 48 | text output file (standard output will be used if not given) 49 | .TP 50 | .B \-raw 51 | Defines input format as raw binary data 52 | .TP 53 | .B \-runlen 54 | If a control file was specified, the number of utterances to process (see \fB\-nskip\fR too) 55 | .TP 56 | .B \-samprate 57 | Sampling rate of audio data (will be determined automatically if 0) 58 | .TP 59 | .B \-search_range 60 | Fraction of the best local estimate to use as a search range for smoothing. 61 | .TP 62 | .B \-smooth_window 63 | Number of frames on either side of the current frame to use for smoothing. 64 | .TP 65 | .B \-voice_thresh 66 | Threshold of normalized difference under which to search for the fundamental period. 67 | .SH AUTHOR 68 | David Huggins-Daines 69 | .SH COPYRIGHT 70 | Copyright \(co 2007-2008 Carnegie Mellon University. See the file 71 | \fICOPYING\fR included with this package for more information. 72 | .br 73 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/cmd_ln.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | %extend Config { 39 | 40 | ~Config() { 41 | cmd_ln_free_r($self); 42 | } 43 | 44 | void set_boolean(const char *key, bool val) { 45 | cmd_ln_set_boolean_r($self, key, val); 46 | } 47 | 48 | void set_int(const char *key, int val) { 49 | cmd_ln_set_int_r($self, key, val); 50 | } 51 | 52 | void set_float(const char *key, double val) { 53 | cmd_ln_set_float_r($self, key, val); 54 | } 55 | 56 | void set_string(const char *key, const char *val) { 57 | cmd_ln_set_str_r($self, key, val); 58 | } 59 | 60 | bool exists(const char *key) { 61 | return cmd_ln_exists_r($self, key); 62 | } 63 | 64 | bool get_boolean(const char *key) { 65 | return cmd_ln_boolean_r($self, key); 66 | } 67 | 68 | int get_int(const char *key) { 69 | return cmd_ln_int_r($self, key); 70 | } 71 | 72 | double get_float(const char *key) { 73 | return cmd_ln_float_r($self, key); 74 | } 75 | 76 | const char *get_string(const char *key) { 77 | return cmd_ln_str_r($self, key); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/fe.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | 39 | %extend FrontEnd { 40 | FrontEnd(fe_t *ptr) { 41 | return ptr; 42 | } 43 | 44 | ~FrontEnd() { 45 | fe_free($self); 46 | } 47 | 48 | int output_size() { 49 | return fe_get_output_size($self); 50 | } 51 | 52 | void start_utt(int *errcode) { 53 | *errcode = fe_start_utt($self); 54 | } 55 | 56 | int32 process_utt(const int16 *spch, size_t nsamps, mfcc_t ***cep_block, int *errcode) { 57 | int32 nframes; 58 | *errcode = fe_process_utt($self, spch, nsamps, cep_block, &nframes); 59 | return nframes; 60 | } 61 | 62 | int32 end_utt(mfcc_t *out_cepvector, int *errcode) { 63 | int32 nframes; 64 | *errcode = fe_end_utt($self, out_cepvector, &nframes); 65 | return nframes; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/feat.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | 39 | %extend Feature { 40 | Feature(feat_t *ptr) { 41 | return ptr; 42 | } 43 | 44 | ~Feature() { 45 | feat_free($self); 46 | } 47 | }; 48 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/fsg_model.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | 39 | // TODO: search for functions returning error code 40 | %extend FsgModel { 41 | 42 | FsgModel(const char *name, LogMath *logmath, float lw, int32 n) { 43 | return fsg_model_init(name, logmath, lw, n); 44 | } 45 | 46 | FsgModel(fsg_model_t *ptr) { 47 | return ptr; 48 | } 49 | 50 | FsgModel(const char *path, LogMath *logmath, float lw) { 51 | return fsg_model_readfile(path, logmath, lw); 52 | } 53 | 54 | ~FsgModel() { 55 | fsg_model_free($self); 56 | } 57 | 58 | int word_id(const char *word) { 59 | return fsg_model_word_id($self, word); 60 | } 61 | 62 | int word_add(const char *word) { 63 | return fsg_model_word_add($self, word); 64 | } 65 | 66 | void trans_add(int32 src, int32 dst, int32 logp, int32 wid) { 67 | fsg_model_trans_add($self, src, dst, logp, wid); 68 | } 69 | 70 | int32 null_trans_add(int32 src, int32 dst, int32 logp) { 71 | return fsg_model_null_trans_add($self, src, dst, logp); 72 | } 73 | 74 | int32 tag_trans_add(int32 src, int32 dst, int32 logp, int32 wid) { 75 | return fsg_model_tag_trans_add($self, src, dst, logp, wid); 76 | } 77 | 78 | int add_silence(const char *silword, int state, int32 silprob) { 79 | return fsg_model_add_silence($self, silword, state, silprob); 80 | } 81 | 82 | int add_alt(const char *baseword, const char *altword) { 83 | return fsg_model_add_alt($self, baseword, altword); 84 | } 85 | 86 | void writefile(const char *path) { 87 | fsg_model_writefile($self, path); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/iterators.i: -------------------------------------------------------------------------------- 1 | // Macro to construct iterable objects. 2 | %define sb_iterator(TYPE, PREFIX, VALUE_TYPE) 3 | 4 | #if SWIGJAVA 5 | %typemap(javainterfaces) TYPE##Iterator "java.util.Iterator<"#VALUE_TYPE">" 6 | %typemap(javabody) TYPE##Iterator %{ 7 | 8 | private long swigCPtr; 9 | protected boolean swigCMemOwn; 10 | 11 | public $javaclassname(long cPtr, boolean cMemoryOwn) { 12 | swigCMemOwn = cMemoryOwn; 13 | swigCPtr = cPtr; 14 | } 15 | 16 | public static long getCPtr($javaclassname obj) { 17 | return (obj == null) ? 0 : obj.swigCPtr; 18 | } 19 | 20 | @Override 21 | public void remove() { 22 | throw new UnsupportedOperationException(); 23 | } 24 | %} 25 | #endif 26 | 27 | // Basic types 28 | 29 | %inline %{ 30 | typedef struct { 31 | PREFIX##_t *ptr; 32 | } TYPE##Iterator; 33 | %} 34 | 35 | // Exception to end iteration 36 | 37 | #if SWIGJAVA 38 | %exception TYPE##Iterator##::next() { 39 | if (!arg1->ptr) { 40 | jclass cls = (*jenv)->FindClass(jenv, "java/util/NoSuchElementException"); 41 | (*jenv)->ThrowNew(jenv, cls, NULL); 42 | return $null; 43 | } 44 | $action; 45 | } 46 | #elif SWIGPYTHON 47 | %exception TYPE##Iterator##::next() { 48 | if (!arg1->ptr) { 49 | SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); 50 | SWIG_fail; 51 | } 52 | $action; 53 | } 54 | %exception TYPE##Iterator##::__next__() { 55 | if (!arg1->ptr) { 56 | SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void()); 57 | SWIG_fail; 58 | } 59 | $action; 60 | } 61 | #endif 62 | 63 | // Implementation of the iterator itself 64 | 65 | %extend TYPE##Iterator { 66 | TYPE##Iterator(PREFIX##_t *ptr) { 67 | TYPE##Iterator *iter = ckd_malloc(sizeof *iter); 68 | iter->ptr = ptr; 69 | return iter; 70 | } 71 | 72 | ~TYPE##Iterator() { 73 | if ($self->ptr) 74 | PREFIX##_free($self->ptr); 75 | ckd_free($self); 76 | } 77 | 78 | #if SWIGJAVA 79 | %newobject next; 80 | VALUE_TYPE * next() { 81 | if ($self->ptr) { 82 | VALUE_TYPE *value = ##VALUE_TYPE##_fromIter($self->ptr); 83 | $self->ptr = ##PREFIX##_next($self->ptr); 84 | return value; 85 | } 86 | 87 | return NULL; 88 | } 89 | bool hasNext() { 90 | return $self->ptr != NULL; 91 | } 92 | #endif 93 | #if SWIGPYTHON 94 | 95 | // Python2 96 | %newobject next; 97 | VALUE_TYPE * next() { 98 | if ($self->ptr) { 99 | VALUE_TYPE *value = ##VALUE_TYPE##_fromIter($self->ptr); 100 | $self->ptr = ##PREFIX##_next($self->ptr); 101 | return value; 102 | } 103 | return NULL; 104 | } 105 | 106 | // Python3 107 | %newobject __next__; 108 | VALUE_TYPE * __next__() { 109 | if ($self->ptr) { 110 | VALUE_TYPE *value = ##VALUE_TYPE##_fromIter($self->ptr); 111 | $self->ptr = ##PREFIX##_next($self->ptr); 112 | return value; 113 | } 114 | return NULL; 115 | } 116 | #endif 117 | 118 | } 119 | 120 | %enddef 121 | 122 | 123 | %define sb_iterable(TYPE, PREFIX, VALUE_TYPE) 124 | 125 | // Methods to retrieve the iterator from the container 126 | 127 | %extend TYPE { 128 | // Also used in Java, but underscores are automatically removed 129 | TYPE##Iterator * __iter__() { 130 | return new_##TYPE##Iterator(PREFIX##($self)); 131 | } 132 | } 133 | 134 | sb_iterable_java(TYPE, VALUE_TYPE) 135 | 136 | %enddef 137 | 138 | %define sb_iterable_java(TYPE, VALUE_TYPE) 139 | 140 | // Same but without __iter__ which can vary from class to class 141 | 142 | #if SWIGJAVA 143 | %typemap(javainterfaces) TYPE "Iterable<"#VALUE_TYPE">" 144 | %typemap(javabody) TYPE %{ 145 | 146 | private long swigCPtr; 147 | protected boolean swigCMemOwn; 148 | 149 | public $javaclassname(long cPtr, boolean cMemoryOwn) { 150 | swigCMemOwn = cMemoryOwn; 151 | swigCPtr = cPtr; 152 | } 153 | 154 | public static long getCPtr($javaclassname obj) { 155 | return (obj == null) ? 0 : obj.swigCPtr; 156 | } 157 | 158 | @Override 159 | public java.util.Iterator iterator () { 160 | return iter(); 161 | } 162 | %} 163 | %javamethodmodifiers TYPE::__iter__ "private"; 164 | #endif 165 | 166 | %enddef 167 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/jsgf.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | 39 | %extend Jsgf { 40 | #if SWIGJAVA 41 | %rename(name) getName; 42 | #endif 43 | 44 | Jsgf(const char *path) { 45 | return jsgf_parse_file(path, NULL); 46 | } 47 | 48 | ~Jsgf() { 49 | jsgf_grammar_free($self); 50 | } 51 | 52 | const char * name() { 53 | return jsgf_grammar_name($self); 54 | } 55 | 56 | JsgfRule * get_rule(const char *name) { 57 | return jsgf_get_rule($self, name); 58 | } 59 | 60 | FsgModel * build_fsg(JsgfRule *rule, LogMath *logmath, float lw) { 61 | return jsgf_build_fsg($self, rule, logmath, lw); 62 | } 63 | } 64 | 65 | %extend JsgfRule { 66 | #if SWIGJAVA 67 | %rename(getName) name; 68 | %rename(isPublic) public; 69 | 70 | %javamethodmodifiers JsgfRule "private"; 71 | #endif 72 | 73 | JsgfRule() { 74 | return NULL; 75 | } 76 | 77 | ~JsgfRule() { 78 | } 79 | 80 | static JsgfRule * fromIter(jsgf_rule_iter_t *itor) { 81 | return jsgf_rule_iter_rule(itor); 82 | } 83 | 84 | const char * name() { 85 | return jsgf_rule_name($self); 86 | } 87 | 88 | bool public() { 89 | return jsgf_rule_public($self); 90 | } 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/logmath.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | 39 | %extend LogMath { 40 | LogMath() { 41 | return logmath_init(1.0001f, 0, 0); 42 | } 43 | 44 | LogMath(logmath_t *ptr) { 45 | return ptr; 46 | } 47 | 48 | ~LogMath() { 49 | logmath_free($self); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/ngram_model.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | 39 | %extend NGramModel { 40 | 41 | static NGramModel *fromIter(ngram_model_set_iter_t *itor) { 42 | const char *name; 43 | return ngram_model_set_iter_model(itor, &name); 44 | } 45 | 46 | NGramModel(const char *path) { 47 | logmath_t *lmath = logmath_init(1.0001, 0, 0); 48 | ngram_model_t * model = ngram_model_read(NULL, path, NGRAM_AUTO, lmath); 49 | logmath_free(lmath); 50 | return model; 51 | } 52 | 53 | NGramModel(Config *config, LogMath *logmath, const char *path) { 54 | return ngram_model_read(config, path, NGRAM_AUTO, logmath); 55 | } 56 | 57 | ~NGramModel() { 58 | ngram_model_free($self); 59 | } 60 | 61 | void write(const char *path, ngram_file_type_t ftype, int *errcode) { 62 | *errcode = ngram_model_write($self, path, ftype); 63 | } 64 | 65 | ngram_file_type_t str_to_type(const char *str) { 66 | return ngram_str_to_type(str); 67 | } 68 | 69 | const char * type_to_str(int type) { 70 | return ngram_type_to_str(type); 71 | } 72 | 73 | void casefold(int kase, int *errcode) { 74 | *errcode = ngram_model_casefold($self, kase); 75 | } 76 | 77 | int32 size() { 78 | return ngram_model_get_size($self); 79 | } 80 | 81 | int32 add_word(const char *word, float32 weight) { 82 | return ngram_model_add_word($self, word, weight); 83 | } 84 | 85 | int32 add_class(const char *c, float32 w, size_t n, char **ptr, 86 | const float32 *weights) 87 | { 88 | return ngram_model_add_class($self, c, w, ptr, weights, n); 89 | } 90 | 91 | int32 prob(size_t n, const char * const*ptr) { 92 | return ngram_prob($self, ptr, n); 93 | } 94 | } 95 | 96 | // TODO: shares ptr type with NGramModel, docstrings are not generated 97 | %extend NGramModelSet { 98 | NGramModelSet(Config *config, LogMath *logmath, const char *path) { 99 | return ngram_model_set_read(config, path, logmath); 100 | } 101 | 102 | ~NGramModelSet() { 103 | ngram_model_free($self); 104 | } 105 | 106 | int32 count() { 107 | return ngram_model_set_count($self); 108 | } 109 | 110 | NGramModel * add( 111 | NGramModel *model, const char *name, float weight, bool reuse_widmap) { 112 | return ngram_model_set_add($self, model, name, weight, reuse_widmap); 113 | } 114 | 115 | NGramModel * select(const char *name) { 116 | return ngram_model_set_select($self, name); 117 | } 118 | 119 | NGramModel * lookup(const char *name) { 120 | return ngram_model_set_lookup($self, name); 121 | } 122 | 123 | const char * current() { 124 | return ngram_model_set_current($self); 125 | } 126 | } 127 | 128 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/sphinxbase.i: -------------------------------------------------------------------------------- 1 | /* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 | /* ==================================================================== 3 | * Copyright (c) 2013 Carnegie Mellon University. All rights 4 | * reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in 15 | * the documentation and/or other materials provided with the 16 | * distribution. 17 | * 18 | * This work was supported in part by funding from the Defense Advanced 19 | * Research Projects Agency and the National Science Foundation of the 20 | * United States of America, and the CMU Sphinx Speech Consortium. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 23 | * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 24 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY 26 | * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 27 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 28 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 32 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 | * 34 | * ==================================================================== 35 | * 36 | */ 37 | 38 | 39 | %define DOCSTRING 40 | "This documentation was automatically generated using original comments in 41 | Doxygen format. As some C types and data structures cannot be directly mapped 42 | into Python types, some non-trivial type conversion could have place. 43 | Basically a type is replaced with another one that has the closest match, and 44 | sometimes one argument of generated function comprises several arguments of the 45 | original function (usually two). 46 | 47 | Functions having error code as the return value and returning effective 48 | value in one of its arguments are transformed so that the effective value is 49 | returned in a regular fashion and run-time exception is being thrown in case of 50 | negative error code." 51 | %enddef 52 | 53 | #if SWIGJAVA 54 | %module SphinxBase 55 | %rename("%(lowercamelcase)s", notregexmatch$name="^[A-Z]") ""; 56 | #else 57 | %module(docstring=DOCSTRING) sphinxbase 58 | #endif 59 | 60 | %feature("autodoc", "1"); 61 | 62 | %include typemaps.i 63 | %include iterators.i 64 | 65 | #if SWIGPYTHON 66 | %begin %{ 67 | #include 68 | %} 69 | #endif 70 | 71 | %begin %{ 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | 79 | typedef int bool; 80 | #define false 0 81 | #define true 1 82 | 83 | typedef cmd_ln_t Config; 84 | typedef jsgf_t Jsgf; 85 | typedef jsgf_rule_t JsgfRule; 86 | typedef feat_t Feature; 87 | typedef fe_t FrontEnd; 88 | typedef fsg_model_t FsgModel; 89 | typedef logmath_t LogMath; 90 | typedef ngram_model_t NGramModel; 91 | typedef ngram_model_t NGramModelSet; 92 | %} 93 | 94 | %nodefaultctor Config; 95 | 96 | typedef struct {} Config; 97 | typedef struct {} FrontEnd; 98 | typedef struct {} Feature; 99 | typedef struct {} FsgModel; 100 | typedef struct {} JsgfRule; 101 | typedef struct {} NGramModel; 102 | typedef struct {} LogMath; 103 | 104 | sb_iterator(NGramModelSet, ngram_model_set_iter, NGramModel); 105 | sb_iterator(Jsgf, jsgf_rule_iter, JsgfRule) 106 | 107 | sb_iterable(NGramModelSet, ngram_model_set_iter, NGramModel) 108 | sb_iterable(Jsgf, jsgf_rule_iter, JsgfRule) 109 | 110 | typedef struct {} NGramModelSet; 111 | typedef struct {} Jsgf; 112 | 113 | #ifdef HAS_DOC 114 | %include pydoc.i 115 | #endif 116 | %include cmd_ln.i 117 | %include fe.i 118 | %include feat.i 119 | %include fsg_model.i 120 | %include jsgf.i 121 | %include ngram_model.i 122 | %include logmath.i 123 | 124 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/pocketsphinx-stt/sphinxbase/share/sphinxbase/swig/typemaps.i: -------------------------------------------------------------------------------- 1 | %include 2 | 3 | %apply int {int32}; 4 | 5 | #if SWIGPYTHON 6 | // Special typemap for string array 7 | %typemap(in) (size_t n, char **ptr) { 8 | /* Check if is a list */ 9 | $1 = 0; 10 | if (PyList_Check($input)) { 11 | int i; 12 | $1 = PyList_Size($input); 13 | $2 = (char **) calloc(($1 + 1), sizeof(char *)); 14 | for (i = 0; i < $1; i++) { 15 | PyObject *o = PyList_GetItem($input,i); 16 | $2[i] = SWIG_Python_str_AsChar(o); 17 | } 18 | } else { 19 | PyErr_SetString(PyExc_TypeError, "list type expected"); 20 | return NULL; 21 | } 22 | } 23 | 24 | %typemap(freearg) (size_t n, char **ptr) { 25 | int i; 26 | if ($2 != NULL) { 27 | for (i = 0; $2[i] != NULL; i++) { 28 | SWIG_Python_str_DelForPy3($2[i]); 29 | } 30 | free($2); 31 | } 32 | } 33 | #elif SWIGJAVA 34 | 35 | %include 36 | 37 | // Raw data return support 38 | %typemap(in,numinputs=0,noblock=1) int32 *RAWDATA_SIZE { 39 | int32 temp_len; 40 | $1 = &temp_len; 41 | } 42 | %typemap(jstype) int16 *get_rawdata "short[]" 43 | %typemap(jtype) int16 *get_rawdata "short[]" 44 | %typemap(jni) int16 *get_rawdata "jshortArray" 45 | %typemap(javaout) int16 *get_rawdata { 46 | return $jnicall; 47 | } 48 | %typemap(out) int16 *get_rawdata { 49 | $result = JCALL1(NewShortArray, jenv, temp_len); 50 | JCALL4(SetShortArrayRegion, jenv, $result, 0, temp_len, $1); 51 | } 52 | 53 | // Special typemap for arrays of audio. 54 | %apply short[] {const int16 *SDATA}; 55 | 56 | // Typemap for arrays of strings used in ngram for example 57 | %typemap(in) (size_t n, char **ptr) { 58 | int i = 0; 59 | $1 = (*jenv)->GetArrayLength(jenv, $input); 60 | $2 = (char **) malloc(($1)*sizeof(char *)); 61 | /* make a copy of each string */ 62 | for (i = 0; i<$1; i++) { 63 | jstring j_string = (jstring)(*jenv)->GetObjectArrayElement(jenv, $input, i); 64 | const char * c_string = (*jenv)->GetStringUTFChars(jenv, j_string, 0); 65 | $2[i] = malloc((strlen(c_string)+1)*sizeof(char)); 66 | strcpy($2[i], c_string); 67 | (*jenv)->ReleaseStringUTFChars(jenv, j_string, c_string); 68 | (*jenv)->DeleteLocalRef(jenv, j_string); 69 | } 70 | } 71 | 72 | %typemap(freearg) (size_t n, char **ptr) { 73 | int i; 74 | for (i=0; i<$1; i++) 75 | free($2[i]); 76 | free($2); 77 | } 78 | 79 | %typemap(jni) (size_t n, char **ptr) "jobjectArray" 80 | %typemap(jtype) (size_t n, char **ptr) "String[]" 81 | %typemap(jstype) (size_t n, char **ptr) "String[]" 82 | %typemap(javain) (size_t n, char **ptr) "$javainput" 83 | 84 | #endif 85 | 86 | // Define typemaps to wrap error codes returned by some functions, 87 | // into runtime exceptions. 88 | %typemap(in, numinputs=0, noblock=1) int *errcode { 89 | int errcode; 90 | $1 = &errcode; 91 | } 92 | 93 | %typemap(argout) int *errcode { 94 | if (*$1 < 0) { 95 | char buf[64]; 96 | sprintf(buf, "$symname returned %d", *$1); 97 | SWIG_exception(SWIG_RuntimeError, buf); 98 | } 99 | } 100 | 101 | -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/speechmatics/example-usage.js: -------------------------------------------------------------------------------- 1 | // console.log('SPEECHMATICS config.sttEngine: ', JSON.stringify(newFile, null, 2)); 2 | 3 | // var SendToSpeechmaticsUtil = new SendToSpeechmatics(); 4 | // SendToSpeechmaticsUtil.send(newFile, config.keys.speechmatics, config.languageModel, function(error, data) { 5 | // if (error) { 6 | // callback(error, null); 7 | // } else { 8 | // console.log('SPEECHMATICS-DATA', JSON.stringify(data)); 9 | // console.log('SPEECHMATICS-JSON', JSON.stringify(convertSpeechmaticsJsonToTranscripJson(data), null, 2)); 10 | // callback(null, convertSpeechmaticsJsonToTranscripJson(data)); 11 | // } 12 | // }); 13 | 14 | const speechmaticsSTT = require('./index.js'); 15 | 16 | const newFile = '/Users/passap02/Documents/sample-media/short/kate-short.mp4'; 17 | 18 | speechmaticsSTT(newFile) 19 | .then((res) => { 20 | console.log('example-usage', res); 21 | }).catch((err) => { 22 | console.error('err', err); 23 | }); -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/speechmatics/index.js: -------------------------------------------------------------------------------- 1 | const sampleJson = require('./speechmatics-to-dpe/speechmatics-short.sample.json'); 2 | const SendToSpeechmatics = require('./send-to-speechmatics.js'); 3 | const { getCredentials, areCredentialsSet } = require('../../../../stt-settings/credentials.js'); 4 | 5 | const speechmaticsSTT = (newFile, language = 'en') => { 6 | let speechmaticsCredentials; 7 | if (areCredentialsSet('Speechmatics')) { 8 | speechmaticsCredentials = getCredentials('Speechmatics'); 9 | const credentials = { 10 | username: speechmaticsCredentials.sttUserName, 11 | password: speechmaticsCredentials.sttAPIKey 12 | }; 13 | 14 | // wrapping speechmatics module and SDK into a promise 15 | // to keep consistency in use with other stt modules 16 | // But not refactoring speechmatics module and sdk for now. eg it uses callbacks etc.. 17 | return new Promise((resolve, reject) => { 18 | 19 | // if (process.env.NODE_ENV === 'development') { 20 | // return resolve(sampleJson); 21 | // } 22 | 23 | const SendToSpeechmaticsUtil = new SendToSpeechmatics(); 24 | 25 | SendToSpeechmaticsUtil.send(newFile, credentials, language, function(error, data) { 26 | if (error) { 27 | reject(error); 28 | } 29 | resolve(data); 30 | }); 31 | }); 32 | } 33 | else { 34 | throw new Error('No credentials found for Speechmatics'); 35 | } 36 | }; 37 | 38 | module.exports = speechmaticsSTT; -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/speechmatics/send-to-speechmatics.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const fs = require('fs'); 3 | const Speechmatics = require('./speechmatics-sdk.js'); 4 | 5 | var SendToSpeechmatics = function() {}; 6 | 7 | SendToSpeechmatics.prototype.send = function(audioFile, keys, languageModel, cb) { 8 | console.log('SendToSpeechmatics.send', audioFile, keys, languageModel); 9 | 10 | var opts = {}; 11 | 12 | const speech_to_text = new Speechmatics(keys.username, keys.password); 13 | 14 | var existingReadStream = fs.createReadStream(audioFile); 15 | 16 | speech_to_text.createJob({ audioStream: existingReadStream, model: languageModel, diarisation: true }, function(error, res) { 17 | // {"balance":360,"check_wait":null,"cost":0,"id":7420708} 18 | // {"balance":330,"check_wait":30,"cost":6,"id":7421841} 19 | console.log('inside speechmatics module : ', JSON.stringify(res)); 20 | console.log('-----------------'); 21 | 22 | var speechmaticsJobId = res.id; 23 | 24 | console.log('not done', error, res); 25 | var checkAgainInMilliseconds = parseInt(res.check_wait) * 1000; 26 | console.log('checkAgainInMilliseconds ', checkAgainInMilliseconds); 27 | 28 | // electron has issues with timer accuracy drifting 29 | // https://github.com/electron/electron/issues/7079 30 | // fix timer issue https://peter.sh/experiments/chromium-command-line-switches/ 31 | // Just passed the command line argument to "electron . --disable-background-timer-throttling"  in package.json start script 32 | var timer = setInterval(function() { 33 | console.log('inside set timeout'); 34 | 35 | speech_to_text.getTranscript(speechmaticsJobId, opts, 36 | 37 | function (err, transcript) { 38 | 39 | console.log('handleTranscriptionResp'); 40 | // // make module to rearrange , see notes.md 41 | // fs.writeFileSync('./speechmatics_sample_output_longer.json', JSON.stringify(transcript,null, 2) ); 42 | console.log(JSON.stringify(transcript, null, 2)); 43 | 44 | if (err) { 45 | console.error(err); 46 | if (!((err.code) && (err.code === 404))) { // error // "Job In Progress" // message // "Job In Progress" 47 | clearInterval(timer); 48 | if (cb) { 49 | cb(err, null); 50 | } else { 51 | return err; 52 | } 53 | } 54 | } else { 55 | // body of rseponse in transcript attribute might contain error, so need to check for that if transcription still in progress 56 | // { 57 | // "code": 404, 58 | // "error": "Job In Progress" 59 | // } 60 | // if transcript.code is not defined then get result 61 | if (transcript.code === undefined) { 62 | clearInterval(timer); 63 | if (cb) { 64 | cb(null, transcript); 65 | } else { 66 | return transcript; 67 | } 68 | } 69 | } 70 | }); 71 | 72 | }, checkAgainInMilliseconds); 73 | }); 74 | }; 75 | 76 | module.exports = SendToSpeechmatics; -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/speechmatics/speechmatics-to-dpe/example-usage.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const fs = require('fs'); 3 | var convertSpeechmaticsDpe = require('./index.js'); 4 | 5 | var exampleJSON = require('./speechmatics-short.sample.json'); 6 | 7 | const exampleOutput = convertSpeechmaticsDpe(exampleJSON); 8 | console.log(JSON.stringify(exampleOutput, null, 2 ) ); 9 | 10 | fs.writeFileSync(__dirname + '/test.json', JSON.stringify(exampleOutput, null, 2 ) ); -------------------------------------------------------------------------------- /src/ElectronWrapper/lib/transcriber/speechmatics/speechmatics-to-dpe/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Speechmatics seems to be more accurate then other providers in recognising speakers, 3 | * eg if there's only one speaker so far in tests it has recognise that ther is only one. 4 | * This makes it somewhat less efficient to use speaker diarization to break paragraphs, so using punctuation instead 5 | */ 6 | 'use strict'; 7 | 8 | function deepCopy(obj) { 9 | return JSON.parse(JSON.stringify(obj)); 10 | } 11 | 12 | function normaliseWords(words) { 13 | return words.map((word) => { 14 | return { 15 | text: word.name, 16 | start: parseFloat(word.time), 17 | end: parseFloat(word.time) + parseFloat(word.duration) 18 | }; 19 | }); 20 | } 21 | 22 | function isPunctuation(text) { 23 | return text === '.' || text === '!' || text === '?' || text === ',' || text === ';'; 24 | } 25 | 26 | function appendPunctuationToPreviousWord(normalisedWords) { 27 | const wordsWithPunctuation = []; 28 | normalisedWords.forEach((word, index) => { 29 | if (isPunctuation(word.text)) { 30 | // append to previous word 31 | wordsWithPunctuation[wordsWithPunctuation.length - 1].text += word.text; 32 | } 33 | else { 34 | wordsWithPunctuation.push(word); 35 | } 36 | }); 37 | 38 | return wordsWithPunctuation; 39 | } 40 | 41 | function addIdToWords(list) { 42 | return list.map((item, index) => { 43 | item.id = index; 44 | 45 | return item; 46 | }); 47 | } 48 | 49 | const addSpeakerIdToWords = (words) => { 50 | const wordsResults = []; 51 | let paragraphId = 0; 52 | // const reorgedWords = reorganisedWords(words); 53 | words.forEach((word) => { 54 | // if word contains punctuation 55 | if (/[.?!]/.test(word.text)) { 56 | word.paragraphId = paragraphId; 57 | wordsResults.push(word); 58 | paragraphId += 1; 59 | } else { 60 | word.paragraphId = paragraphId; 61 | wordsResults.push(word); 62 | } 63 | }); 64 | 65 | return wordsResults; 66 | }; 67 | 68 | const generateDpeParagraphs = (words) => { 69 | const wordsList = addSpeakerIdToWords(words); 70 | const paragraphs = []; 71 | let paragraph = {}; 72 | 73 | const paragraphIdsList = wordsList.map((paragraph) => { 74 | return paragraph.paragraphId; 75 | }); 76 | 77 | const paragraphIdsListUniqueValues = [ ...new Set(paragraphIdsList) ]; 78 | 79 | paragraphIdsListUniqueValues.forEach((paraId) => { 80 | 81 | const wordsListForParagraph = wordsList.filter((word) => { 82 | return word.paragraphId == paraId; 83 | }); 84 | 85 | const firstWord = wordsListForParagraph[0]; 86 | 87 | const lastWord = wordsListForParagraph[wordsListForParagraph.length - 1]; 88 | 89 | paragraph.start = firstWord.start; 90 | paragraph.end = lastWord.end; 91 | paragraph.speaker = 'U_UKN'; 92 | paragraphs.push(paragraph); 93 | paragraph = {}; 94 | }); 95 | 96 | return paragraphs; 97 | }; 98 | 99 | function findSpeakerForParagraph(speakers, paragraph) { 100 | const result = speakers.find((speaker) => { 101 | if (( paragraph.start >= speaker.start ) && (paragraph.end <= speaker.end)) { 102 | return speaker; 103 | } 104 | }); 105 | 106 | return result ? result : { text: 'U_UKNNNN' }; 107 | } 108 | 109 | function addSpeakerLabelToParagraphs(speakers, paragraphs) { 110 | return paragraphs.map((paragraph) => { 111 | const speakerForParagraph = findSpeakerForParagraph(speakers, paragraph); 112 | paragraph.speaker = speakerForParagraph.text; 113 | 114 | return paragraph; 115 | }); 116 | 117 | } 118 | 119 | function convertSpeechmaticsDpe({ words, speakers }) { 120 | const transcript = { 121 | paragraphs:[], 122 | words:[] 123 | }; 124 | 125 | const normalisedWords = normaliseWords(words); 126 | const wordsWithPunctuation = appendPunctuationToPreviousWord(normalisedWords); 127 | const wordsWithIds = addIdToWords(wordsWithPunctuation); 128 | transcript.words = deepCopy(wordsWithIds); 129 | const dpeParagraphs = generateDpeParagraphs(wordsWithIds); 130 | const normalisedSpeakers = normaliseWords(speakers); 131 | transcript.paragraphs = addSpeakerLabelToParagraphs(normalisedSpeakers, dpeParagraphs); 132 | 133 | return transcript; 134 | } 135 | 136 | module.exports = convertSpeechmaticsDpe; 137 | -------------------------------------------------------------------------------- /src/ElectronWrapper/seed-db/annotations.json: -------------------------------------------------------------------------------- 1 | [{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":246.58,"end":249.34,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"example note on this annotation","_id":"72d4ac9d0f16481eac83946a0384d12d","id":"72d4ac9d0f16481eac83946a0384d12d"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":585.66,"end":596.03,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"","_id":"4de867b1f8694235b01f64e4b5628cc1"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":13.86,"end":19.58,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"","_id":"ac440b482b5842a2aa36050ed74cc132"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"29cjw29xii80000ird74yb19swa","start":19.3,"end":24.3,"labelId":"920fa8f97acc43b5bc0694b2e5648080","note":"","_id":"9d78e7fa69274497956f2efbd39351c6"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":116.26,"end":122.62,"labelId":"default","note":"","_id":"c75da56b01aa4f2ab571abcec8b9da92"},{"projectId":"10046281c4ad4938b7d0ae6fa9899bec","transcriptId":"1000cjw29xii80000ird74yb19swa","start":9.48,"end":13.72,"labelId":"default","note":"","_id":"00dd43dbcdd8419e9177784158aac9fa"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":109.41,"end":119.2,"labelId":"default","note":"","_id":"1de06f64ea5a4dd4a7f4b68dfb917d53"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":366.26,"end":368.95,"labelId":"cb10e79c20af4a7f8b3fe8a4c789d43e","note":"","_id":"ef8a71a6ec684c9295b97ded19ebd383"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":55.36,"end":66.47,"labelId":"920fa8f97acc43b5bc0694b2e5648080","note":"","_id":"5c48fb82cfa9416baf480b5bab432521"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":89.86,"end":101.84,"labelId":"920fa8f97acc43b5bc0694b2e5648080","note":"","_id":"139d1ecc3c1c496892955cab9d8d0714"},{"projectId":"94346281c4ad4938b7d0ae6fa9899bec","transcriptId":"19cjw29xii80000ird74yb19swa","start":86.66,"end":100.87,"labelId":"db055983fabd40ef84dc35fbd3dfb40b","note":"","_id":"2a3e18369d9f497289730ad291ba34b8"},{"projectId":"10046281c4ad4938b7d0ae6fa9899bec","transcriptId":"1000cjw29xii80000ird74yb19swa","start":38.484375,"end":44.76,"labelId":"eab94271d5894c3a8800ee59cc03d7be","note":"","_id":"5551db9d9327400699268276f8522ae8"},{"projectId":"10046281c4ad4938b7d0ae6fa9899bec","transcriptId":"1000cjw29xii80000ird74yb19swa","start":59.69,"end":64.93,"labelId":"5d3827caaccc4909a36161568f0fa6cf","note":"","_id":"e5c051e0b45949779b45eba6fe47ebb0"},{"projectId":"10046281c4ad4938b7d0ae6fa9899bec","transcriptId":"1000cjw29xii80000ird74yb19swa","start":87.29,"end":96.03,"labelId":"5d3827caaccc4909a36161568f0fa6cf","note":"","_id":"74af7fcd6ec64a3eb8098ab10ee9f697"},{"projectId":"10046281c4ad4938b7d0ae6fa9899bec","transcriptId":"1000cjw29xii80000ird74yb19swa","start":2.175,"end":8.01,"labelId":"455e3e5275134e2caf51562364848aa7","note":"","_id":"5ef4ecaeb80b45f6bb1a7a3eb99f36eb"}] -------------------------------------------------------------------------------- /src/ElectronWrapper/seed-db/labels.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "_id": "default", 4 | "id": "default", 5 | "projectId": "default", 6 | "value": "default", 7 | "label": "Default", 8 | "color": "orange", 9 | "description": "A default label" 10 | }, 11 | { 12 | "value": "greenyellow", 13 | "label": "Bacteria", 14 | "color": "greenyellow", 15 | "description": "Talking about Bacteria and technology", 16 | "projectId": "94346281c4ad4938b7d0ae6fa9899bec", 17 | "_id": "920fa8f97acc43b5bc0694b2e5648080", 18 | "id": "920fa8f97acc43b5bc0694b2e5648080" 19 | }, 20 | { 21 | "value": "deepskyblue", 22 | "label": "Test", 23 | "color": "deepskyblue", 24 | "description": "Test blue", 25 | "projectId": "54bae8166afc4b379de5d4e10b77218d", 26 | "_id": "64b071fefa394b5b968c56f8b14149b7", 27 | "id": "64b071fefa394b5b968c56f8b14149b7" 28 | }, 29 | { 30 | "value": "crimson", 31 | "label": "Robotics", 32 | "color": "crimson", 33 | "description": "when they speak about robotics", 34 | "projectId": "94346281c4ad4938b7d0ae6fa9899bec", 35 | "_id": "cb10e79c20af4a7f8b3fe8a4c789d43e", 36 | "id": "cb10e79c20af4a7f8b3fe8a4c789d43e" 37 | }, 38 | { 39 | "value": "yellow", 40 | "label": "Test", 41 | "color": "yellow", 42 | "description": "", 43 | "projectId": "94346281c4ad4938b7d0ae6fa9899bec", 44 | "_id": "bddffe16cf024b2dbe74be4d64eb0ed4", 45 | "id": "bddffe16cf024b2dbe74be4d64eb0ed4" 46 | }, 47 | { 48 | "value": "brown", 49 | "label": "darkcyan test", 50 | "color": "brown", 51 | "description": "", 52 | "projectId": "10046281c4ad4938b7d0ae6fa9899bec", 53 | "_id": "0b03b9a2c0e247619d3ad88c12157c7e", 54 | "id": "0b03b9a2c0e247619d3ad88c12157c7e" 55 | }, 56 | { 57 | "value": "blueviolet", 58 | "label": "blueviolet", 59 | "color": "blueviolet", 60 | "description": "", 61 | "projectId": "10046281c4ad4938b7d0ae6fa9899bec", 62 | "_id": "c5a962dd9254444dbdae3d519573810f", 63 | "id": "c5a962dd9254444dbdae3d519573810f" 64 | } 65 | ] -------------------------------------------------------------------------------- /src/ElectronWrapper/seed-db/projects.json: -------------------------------------------------------------------------------- 1 | [{"title":"Ted Talks","description":"Ted Talks - sample project","_id":"94346281c4ad4938b7d0ae6fa9899bec"},{"title":"PBS Frontline - The Facebook Dilemma","description":"Interviews from PBS Frontline documentary, The Facebook Dilemma - sample project.","_id":"10046281c4ad4938b7d0ae6fa9899bec"}] -------------------------------------------------------------------------------- /src/dev-app-update.yml: -------------------------------------------------------------------------------- 1 | owner: pietrop 2 | repo: digital-paper-edit-electron 3 | provider: github -------------------------------------------------------------------------------- /src/make-menu-template.js: -------------------------------------------------------------------------------- 1 | makeMenuTemplate = ({ app, createNewSettingsWindow, createMainWindow, checkForUpdates }) => { 2 | const template = [ 3 | { 4 | label: 'Application', 5 | submenu: [ 6 | { 7 | label: 'About Application', 8 | selector: 'orderFrontStandardAboutPanel:', 9 | }, 10 | { type: 'separator' }, 11 | { 12 | label: 'Quit', 13 | accelerator: 'Command+Q', 14 | click: function() { 15 | app.quit(); 16 | }, 17 | }, 18 | ], 19 | }, 20 | { 21 | label: 'Edit', 22 | submenu: [ 23 | { label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:' }, 24 | { label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:' }, 25 | { type: 'separator' }, 26 | { label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:' }, 27 | { label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:' }, 28 | { label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:' }, 29 | { role: 'pasteandmatchstyle' }, 30 | { role: 'delete' }, 31 | { 32 | label: 'Select All', 33 | accelerator: 'CmdOrCtrl+A', 34 | selector: 'selectAll:', 35 | }, 36 | { type: 'separator' }, 37 | { 38 | label: 'Speech', 39 | submenu: [ 40 | { role: 'startspeaking', accelerator: 'CmdOrCtrl+E' }, //perhaps add keyboard shortcut? 41 | { role: 'stopspeaking', accelerator: 'CmdOrCtrl+Shift+E' }, //perhaps add keyboard shortcut? 42 | ], 43 | }, 44 | ], 45 | }, 46 | { 47 | label: 'View', 48 | submenu: [ 49 | { role: 'reload' }, 50 | { role: 'forcereload' }, 51 | { role: 'toggledevtools', accelerator: 'CmdOrCtrl+Alt+I' }, 52 | { type: 'separator' }, 53 | { role: 'resetzoom' }, 54 | { role: 'zoomin' }, 55 | { role: 'zoomout' }, 56 | { type: 'separator' }, 57 | { role: 'togglefullscreen' }, 58 | ], 59 | }, 60 | { 61 | role: 'window', 62 | submenu: [ 63 | { role: 'minimize' }, 64 | { role: 'close' }, 65 | { type: 'separator' }, 66 | { 67 | label: 'New main window', 68 | click() { 69 | createMainWindow(); 70 | }, 71 | accelerator: 'CmdOrCtrl+N', 72 | }, 73 | ], 74 | }, 75 | { 76 | label: 'Speech To Text Settings', 77 | submenu: [ 78 | { 79 | label: 'Edit Speech To Text configuration', 80 | click() { 81 | createNewSettingsWindow(); 82 | }, 83 | accelerator: 'CmdOrCtrl+S+T', 84 | }, 85 | ], 86 | }, 87 | // { 88 | // label: 'Search', 89 | // submenu: [ 90 | // { 91 | // label: 'Electron Search', 92 | // click() { 93 | // // electronSearch(); 94 | // }, 95 | // accelerator: 'CmdOrCtrl+F' 96 | // } 97 | // ] 98 | // }, 99 | { 100 | role: 'help', 101 | submenu: [ 102 | { 103 | label: 'Project Page', 104 | click() { 105 | require('electron').shell.openExternal('https://www.autoedit.io'); 106 | }, 107 | }, 108 | { 109 | label: 'User Manual', 110 | click() { 111 | require('electron').shell.openExternal('https://autoedit.gitbook.io/autoedit-3-user-manual'); 112 | }, 113 | }, 114 | ], 115 | }, 116 | ]; 117 | 118 | return template; 119 | }; 120 | 121 | module.exports = makeMenuTemplate; 122 | -------------------------------------------------------------------------------- /src/prompt.js: -------------------------------------------------------------------------------- 1 | const { ipcRenderer } = require('electron'); 2 | console.log('prompt.js'); 3 | window.prompt = function(title, val) { 4 | return ipcRenderer.sendSync('prompt', { title, val }); 5 | }; 6 | -------------------------------------------------------------------------------- /src/stt-settings/credentials.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | // const downloadDeepSpeechModel = require('deepspeech-node-wrapper').downloadDeepSpeechModel; 4 | const { ipcRenderer } = require('electron'); 5 | const appUserDataPath = ipcRenderer.sendSync('synchronous-message-get-user-data-folder', 'ping'); 6 | // TODO: consider moving deepspeech logic to a separate file from credentials.js? 7 | 8 | const DEEP_SPEECH_MODEL_V = '0.9.3'; 9 | 10 | function getDeepSpeechModelFolderName(modelVersion = DEEP_SPEECH_MODEL_V) { 11 | // return `deepspeech-${modelVersion}-models`; 12 | return 'models'; 13 | } 14 | 15 | function getDeepSpeechModelPath(deepspeechModelVersion) { 16 | return path.join(appUserDataPath, getDeepSpeechModelFolderName(deepspeechModelVersion)); 17 | } 18 | 19 | // TODO: add some way to check if model, 20 | // folder and necessary files, 21 | // are set in user folder in application libary path 22 | // Files required described in README of https://github.com/pietrop/deepspeech-node-wrapper 23 | function getIsDeepspeechModelSet() { 24 | // eg check if this path exists? 25 | const deepSpeechModelPath = getDeepSpeechModelPath(); 26 | const isDeepSpeechModelPath = fs.existsSync(deepSpeechModelPath); 27 | // Extra checks to make sure the files needed by the model exists 28 | // "output_graph.pbmm" 29 | const outputGraphPbmmPath = path.join(deepSpeechModelPath, 'deepspeech-0.9.3-models.pbmm'); 30 | const isOutputGraphPbmmPath = fs.existsSync(outputGraphPbmmPath); 31 | // "lm.binary" 32 | // const lmBinaryPath = path.join(deepSpeechModelPath, 'lm.binary'); 33 | // const islBinaryPath = fs.existsSync(lmBinaryPath); 34 | // "trie" 35 | // const triePath = path.join(deepSpeechModelPath, 'trie'); 36 | // const isTriePath = fs.existsSync(triePath); 37 | 38 | // return isDeepSpeechModelPath && isTriePath && islBinaryPath && isOutputGraphPbmmPath; 39 | return isDeepSpeechModelPath && isOutputGraphPbmmPath; 40 | } 41 | 42 | function setDeepSpeechModel(progressCallback) { 43 | // console.log('setDeepSpeechModel'); 44 | // const outputPath = path.join(appUserDataPath); //getDeepSpeechModelPath(); 45 | 46 | // return new Promise((resolve, reject) => { 47 | // downloadDeepSpeechModel(outputPath, DEEP_SPEECH_MODEL_V, progressCallback) 48 | // .then((res) => { 49 | // console.log('res', res); 50 | // resolve(res); 51 | // }) 52 | // .catch((error) => { 53 | // console.error('error setting up the Deepspeech model, during download', error); 54 | // reject(error); 55 | // }); 56 | // }); 57 | } 58 | 59 | const credentialsTemplate = { 60 | provider: '', 61 | sttUserName: '', 62 | sttAPIKey: '', 63 | sttAPIUrl: '', 64 | }; 65 | 66 | function deepCopy(data) { 67 | return JSON.parse(JSON.stringify(data)); 68 | } 69 | 70 | function getCredentialsFilePath(provider) { 71 | return path.join(appUserDataPath, `${provider}.json`); 72 | } 73 | 74 | function setCredentials(data) { 75 | fs.writeFileSync(getCredentialsFilePath(data.provider), JSON.stringify(data, null, 2)); 76 | } 77 | 78 | function getCredentials(provider) { 79 | let credentials = deepCopy(credentialsTemplate); 80 | credentials.provider = provider; 81 | const credentialsFilePath = getCredentialsFilePath(provider); 82 | 83 | if (fs.existsSync(credentialsFilePath)) { 84 | credentials = JSON.parse(fs.readFileSync(credentialsFilePath).toString()); 85 | 86 | return credentials; 87 | } else { 88 | return credentials; 89 | } 90 | } 91 | 92 | function areCredentialsSet(provider) { 93 | const credentials = getCredentials(provider); 94 | switch (provider) { 95 | case 'AssemblyAI': 96 | return credentials.sttAPIKey !== ''; 97 | case 'Speechmatics': 98 | return credentials.sttUserName !== '' && credentials.sttAPIKey !== ''; 99 | default: 100 | console.error(`Could not find credentials for provier: ${provider}`); 101 | 102 | return false; 103 | } 104 | } 105 | 106 | module.exports.setCredentials = setCredentials; 107 | module.exports.getCredentials = getCredentials; 108 | module.exports.areCredentialsSet = areCredentialsSet; 109 | module.exports.getIsDeepspeechModelSet = getIsDeepspeechModelSet; 110 | module.exports.setDeepSpeechModel = setDeepSpeechModel; 111 | module.exports.getDeepSpeechModelPath = getDeepSpeechModelPath; 112 | -------------------------------------------------------------------------------- /src/stt-settings/default-stt.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const { ipcRenderer } = require('electron'); 4 | const appUserDataPath = ipcRenderer.sendSync('synchronous-message-get-user-data-folder', 'ping'); 5 | const defaultSttTemplate = { 6 | // Provider could be '' unspecified, 7 | // or pocketsphinx, to give a working default to the app. 8 | // altho having pocketsphinx as default causes issue in windows version where it's not available 9 | provider: '', 10 | language: null, 11 | languageModel: null, 12 | }; 13 | 14 | function deepCopy(data) { 15 | return JSON.parse(JSON.stringify(data)); 16 | } 17 | 18 | function getDefaultSttFilePath() { 19 | return path.join(appUserDataPath, 'default-stt.json'); 20 | } 21 | 22 | function setDefaultStt(data) { 23 | fs.writeFileSync(getDefaultSttFilePath(), JSON.stringify(data, null, 2)); 24 | } 25 | 26 | function getDefaultStt() { 27 | let defaultStt = deepCopy(defaultSttTemplate); 28 | // defaultStt.provider = data.provider; 29 | // defaultStt.language = data.language; 30 | const defaultSttFilePath = getDefaultSttFilePath(); 31 | 32 | if (fs.existsSync(defaultSttFilePath)) { 33 | defaultStt = JSON.parse(fs.readFileSync(defaultSttFilePath).toString()); 34 | 35 | return defaultStt; 36 | } else { 37 | return defaultStt; 38 | } 39 | } 40 | 41 | module.exports.setDefaultStt = setDefaultStt; 42 | module.exports.getDefaultStt = getDefaultStt; 43 | -------------------------------------------------------------------------------- /src/stt-settings/language-options/assemblyai.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": "assemblyai_default", 4 | "language": "English - All accents" 5 | }, 6 | { 7 | "code": "assemblyai_en_uk", 8 | "language": "English – British" 9 | }, 10 | { 11 | "code": "assemblyai_en_au", 12 | "language": "English – Australian" 13 | }, 14 | { 15 | "code": "assemblyai_en_za", 16 | "language": "English – South Africa" 17 | } 18 | ] -------------------------------------------------------------------------------- /src/stt-settings/language-options/speechmatics.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "code": "en-GB", 4 | "language": "English – British" 5 | }, 6 | { 7 | "code": "en-AU", 8 | "language": "English – Australian" 9 | }, 10 | { 11 | "code": "en-US", 12 | "language": "English – N. American" 13 | }, 14 | { 15 | "code": "en", 16 | "language": "English – Global" 17 | }, 18 | { 19 | "code": "bg", 20 | "language": "Bulgarian" 21 | }, 22 | { 23 | "code": "ca", 24 | "language": "Catalan" 25 | }, 26 | { 27 | "code": "hr", 28 | "language": "Croatian" 29 | }, 30 | { 31 | "code": "cs", 32 | "language": "Czech" 33 | }, 34 | { 35 | "code": "da", 36 | "language": "Danish" 37 | }, 38 | { 39 | "code": "nl", 40 | "language": "Dutch" 41 | }, 42 | { 43 | "code": "fi", 44 | "language": "Finnish" 45 | }, 46 | { 47 | "code": "fr", 48 | "language": "French" 49 | }, 50 | { 51 | "code": "de", 52 | "language": "German" 53 | }, 54 | { 55 | "code": "el", 56 | "language": "Greek" 57 | }, 58 | { 59 | "code": "hi", 60 | "language": "Hindi" 61 | }, 62 | { 63 | "code": "hu", 64 | "language": "Hungarian" 65 | }, 66 | { 67 | "code": "it", 68 | "language": "Italian" 69 | }, 70 | { 71 | "code": "ms", 72 | "language": "Malay" 73 | }, 74 | { 75 | "code": "ja", 76 | "language": "Japanese" 77 | }, 78 | { 79 | "code": "ko", 80 | "language": "Korean" 81 | }, 82 | { 83 | "code": "lv", 84 | "language": "Latvian" 85 | }, 86 | { 87 | "code": "lt", 88 | "language": "Lithuanian" 89 | }, 90 | { 91 | "code": "pl", 92 | "language": "Polish" 93 | }, 94 | { 95 | "code": "pt", 96 | "language": "Portuguese" 97 | }, 98 | { 99 | "code": "ro", 100 | "language": "Romanian" 101 | }, 102 | { 103 | "code": "ru", 104 | "language": "Russian" 105 | }, 106 | { 107 | "code": "sk", 108 | "language": "Slovak" 109 | }, 110 | { 111 | "code": "sl", 112 | "language": "Slovenian" 113 | }, 114 | { 115 | "code": "es", 116 | "language": "Spanish" 117 | }, 118 | { 119 | "code": "sv", 120 | "language": "Swedish" 121 | }, 122 | { 123 | "code": "tr", 124 | "language": "Turkish" 125 | } 126 | ] -------------------------------------------------------------------------------- /src/worker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | I'm a hidden worker 7 | 8 | 9 | 10 | Transcriber Worker 11 | 35 | 36 | 37 | --------------------------------------------------------------------------------