2.2.160 • Published 2 months ago

speaker-calibration v2.2.160

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Speaker-Calibration

Speaker-Calibration provides a simple API for performing speaker calibration in Javascript. The Library has minimal dependencies and is designed to be used in the browser.

Netlify Status

Usage

<!-- index.html --->
...
<body>
  ...
  <script src="https://unpkg.com/speaker-calibration@1.4.1/dist/main.js"></script>
</body>
// speaker.js

// initialize the chosen calibrator with the paramters, or pass no paramters to use default settings
const calibrator = new ImpulseResponseCalibration({
  numCaptures: 3,
  numMLSPerCapture: 3,
  download: false,
});

// pass the calibrator and speaker paramters to the startCalibration method (async)
const invertedIR = await Speaker.startCalibration(
  {
    siteUrl: window.location.href.substring(0, location.href.lastIndexOf('/')),
    targetElementId: 'display',
  },
  calibrator
);
// listener.js

window.listener = new speakerCalibrator.Listener({
  targetElementId: 'display',
});

UML Design

UML Diagram of the Speaker Calibration Library

Impulse Response Calibration Logic

Logic Diagram of the Speaker Calibration Library


Contribution Guidelines

As of 07/29/2022

Initial Setup

  1. git clone https://github.com/EasyEyes/speaker-calibration.git
  2. cd speaker-calibration
  3. npm i

All outputs from the scripts/recipies below should be automatically placed in the /dist directory. This is what will be served once the library is published.

Example

In /dist/example you will find a small example app that uses the speaker-calibration library.

Javascript

In package.json you will see some key scripts:

  1. build:prod tells webpack to build the library in production mode, outputing to /dist
  2. build:dev tells webpack to build the library in development watch mode, outputing to /dist
  3. build:dev:analyze tells webpack to build the library in development mode and open up a bundle analysis page. Helpful for viewing the size of the library, broken down by individual modules and/or dependencies.
  4. serve:dev spins up an express.js server on port 3000 using nodemon. It serves the /dist & /dist/example folders.
  5. build:wasm calls the makefile recipe to clean, and rebuild the web assembly code (requires emscripten installed, more details below)
  6. lint runs eslint on all js files in the project
  7. lint:fix lints and automatically fixes all js files in the project.
  8. build:doc builds the documentation using jsdoc. Outputs to /doc

Run (2) & (3) in seperate shell windows, with this setup you will be able to modify both the library and front end examples with hot reload built in. Run (7) precommit to keep you code standardized.

CPP/WASM

We are using Emscripten to compile the C++ code into a wasm file. Usage requires the installation of the Emscriten compiler. Instructions can be found on their website. In makefile you will see a few recipies:

  • mlsGen_bind compiles the cpp files to wasm, generating a modularized javascript "glue" file, using embind. This is the current build target
  • mlsGen_module compiles the cpp files to wasm, generating a modularized javascript "glue" file.
  • mlsGen_wasm compiles the cpp file to a stand-alone wasm without a javascript "clue" file.
  • clean cleans up and generated code
  • rebuild cleans and rebuilds the output. Run this after making changes to the cpp files.

Documentation

We use jsdoc standards to document our library.

Linting

We use ESLint to lint our code and enforce best practices. We are currently using AirBnB's JavaScript Style Guide

Styling

We use Prettier to format our code.


Deployment

  • Changes publshed to main will automatically trigger a deploy on the netlify project. This deployment is only relevant to the example app, it will not make any changes to any others using the library.
  • speaker-calibration is library that is published to npm. This means that in order to make your changes 'live' a new version of the library needs to be published. Conveniently, there exists an npm package np which provides a lot of helpful abstractions and UI elements when dealing with npm.
  • Once a new version of the library is published, it is then live for anyone to use by bumping the version they're using up to the newest release.
2.2.160

2 months ago

2.2.157

2 months ago

2.2.159

2 months ago

2.2.158

2 months ago

2.2.156

2 months ago

2.2.155

2 months ago

2.2.154

2 months ago

2.2.153

3 months ago

2.2.152

3 months ago

2.2.151

3 months ago

2.2.150

3 months ago

2.2.149

3 months ago

2.2.148

3 months ago

2.2.147

4 months ago

2.2.146

4 months ago

2.2.145

4 months ago

2.2.144

4 months ago

2.2.143

4 months ago

2.2.142

5 months ago

2.2.141

5 months ago

2.2.140

5 months ago

2.2.139

5 months ago

2.2.138

5 months ago

2.2.137

5 months ago

2.2.135

5 months ago

2.2.136

5 months ago

2.2.134

5 months ago

2.2.133

5 months ago

2.2.131

5 months ago

2.2.130

5 months ago

2.2.132

5 months ago

2.2.129

5 months ago

2.2.120

6 months ago

2.2.124

5 months ago

2.2.123

6 months ago

2.2.122

6 months ago

2.2.121

6 months ago

2.2.128

5 months ago

2.2.127

5 months ago

2.2.126

5 months ago

2.2.125

5 months ago

2.2.119

6 months ago

2.2.59

7 months ago

2.2.118

6 months ago

2.2.57

7 months ago

2.2.58

7 months ago

2.2.55

7 months ago

2.2.56

7 months ago

2.2.53

7 months ago

2.2.54

7 months ago

2.2.51

7 months ago

2.2.52

7 months ago

2.2.113

6 months ago

2.2.112

6 months ago

2.2.111

6 months ago

2.2.110

6 months ago

2.2.117

6 months ago

2.2.116

6 months ago

2.2.115

6 months ago

2.2.114

6 months ago

2.2.109

6 months ago

2.2.108

6 months ago

2.2.107

6 months ago

2.2.68

7 months ago

2.2.69

7 months ago

2.2.66

7 months ago

2.2.67

7 months ago

2.2.64

7 months ago

2.2.65

7 months ago

2.2.62

7 months ago

2.2.63

7 months ago

2.2.60

7 months ago

2.2.61

7 months ago

2.2.79

7 months ago

2.2.77

7 months ago

2.2.78

7 months ago

2.2.75

7 months ago

2.2.76

7 months ago

2.2.73

7 months ago

2.2.74

7 months ago

2.2.71

7 months ago

2.2.72

7 months ago

2.2.70

7 months ago

2.2.88

6 months ago

2.2.89

6 months ago

2.2.86

6 months ago

2.2.87

6 months ago

2.2.84

7 months ago

2.2.85

6 months ago

2.2.82

7 months ago

2.2.83

7 months ago

2.2.80

7 months ago

2.2.81

7 months ago

2.2.90

6 months ago

2.2.99

6 months ago

2.2.97

6 months ago

2.2.98

6 months ago

2.2.95

6 months ago

2.2.96

6 months ago

2.2.93

6 months ago

2.2.94

6 months ago

2.2.91

6 months ago

2.2.92

6 months ago

2.2.102

6 months ago

2.2.101

6 months ago

2.2.100

6 months ago

2.2.106

6 months ago

2.2.105

6 months ago

2.2.104

6 months ago

2.2.103

6 months ago

2.2.50

7 months ago

2.2.39

7 months ago

2.2.37

7 months ago

2.2.38

7 months ago

2.2.35

8 months ago

2.2.36

7 months ago

2.2.33

8 months ago

2.2.34

8 months ago

2.2.31

8 months ago

2.2.32

8 months ago

2.2.48

7 months ago

2.2.49

7 months ago

2.2.46

7 months ago

2.2.47

7 months ago

2.2.44

7 months ago

2.2.45

7 months ago

2.2.42

7 months ago

2.2.43

7 months ago

2.2.40

7 months ago

2.2.41

7 months ago

2.2.17

9 months ago

2.2.1

10 months ago

2.2.18

9 months ago

2.2.0

10 months ago

2.2.15

9 months ago

2.2.3

10 months ago

2.2.16

9 months ago

2.2.2

10 months ago

2.2.13

9 months ago

2.2.14

9 months ago

2.2.4

10 months ago

2.2.11

9 months ago

2.2.7

9 months ago

2.2.12

9 months ago

2.2.6

10 months ago

2.2.10

9 months ago

2.2.19

9 months ago

2.2.28

8 months ago

2.2.29

8 months ago

2.1.17

12 months ago

2.2.26

8 months ago

2.2.27

8 months ago

2.2.24

8 months ago

2.2.25

8 months ago

2.2.22

9 months ago

2.2.23

9 months ago

2.2.20

9 months ago

2.2.21

9 months ago

2.1.18

11 months ago

2.1.19

11 months ago

2.1.27

10 months ago

2.1.28

10 months ago

2.1.25

10 months ago

2.1.26

10 months ago

2.1.23

11 months ago

2.1.24

10 months ago

2.1.21

11 months ago

2.1.22

11 months ago

2.1.20

11 months ago

2.2.30

8 months ago

2.2.9

9 months ago

2.2.8

9 months ago

2.1.29

10 months ago

2.1.30

10 months ago

2.1.31

10 months ago

2.1.8

1 year ago

2.1.9

1 year ago

2.1.16

1 year ago

2.1.14

1 year ago

2.1.15

1 year ago

2.1.12

1 year ago

2.1.13

1 year ago

2.1.10

1 year ago

2.1.11

1 year ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.6

1 year ago

2.1.5

1 year ago

2.1.7

1 year ago

2.1.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.4.1

2 years ago

1.1.4

2 years ago

1.4.0

2 years ago

1.1.3

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.1.2

2 years ago

2.0.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago