@logue/reverb 0.5.1 → 0.5.2

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.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019-2021 Masashi Yoshikawa <https://logue.dev>
3
+ Copyright (c) 2019-2022 Masashi Yoshikawa <https://logue.dev>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Reverb.js
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40logue%2Freverb.svg)](https://badge.fury.io/js/%40logue%2Freverb)
3
+ [![jsdelivr CDN](https://data.jsdelivr.com/v1/package/npm/@logue/reverb/badge)](https://www.jsdelivr.com/package/npm/@logue/reverb)
4
+ [![NPM Downloads](https://img.shields.io/npm/dm/vuetify-swatches.svg?style=flat)](https://www.npmjs.com/package/@logue/reverb)
5
+ [![Open in unpkg](https://img.shields.io/badge/Open%20in-unpkg-blue)](https://uiwjs.github.io/npm-unpkg/#/pkg/@logue/reverb/file/README.md)
6
+ [![npm version](https://img.shields.io/npm/v/@logue/reverb.svg)](https://www.npmjs.com/package/@logue/reverb)
7
+ [![Open in Gitpod](https://shields.io/badge/Open%20in-Gitpod-green?logo=Gitpod)](https://gitpod.io/#https://github.com/logue/Reverb.js)
4
8
 
5
9
  Append reverb effect to audio source.
6
10
 
@@ -8,22 +12,22 @@ This script is originally a spin out of [sf2synth.js](https://github.com/logue/s
8
12
 
9
13
  ## Sample
10
14
 
11
- * <https://logue.dev/Reverb.js/>
12
- * <https://logue.dev/Reverb.js/localaudio.html>
15
+ - <https://logue.dev/Reverb.js/>
16
+ - <https://logue.dev/Reverb.js/localaudio.html>
13
17
 
14
18
  ## Syntax
15
19
 
16
20
  ```js
17
21
  const reverb = new Reverb(ctx, {
18
- noise: 0, // Inpulse Response Noise algorithm (0: White noise, 1: Pink noise, 2: Brown noise)
19
- decay: 5, // Amount of IR (Inpulse Response) decay. 0~100
20
- delay: 0, // Delay time o IR. (NOT delay effect) 0~100 [sec]
21
- filterFreq: 2200, // Filter frequency. 20~5000 [Hz]
22
- filterQ: 1, // Filter quality. 0~10
23
- filterType: 'lowpass', // Filter type. 'bandpass' etc. See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/type .
24
- mix: 0.5, // Dry (Original Sound) and Wet (Effected sound) raito. 0~1
25
- reverse: false, // Reverse IR.
26
- time: 3 // Time length of IR. 0~50 [sec]
22
+ noise: 0, // Inpulse Response Noise algorithm (0: White noise, 1: Pink noise, 2: Brown noise)
23
+ decay: 5, // Amount of IR (Inpulse Response) decay. 0~100
24
+ delay: 0, // Delay time o IR. (NOT delay effect) 0~100 [sec]
25
+ filterFreq: 2200, // Filter frequency. 20~5000 [Hz]
26
+ filterQ: 1, // Filter quality. 0~10
27
+ filterType: 'lowpass', // Filter type. 'bandpass' etc. See https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode/type .
28
+ mix: 0.5, // Dry (Original Sound) and Wet (Effected sound) raito. 0~1
29
+ reverse: false, // Reverse IR.
30
+ time: 3, // Time length of IR. 0~50 [sec]
27
31
  });
28
32
  ```
29
33
 
@@ -60,10 +64,10 @@ sourceNode.play();
60
64
 
61
65
  ## Reference
62
66
 
63
- * [Web Audio API](https://www.w3.org/TR/webaudio/)
64
- * [Web Audio API日本語訳](https://g200kg.github.io/web-audio-api-ja/)
65
- * [コンボルバーの使い方](https://www.g200kg.com/jp/docs/webaudio/convolver.html)
66
- * [WebAudioの闇](https://qiita.com/zprodev/items/7fcd8335d7e8e613a01f)
67
+ - [Web Audio API](https://www.w3.org/TR/webaudio/)
68
+ - [Web Audio API 日本語訳](https://g200kg.github.io/web-audio-api-ja/)
69
+ - [コンボルバーの使い方](https://www.g200kg.com/jp/docs/webaudio/convolver.html)
70
+ - [WebAudio の闇](https://qiita.com/zprodev/items/7fcd8335d7e8e613a01f)
67
71
 
68
72
  ## License
69
73
 
@@ -1,4 +1,4 @@
1
1
  import type MetaInterface from '@/interfaces/MetaInterface';
2
2
  declare const meta: MetaInterface;
3
3
  export default meta;
4
- // # sourceMappingURL=Meta.d.ts.map
4
+ //# sourceMappingURL=Meta.d.ts.map
File without changes
@@ -1,14 +1,14 @@
1
1
  /** Impulse response noise generation algorithm */
2
2
  declare const Noise: {
3
- /** White noise */
4
- readonly WHITE: 'white';
5
- /** Pink noise */
6
- readonly PINK: 'pink';
7
- /** Brown Noise */
8
- readonly BROWN: 'brown';
3
+ /** White noise */
4
+ readonly WHITE: "white";
5
+ /** Pink noise */
6
+ readonly PINK: "pink";
7
+ /** Brown Noise */
8
+ readonly BROWN: "brown";
9
9
  };
10
10
  /** Noise Type */
11
11
  export declare type NoiseType = typeof Noise[keyof typeof Noise];
12
12
  /** Noise */
13
13
  export default Noise;
14
- // # sourceMappingURL=NoiseType.d.ts.map
14
+ //# sourceMappingURL=NoiseType.d.ts.map
File without changes
@@ -0,0 +1,118 @@
1
+ import type OptionInterface from './interfaces/OptionInterface';
2
+ import { type NoiseType } from './NoiseType';
3
+ /**
4
+ * JS reverb effect class
5
+ *
6
+ * @license MIT
7
+ * @author Logue {@link logue@hotmail.co.jp}
8
+ * @copyright 2019-2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
9
+ * @see {@link https://github.com/logue/Reverb.js}
10
+ */
11
+ export default class Reverb {
12
+ /** Version strings */
13
+ readonly version: string;
14
+ /** Build date */
15
+ readonly build: string;
16
+ /** AudioContext */
17
+ private readonly ctx;
18
+ /** Wet Level (Reverberated node) */
19
+ private readonly wetGainNode;
20
+ /** Dry Level (Original sound node) */
21
+ private readonly dryGainNode;
22
+ /** Impulse response filter */
23
+ private readonly filterNode;
24
+ /** Convolution node for applying impulse response */
25
+ private readonly convolverNode;
26
+ /** Output nodse */
27
+ private readonly outputNode;
28
+ /** Option */
29
+ private readonly _options;
30
+ /** Connected flag */
31
+ private isConnected;
32
+ /**
33
+ * Constructor
34
+ *
35
+ * @param ctx - Root AudioContext
36
+ * @param options - Configure
37
+ */
38
+ constructor(ctx: AudioContext, options: OptionInterface | undefined);
39
+ /**
40
+ * Connect the node for the reverb effect to the original sound node.
41
+ *
42
+ * @param sourceNode - Input source node
43
+ */
44
+ connect(sourceNode: AudioNode): AudioNode;
45
+ /**
46
+ * Disconnect the reverb node
47
+ *
48
+ * @param sourceNode - Input source node
49
+ */
50
+ disconnect(sourceNode: AudioNode | undefined): AudioNode | undefined;
51
+ /**
52
+ * Dry/Wet ratio
53
+ *
54
+ * @param mix - Ratio (0~1)
55
+ */
56
+ mix(mix: number): void;
57
+ /**
58
+ * Set Impulse Response time length (second)
59
+ *
60
+ * @param value - IR length
61
+ */
62
+ time(value: number): void;
63
+ /**
64
+ * Impulse response decay rate.
65
+ *
66
+ * @param value - Decay value
67
+ */
68
+ decay(value: number): void;
69
+ /**
70
+ * Delay before reverberation starts
71
+ *
72
+ * @param value - Time[ms]
73
+ */
74
+ delay(value: number): void;
75
+ /**
76
+ * Reverse the impulse response.
77
+ *
78
+ * @param reverse - Reverse IR
79
+ */
80
+ reverse(reverse: boolean): void;
81
+ /**
82
+ * Filter for impulse response
83
+ *
84
+ * @param type - Filiter Type
85
+ */
86
+ filterType(type: BiquadFilterType): void;
87
+ /**
88
+ * Filter frequency applied to impulse response
89
+ *
90
+ * @param freq - Frequency
91
+ */
92
+ filterFreq(freq: number): void;
93
+ /**
94
+ * Filter quality.
95
+ *
96
+ * @param q - Quality
97
+ */
98
+ filterQ(q: number): void;
99
+ /**
100
+ * Inpulse Response Noise algorithm.
101
+ *
102
+ * @param type - IR noise algorithm type.
103
+ */
104
+ setNoise(type: NoiseType): void;
105
+ /**
106
+ * Return true if in range, otherwise false
107
+ *
108
+ * @param x - Target value
109
+ * @param min - Minimum value
110
+ * @param max - Maximum value
111
+ */
112
+ private inRange;
113
+ /** Utility function for building an impulse response from the module parameters. */
114
+ private buildImpulse;
115
+ /** Generate white noise */
116
+ private static whiteNoise;
117
+ }
118
+ //# sourceMappingURL=Reverb.d.ts.map
File without changes
@@ -0,0 +1,8 @@
1
+ /** Meta Information Interface */
2
+ export default interface MetaInterface {
3
+ /** Version */
4
+ version: string;
5
+ /** Build Date */
6
+ date: string;
7
+ }
8
+ //# sourceMappingURL=MetaInterface.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { NoiseType } from '../NoiseType';
2
+ /** Reverb Option */
3
+ export default interface OptionInterface {
4
+ /** Types of impulse response noise generation algorithms */
5
+ noise: NoiseType;
6
+ /** Decay */
7
+ decay: number;
8
+ /** Delay until impulse response is generated */
9
+ delay: number;
10
+ /** Filter frequency applied to impulse response[Hz] */
11
+ filterFreq: number;
12
+ /** Filter quality for impulse response */
13
+ filterQ: number;
14
+ /** Filter type for impulse response */
15
+ filterType: BiquadFilterType;
16
+ /** Dry/Wet ratio */
17
+ mix: number;
18
+ /** Invert the impulse response */
19
+ reverse: boolean;
20
+ /** Impulse response length */
21
+ time: number;
22
+ /** Prevents multiple effectors from being connected. */
23
+ once: boolean;
24
+ }
25
+ //# sourceMappingURL=OptionInterface.d.ts.map
package/dist/reverb.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const meta = {
2
- version: "0.5.0",
3
- date: "2022-02-21T09:25:39.234Z"
2
+ version: "0.5.2",
3
+ date: "2022-03-31T15:54:38.559Z"
4
4
  };
5
5
  const Noise = {
6
6
  WHITE: "white",
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Reverb=t()}(this,(function(){"use strict";const e="0.5.0",t="2022-02-21T09:25:39.234Z",i="white",s="pink",o="brown";
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Reverb=t()}(this,(function(){"use strict";const e="0.5.2",t="2022-03-31T15:54:38.559Z",i="white",s="pink",o="brown";
2
2
  /**
3
3
  * JS reverb effect class
4
4
  *
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@logue/reverb",
4
- "version": "0.5.1",
4
+ "version": "0.5.2",
5
5
  "description": "Reverb effect.",
6
6
  "files": [
7
- "dist",
8
- "types"
7
+ "dist"
9
8
  ],
10
9
  "main": "./dist/reverb.umd.js",
11
10
  "module": "./dist/reverb.es.js",
@@ -15,7 +14,7 @@
15
14
  "require": "./dist/reverb.umd.js"
16
15
  }
17
16
  },
18
- "types": "./types/Reverb.d.ts",
17
+ "types": "./dist/Reverb.d.ts",
19
18
  "directories": {
20
19
  "doc": "docs"
21
20
  },
@@ -45,32 +44,33 @@
45
44
  "sideEffects": false,
46
45
  "scripts": {
47
46
  "dev": "vite",
48
- "build": "tsc && vite build",
47
+ "build": "vite build & tsc",
49
48
  "build:clean": "rimraf dist",
50
49
  "lint": "eslint . --fix --cache --cache-location ./node_modules/.vite/vite-plugin-eslint && prettier . --write",
51
50
  "prepare": "husky install"
52
51
  },
53
52
  "devDependencies": {
54
- "@types/node": "^17.0.18",
55
- "@typescript-eslint/eslint-plugin": "^5.12.0",
56
- "@typescript-eslint/parser": "^5.12.0",
57
- "eslint": "^8.9.0",
53
+ "@modyqyw/vite-plugin-eslint": "^1.2.0",
54
+ "@types/eslint": "^8.4.1",
55
+ "@types/node": "^17.0.23",
56
+ "@typescript-eslint/eslint-plugin": "^5.17.0",
57
+ "@typescript-eslint/parser": "^5.17.0",
58
+ "eslint": "^8.12.0",
58
59
  "eslint-config-google": "^0.14.0",
59
- "eslint-config-prettier": "^8.4.0",
60
+ "eslint-config-prettier": "^8.5.0",
60
61
  "eslint-import-resolver-alias": "^1.1.2",
61
- "eslint-import-resolver-typescript": "^2.5.0",
62
+ "eslint-import-resolver-typescript": "^2.7.0",
62
63
  "eslint-plugin-import": "^2.25.4",
63
64
  "eslint-plugin-prettier": "^4.0.0",
64
65
  "eslint-plugin-tsdoc": "^0.2.14",
65
66
  "husky": "^7.0.4",
66
- "lint-staged": "^12.3.4",
67
- "prettier": "^2.5.1",
68
- "prettier-plugin-jsdoc": "^0.3.30",
67
+ "lint-staged": "^12.3.7",
68
+ "prettier": "^2.6.1",
69
+ "prettier-plugin-jsdoc": "^0.3.34",
69
70
  "prettier-plugin-md-nocjsp": "^1.2.0",
70
71
  "rimraf": "^3.0.2",
71
- "typescript": "^4.5.5",
72
- "vite": "^2.8.4",
73
- "vite-plugin-eslint": "^1.3.0"
72
+ "typescript": "^4.6.3",
73
+ "vite": "^2.9.1"
74
74
  },
75
75
  "husky": {
76
76
  "hooks": {
package/types/Reverb.d.ts DELETED
@@ -1,118 +0,0 @@
1
- import type OptionInterface from './interfaces/OptionInterface';
2
- import { type NoiseType } from './NoiseType';
3
- /**
4
- * JS reverb effect class
5
- *
6
- * @license MIT
7
- * @author Logue {@link logue@hotmail.co.jp}
8
- * @copyright 2019-2022 Masashi Yoshikawa {@link https://logue.dev/} All rights reserved.
9
- * @see {@link https://github.com/logue/Reverb.js}
10
- */
11
- export default class Reverb {
12
- /** Version strings */
13
- readonly version: string;
14
- /** Build date */
15
- readonly build: string;
16
- /** AudioContext */
17
- private readonly ctx;
18
- /** Wet Level (Reverberated node) */
19
- private readonly wetGainNode;
20
- /** Dry Level (Original sound node) */
21
- private readonly dryGainNode;
22
- /** Impulse response filter */
23
- private readonly filterNode;
24
- /** Convolution node for applying impulse response */
25
- private readonly convolverNode;
26
- /** Output nodse */
27
- private readonly outputNode;
28
- /** Option */
29
- private readonly _options;
30
- /** Connected flag */
31
- private isConnected;
32
- /**
33
- * Constructor
34
- *
35
- * @param ctx - Root AudioContext
36
- * @param options - Configure
37
- */
38
- constructor(ctx: AudioContext, options: OptionInterface | undefined);
39
- /**
40
- * Connect the node for the reverb effect to the original sound node.
41
- *
42
- * @param sourceNode - Input source node
43
- */
44
- connect(sourceNode: AudioNode): AudioNode;
45
- /**
46
- * Disconnect the reverb node
47
- *
48
- * @param sourceNode - Input source node
49
- */
50
- disconnect(sourceNode: AudioNode | undefined): AudioNode | undefined;
51
- /**
52
- * Dry/Wet ratio
53
- *
54
- * @param mix - Ratio (0~1)
55
- */
56
- mix(mix: number): void;
57
- /**
58
- * Set Impulse Response time length (second)
59
- *
60
- * @param value - IR length
61
- */
62
- time(value: number): void;
63
- /**
64
- * Impulse response decay rate.
65
- *
66
- * @param value - Decay value
67
- */
68
- decay(value: number): void;
69
- /**
70
- * Delay before reverberation starts
71
- *
72
- * @param value - Time[ms]
73
- */
74
- delay(value: number): void;
75
- /**
76
- * Reverse the impulse response.
77
- *
78
- * @param reverse - Reverse IR
79
- */
80
- reverse(reverse: boolean): void;
81
- /**
82
- * Filter for impulse response
83
- *
84
- * @param type - Filiter Type
85
- */
86
- filterType(type: BiquadFilterType): void;
87
- /**
88
- * Filter frequency applied to impulse response
89
- *
90
- * @param freq - Frequency
91
- */
92
- filterFreq(freq: number): void;
93
- /**
94
- * Filter quality.
95
- *
96
- * @param q - Quality
97
- */
98
- filterQ(q: number): void;
99
- /**
100
- * Inpulse Response Noise algorithm.
101
- *
102
- * @param type - IR noise algorithm type.
103
- */
104
- setNoise(type: NoiseType): void;
105
- /**
106
- * Return true if in range, otherwise false
107
- *
108
- * @param x - Target value
109
- * @param min - Minimum value
110
- * @param max - Maximum value
111
- */
112
- private inRange;
113
- /** Utility function for building an impulse response from the module parameters. */
114
- private buildImpulse;
115
- /** Generate white noise */
116
- private static whiteNoise;
117
- }
118
- // # sourceMappingURL=Reverb.d.ts.map
@@ -1,8 +0,0 @@
1
- /** Meta Information Interface */
2
- export default interface MetaInterface {
3
- /** Version */
4
- version: string;
5
- /** Build Date */
6
- date: string;
7
- }
8
- // # sourceMappingURL=MetaInterface.d.ts.map
@@ -1,25 +0,0 @@
1
- import { NoiseType } from '../NoiseType';
2
- /** Reverb Option */
3
- export default interface OptionInterface {
4
- /** Types of impulse response noise generation algorithms */
5
- noise: NoiseType;
6
- /** Decay */
7
- decay: number;
8
- /** Delay until impulse response is generated */
9
- delay: number;
10
- /** Filter frequency applied to impulse response[Hz] */
11
- filterFreq: number;
12
- /** Filter quality for impulse response */
13
- filterQ: number;
14
- /** Filter type for impulse response */
15
- filterType: BiquadFilterType;
16
- /** Dry/Wet ratio */
17
- mix: number;
18
- /** Invert the impulse response */
19
- reverse: boolean;
20
- /** Impulse response length */
21
- time: number;
22
- /** Prevents multiple effectors from being connected. */
23
- once: boolean;
24
- }
25
- // # sourceMappingURL=OptionInterface.d.ts.map