speaker-calibration 1.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +87 -26
  2. package/dist/main.js +1 -1
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -1,46 +1,98 @@
1
1
  # Speaker-Calibration
2
2
 
3
+ Speaker-Calibration provides a simple API for performing speaker calibration in Javascript. The
4
+ Library has minimal dependencies and is designed to be used in the browser.
5
+
3
6
  [![Netlify Status](https://api.netlify.com/api/v1/badges/4662ab8c-dd4f-43ce-8e2d-add7a406300a/deploy-status)](https://app.netlify.com/sites/focused-hodgkin-0a6531/deploys)
4
7
 
5
- # Contribution Guidelines
8
+ ## Usage
9
+
10
+ ```html
11
+ <!-- index.html --->
12
+ ...
13
+ <body>
14
+ ...
15
+ <script src="https://unpkg.com/speaker-calibration@1.4.1/dist/main.js"></script>
16
+ </body>
17
+ ```
18
+
19
+ ```javascript
20
+ // speaker.js
21
+
22
+ // initialize the chosen calibrator with the paramters, or pass no paramters to use default settings
23
+ const calibrator = new ImpulseResponseCalibration({
24
+ numCaptures: 3,
25
+ numMLSPerCapture: 3,
26
+ download: false,
27
+ });
28
+
29
+ // pass the calibrator and speaker paramters to the startCalibration method (async)
30
+ const invertedIR = await Speaker.startCalibration(
31
+ {
32
+ siteUrl: window.location.href.substring(0, location.href.lastIndexOf('/')),
33
+ targetElementId: 'display',
34
+ },
35
+ calibrator
36
+ );
37
+ ```
38
+
39
+ ```javascript
40
+ // listener.js
41
+
42
+ window.listener = new speakerCalibrator.Listener({
43
+ targetElementId: 'display',
44
+ });
45
+ ```
46
+
47
+ ## UML Design
6
48
 
7
- _As of 03/01/2022_
49
+ ![UML Diagram of the Speaker Calibration Library](doc/Speaker-Calibration-UML-Diagram.png)
8
50
 
9
- ## Initial Setup
51
+ ## Impulse Response Calibration Logic
52
+
53
+ ![Logic Diagram of the Speaker Calibration Library](doc/sc-activity-diagram.png)
54
+
55
+ ---
56
+
57
+ ## Contribution Guidelines
58
+
59
+ _As of 07/29/2022_
60
+
61
+ ### Initial Setup
10
62
 
11
63
  1. `git clone https://github.com/EasyEyes/speaker-calibration.git`
12
64
  2. `cd speaker-calibration`
13
65
  3. `npm i`
14
66
 
15
- ## Local Development
16
-
17
67
  All outputs from the scripts/recipies below should be automatically placed in the `/dist` directory.
18
68
  This is what will be served once the library is published.
19
69
 
20
- ### Example
70
+ #### Example
21
71
 
22
72
  In `/dist/example` you will find a small example app that uses the `speaker-calibration` library.
23
73
 
24
- ### Javascript
74
+ #### Javascript
25
75
 
26
76
  In `package.json` you will see some key scripts:
27
77
 
28
- 1. `build:wasm` cleans and rebuilds the wasm files
29
- 2. `build:dev` tells webpack to build the `speaker-calibration` library in development watch mode,
30
- outputing to `/dist`
31
- 3. `serve:dev` spins up an `express.js` server on port `3000` using `nodemon`. It serves the
78
+ 1. `build:prod` tells webpack to build the library in production mode, outputing to `/dist`
79
+ 2. `build:dev` tells webpack to build the library in development watch mode, outputing to `/dist`
80
+ 3. `build:dev:analyze` tells webpack to build the library in development mode and open up a bundle
81
+ analysis page. Helpful for viewing the size of the library, broken down by individual modules
82
+ and/or dependencies.
83
+ 4. `serve:dev` spins up an `express.js` server on port `3000` using `nodemon`. It serves the
32
84
  `/dist` & `/dist/example` folders.
33
- 4. `lint` runs `eslint` on all js files in the project
34
- 5. `lint:fix` lints and automatically fixes all js files in the project.
35
- 6. `build:doc` builds the documentation using `jsdoc`. Outputs to `/doc`
85
+ 5. `build:wasm` calls the makefile recipe to clean, and rebuild the web assembly code (requires
86
+ emscripten installed, more details below)
87
+ 6. `lint` runs `eslint` on all js files in the project
88
+ 7. `lint:fix` lints and automatically fixes all js files in the project.
89
+ 8. `build:doc` builds the documentation using `jsdoc`. Outputs to `/doc`
36
90
 
37
- Run `(1)` & `(2)` in seperate shell windows, with this setup you will be able to modify both the
38
- library and front end examples with hot reload built in. `(3)` provides a simple abstraction on the
39
- `makefile` recipies below. Run `(5)` precommit to keep you code standardized.
91
+ Run `(2)` & `(3)` in seperate shell windows, with this setup you will be able to modify both the
92
+ library and front end examples with hot reload built in. Run `(7)` precommit to keep you code
93
+ standardized.
40
94
 
41
- TODO Make `(5)` a precommit hook
42
-
43
- ### CPP/WASM
95
+ #### CPP/WASM
44
96
 
45
97
  We are using [Emscripten](https://emscripten.org/) to compile the C++ code into a wasm file. Usage
46
98
  requires the installation of the Emscriten compiler. Instructions can be found on their website. In
@@ -53,20 +105,29 @@ requires the installation of the Emscriten compiler. Instructions can be found o
53
105
  - `clean` cleans up and generated code
54
106
  - `rebuild` cleans and rebuilds the output. Run this after making changes to the cpp files.
55
107
 
56
- ### Documentation
108
+ #### Documentation
57
109
 
58
110
  We use [jsdoc](https://jsdoc.app/) standards to document our library.
59
111
 
60
- ### Listing
112
+ #### Linting
61
113
 
62
114
  We use [ESLint](https://eslint.org/) to lint our code and enforce best practices. We are currently
63
115
  using [AirBnB's JavaScript Style Guide](https://airbnb.io/javascript/)
64
116
 
65
- ### Styling
117
+ #### Styling
66
118
 
67
119
  We use [Prettier](https://prettier.io/) to format our code.
68
120
 
69
- ## Deployment
121
+ ---
122
+
123
+ ### Deployment
70
124
 
71
- Changes publshed to `main` will automatically trigger a deploy on the `netlify` project TODO: Fix
72
- netlify deploy not serving the /dist & /example folders
125
+ - Changes publshed to `main` will automatically trigger a deploy on the `netlify` project. This
126
+ deployment is only relevant to the `example` app, it will not make any changes to any others using
127
+ the library.
128
+ - `speaker-calibration` is library that is published to [npm](https://www.npmjs.com/). This means
129
+ that in order to make your changes 'live' a new version of the library needs to be published.
130
+ Conveniently, there exists an npm package [np](https://www.npmjs.com/package/np) which provides a
131
+ lot of helpful abstractions and UI elements when dealing with npm.
132
+ - Once a new version of the library is published, it is then live for anyone to use by bumping the
133
+ version they're using up to the newest release.