@logue/reverb 1.0.2 → 1.2.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.
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # Reverb.js
2
2
 
3
- [![jsdelivr CDN](https://data.jsdelivr.com/v1/package/npm/@logue/reverb/badge)](https://www.jsdelivr.com/package/npm/@logue/reverb)
3
+ [![jsdelivr CDN](https://data.jsdelivr.com/v1/package/npm/@logue/reverb/badge?style=rounded)](https://www.jsdelivr.com/package/npm/@logue/reverb)
4
4
  [![NPM Downloads](https://img.shields.io/npm/dm/@logue/reverb.svg?style=flat)](https://www.npmjs.com/package/@logue/reverb)
5
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
6
  [![npm version](https://img.shields.io/npm/v/@logue/reverb.svg)](https://www.npmjs.com/package/@logue/reverb)
7
7
  [![Open in Gitpod](https://shields.io/badge/Open%20in-Gitpod-green?logo=Gitpod)](https://gitpod.io/#https://github.com/logue/Reverb.js)
8
+ [![Twitter Follow](https://img.shields.io/twitter/follow/logue256?style=plastic)](https://twitter.com/logue256)
8
9
 
9
10
  Append reverb effect to audio source.
10
11
 
@@ -19,13 +20,20 @@ This script is originally a spin out of [sf2synth.js](https://github.com/logue/s
19
20
 
20
21
  ```js
21
22
  const reverb = new Reverb(ctx, {
23
+ /**
24
+ * Randam noise algorythm
25
+ * @see {@link https://github.com/thi-ng/umbrella/tree/develop/packages/random}
26
+ */
27
+ randomAlgorithm: SYSTEM;
22
28
  /**
23
29
  * IR (Inpulse Response) colord noise algorithm (BLUE, GREEN, PINK, RED, VIOLET, WHITE)
24
- * @see {@link https://en.wikipedia.org/wiki/Colors_of_noise}
30
+ * @see {@link https://github.com/thi-ng/umbrella/tree/develop/packages/colored-noise}
25
31
  */
26
32
  noise: Noise.WHITE,
27
- /** IR noise power multiplier */
28
- power: 2,
33
+ /** IR source noise scale */
34
+ scale: 1;
35
+ /** Number of IR source noise peaks */
36
+ peaks: 2;
29
37
  /** Amount of IR decay. 0~100 */
30
38
  decay: 5,
31
39
  /** Delay time o IR. (NOT delay effect) 0~100 [sec] */
@@ -52,7 +60,7 @@ const reverb = new Reverb(ctx, {
52
60
 
53
61
  ```js
54
62
  // Setup Audio Context
55
- const ctx = new (window.AudioContext || window.webkitAudioContext)();
63
+ const ctx = new window.AudioContext();
56
64
 
57
65
  // iOS fix.
58
66
  document.addEventListener('touchstart', initAudioContext);
@@ -85,6 +93,7 @@ sourceNode.play();
85
93
  - [Web Audio API 日本語訳](https://g200kg.github.io/web-audio-api-ja/)
86
94
  - [コンボルバーの使い方](https://www.g200kg.com/jp/docs/webaudio/convolver.html)
87
95
  - [WebAudio の闇](https://qiita.com/zprodev/items/7fcd8335d7e8e613a01f)
96
+ - [@thi.ng/colored-noise](https://github.com/thi-ng/umbrella/tree/develop/packages/colored-noise)
88
97
 
89
98
  ## License
90
99
 
package/dist/Reverb.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type OptionInterface from './interfaces/OptionInterface';
2
1
  import { type NoiseType } from './NoiseType';
2
+ import type OptionInterface from './interfaces/OptionInterface';
3
+ import type { INorm } from '@thi.ng/random';
3
4
  /**
4
5
  * Reverb effect class
5
6
  */
@@ -18,7 +19,7 @@ export default class Reverb {
18
19
  private readonly filterNode;
19
20
  /** Convolution node for applying impulse response */
20
21
  private readonly convolverNode;
21
- /** Output nodse */
22
+ /** Output gain node */
22
23
  private readonly outputNode;
23
24
  /** Option */
24
25
  private readonly options;
@@ -44,7 +45,7 @@ export default class Reverb {
44
45
  *
45
46
  * @param sourceNode - Input source node
46
47
  */
47
- disconnect(sourceNode: AudioNode | undefined): AudioNode | undefined;
48
+ disconnect(sourceNode?: AudioNode): AudioNode | undefined;
48
49
  /**
49
50
  * Dry/Wet ratio
50
51
  *
@@ -80,7 +81,7 @@ export default class Reverb {
80
81
  *
81
82
  * @param type - Filiter Type
82
83
  */
83
- filterType(type: BiquadFilterType): void;
84
+ filterType(type?: BiquadFilterType): void;
84
85
  /**
85
86
  * Filter frequency applied to impulse response
86
87
  *
@@ -94,17 +95,35 @@ export default class Reverb {
94
95
  */
95
96
  filterQ(q: number): void;
96
97
  /**
97
- * set IR noise power multiplier.
98
+ * set IR source noise peaks
99
+ *
100
+ * @param p - Peaks
101
+ */
102
+ peaks(p: number): void;
103
+ /**
104
+ * set IR source noise scale.
98
105
  *
99
- * @param p - Power
106
+ * @param s - Scale
100
107
  */
101
- power(p: number): void;
108
+ scale(s: number): void;
109
+ /**
110
+ * set IR source noise generator.
111
+ *
112
+ * @param a - Algorithm
113
+ */
114
+ randomAlgorithm(a: INorm): void;
102
115
  /**
103
116
  * Inpulse Response Noise algorithm.
104
117
  *
105
118
  * @param type - IR noise algorithm type.
106
119
  */
107
120
  setNoise(type: NoiseType): void;
121
+ /**
122
+ * Set Random Algorythm
123
+ *
124
+ * @param algorithm - Algorythm
125
+ */
126
+ setRandomAlgorythm(algorithm: INorm): void;
108
127
  /**
109
128
  * Return true if in range, otherwise false
110
129
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Reverb.d.ts","sourceRoot":"","sources":["../src/Reverb.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,eAAe,MAAM,8BAA8B,CAAC;AAChE,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAIpD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,sBAAsB;IACtB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAgB;IACtC,iBAAiB;IACjB,MAAM,CAAC,KAAK,EAAE,MAAM,CAAa;IACjC,mBAAmB;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,oCAAoC;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAW;IACvC,sCAAsC;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAW;IACvC,8BAA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