@logue/reverb 1.2.1 → 1.2.3
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 +1 -1
- package/dist/Meta.d.ts +3 -3
- package/dist/NoiseType.d.ts +6 -6
- package/dist/Reverb.d.ts +143 -143
- package/dist/Reverb.es.js +36 -26
- package/dist/Reverb.iife.js +223 -213
- package/dist/Reverb.umd.js +225 -215
- package/dist/interfaces/MetaInterface.d.ts +7 -7
- package/dist/interfaces/OptionInterface.d.ts +39 -39
- package/package.json +26 -25
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2019-
|
|
3
|
+
Copyright (c) 2019-2023 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/dist/Meta.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type MetaInterface from './interfaces/MetaInterface';
|
|
2
|
-
declare const meta: MetaInterface;
|
|
3
|
-
export default meta;
|
|
1
|
+
import type MetaInterface from './interfaces/MetaInterface';
|
|
2
|
+
declare const meta: MetaInterface;
|
|
3
|
+
export default meta;
|
|
4
4
|
//# sourceMappingURL=Meta.d.ts.map
|
package/dist/NoiseType.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** Impulse response noise generation algorithm */
|
|
2
|
-
declare const Noise: Record<string, string>;
|
|
3
|
-
/** Noise Type */
|
|
4
|
-
export type NoiseType = typeof Noise[keyof typeof Noise];
|
|
5
|
-
/** Noise */
|
|
6
|
-
export default Noise;
|
|
1
|
+
/** Impulse response noise generation algorithm */
|
|
2
|
+
declare const Noise: Record<string, string>;
|
|
3
|
+
/** Noise Type */
|
|
4
|
+
export type NoiseType = typeof Noise[keyof typeof Noise];
|
|
5
|
+
/** Noise */
|
|
6
|
+
export default Noise;
|
|
7
7
|
//# sourceMappingURL=NoiseType.d.ts.map
|
package/dist/Reverb.d.ts
CHANGED
|
@@ -1,144 +1,144 @@
|
|
|
1
|
-
import { type NoiseType } from './NoiseType';
|
|
2
|
-
import type OptionInterface from './interfaces/OptionInterface';
|
|
3
|
-
import type { INorm } from '@thi.ng/random';
|
|
4
|
-
/**
|
|
5
|
-
* Reverb effect class
|
|
6
|
-
*/
|
|
7
|
-
export default class Reverb {
|
|
8
|
-
/** Version strings */
|
|
9
|
-
static version: string;
|
|
10
|
-
/** Build date */
|
|
11
|
-
static build: string;
|
|
12
|
-
/** AudioContext */
|
|
13
|
-
private readonly ctx;
|
|
14
|
-
/** Wet Level (Reverberated node) */
|
|
15
|
-
private readonly wetGainNode;
|
|
16
|
-
/** Dry Level (Original sound node) */
|
|
17
|
-
private readonly dryGainNode;
|
|
18
|
-
/** Impulse response filter */
|
|
19
|
-
private readonly filterNode;
|
|
20
|
-
/** Convolution node for applying impulse response */
|
|
21
|
-
private readonly convolverNode;
|
|
22
|
-
/** Output gain node */
|
|
23
|
-
private readonly outputNode;
|
|
24
|
-
/** Option */
|
|
25
|
-
private readonly options;
|
|
26
|
-
/** Connected flag */
|
|
27
|
-
private isConnected;
|
|
28
|
-
/** Noise Generator */
|
|
29
|
-
private noise;
|
|
30
|
-
/**
|
|
31
|
-
* Constructor
|
|
32
|
-
*
|
|
33
|
-
* @param ctx - Root AudioContext
|
|
34
|
-
* @param options - Configure
|
|
35
|
-
*/
|
|
36
|
-
constructor(ctx: AudioContext, options?: OptionInterface);
|
|
37
|
-
/**
|
|
38
|
-
* Connect the node for the reverb effect to the original sound node.
|
|
39
|
-
*
|
|
40
|
-
* @param sourceNode - Input source node
|
|
41
|
-
*/
|
|
42
|
-
connect(sourceNode: AudioNode): AudioNode;
|
|
43
|
-
/**
|
|
44
|
-
* Disconnect the reverb node
|
|
45
|
-
*
|
|
46
|
-
* @param sourceNode - Input source node
|
|
47
|
-
*/
|
|
48
|
-
disconnect(sourceNode?: AudioNode): AudioNode | undefined;
|
|
49
|
-
/**
|
|
50
|
-
* Dry/Wet ratio
|
|
51
|
-
*
|
|
52
|
-
* @param mix - Ratio (0~1)
|
|
53
|
-
*/
|
|
54
|
-
mix(mix: number): void;
|
|
55
|
-
/**
|
|
56
|
-
* Set Impulse Response time length (second)
|
|
57
|
-
*
|
|
58
|
-
* @param value - IR length
|
|
59
|
-
*/
|
|
60
|
-
time(value: number): void;
|
|
61
|
-
/**
|
|
62
|
-
* Impulse response decay rate.
|
|
63
|
-
*
|
|
64
|
-
* @param value - Decay value
|
|
65
|
-
*/
|
|
66
|
-
decay(value: number): void;
|
|
67
|
-
/**
|
|
68
|
-
* Delay before reverberation starts
|
|
69
|
-
*
|
|
70
|
-
* @param value - Time[ms]
|
|
71
|
-
*/
|
|
72
|
-
delay(value: number): void;
|
|
73
|
-
/**
|
|
74
|
-
* Reverse the impulse response.
|
|
75
|
-
*
|
|
76
|
-
* @param reverse - Reverse IR
|
|
77
|
-
*/
|
|
78
|
-
reverse(reverse: boolean): void;
|
|
79
|
-
/**
|
|
80
|
-
* Filter for impulse response
|
|
81
|
-
*
|
|
82
|
-
* @param type - Filiter Type
|
|
83
|
-
*/
|
|
84
|
-
filterType(type?: BiquadFilterType): void;
|
|
85
|
-
/**
|
|
86
|
-
* Filter frequency applied to impulse response
|
|
87
|
-
*
|
|
88
|
-
* @param freq - Frequency
|
|
89
|
-
*/
|
|
90
|
-
filterFreq(freq: number): void;
|
|
91
|
-
/**
|
|
92
|
-
* Filter quality.
|
|
93
|
-
*
|
|
94
|
-
* @param q - Quality
|
|
95
|
-
*/
|
|
96
|
-
filterQ(q: number): void;
|
|
97
|
-
/**
|
|
98
|
-
* set IR source noise peaks
|
|
99
|
-
*
|
|
100
|
-
* @param p - Peaks
|
|
101
|
-
*/
|
|
102
|
-
peaks(p: number): void;
|
|
103
|
-
/**
|
|
104
|
-
* set IR source noise scale.
|
|
105
|
-
*
|
|
106
|
-
* @param s - Scale
|
|
107
|
-
*/
|
|
108
|
-
scale(s: number): void;
|
|
109
|
-
/**
|
|
110
|
-
* set IR source noise generator.
|
|
111
|
-
*
|
|
112
|
-
* @param a - Algorithm
|
|
113
|
-
*/
|
|
114
|
-
randomAlgorithm(a: INorm): void;
|
|
115
|
-
/**
|
|
116
|
-
* Inpulse Response Noise algorithm.
|
|
117
|
-
*
|
|
118
|
-
* @param type - IR noise algorithm type.
|
|
119
|
-
*/
|
|
120
|
-
setNoise(type: NoiseType): void;
|
|
121
|
-
/**
|
|
122
|
-
* Set Random Algorythm
|
|
123
|
-
*
|
|
124
|
-
* @param algorithm - Algorythm
|
|
125
|
-
*/
|
|
126
|
-
setRandomAlgorythm(algorithm: INorm): void;
|
|
127
|
-
/**
|
|
128
|
-
* Return true if in range, otherwise false
|
|
129
|
-
*
|
|
130
|
-
* @param x - Target value
|
|
131
|
-
* @param min - Minimum value
|
|
132
|
-
* @param max - Maximum value
|
|
133
|
-
*/
|
|
134
|
-
private inRange;
|
|
135
|
-
/** Utility function for building an impulse response from the module parameters. */
|
|
136
|
-
private buildImpulse;
|
|
137
|
-
/**
|
|
138
|
-
* Noise source
|
|
139
|
-
*
|
|
140
|
-
* @param duration - length of IR.
|
|
141
|
-
*/
|
|
142
|
-
private getNoise;
|
|
143
|
-
}
|
|
1
|
+
import { type NoiseType } from './NoiseType';
|
|
2
|
+
import type OptionInterface from './interfaces/OptionInterface';
|
|
3
|
+
import type { INorm } from '@thi.ng/random';
|
|
4
|
+
/**
|
|
5
|
+
* Reverb effect class
|
|
6
|
+
*/
|
|
7
|
+
export default class Reverb {
|
|
8
|
+
/** Version strings */
|
|
9
|
+
static version: string;
|
|
10
|
+
/** Build date */
|
|
11
|
+
static build: string;
|
|
12
|
+
/** AudioContext */
|
|
13
|
+
private readonly ctx;
|
|
14
|
+
/** Wet Level (Reverberated node) */
|
|
15
|
+
private readonly wetGainNode;
|
|
16
|
+
/** Dry Level (Original sound node) */
|
|
17
|
+
private readonly dryGainNode;
|
|
18
|
+
/** Impulse response filter */
|
|
19
|
+
private readonly filterNode;
|
|
20
|
+
/** Convolution node for applying impulse response */
|
|
21
|
+
private readonly convolverNode;
|
|
22
|
+
/** Output gain node */
|
|
23
|
+
private readonly outputNode;
|
|
24
|
+
/** Option */
|
|
25
|
+
private readonly options;
|
|
26
|
+
/** Connected flag */
|
|
27
|
+
private isConnected;
|
|
28
|
+
/** Noise Generator */
|
|
29
|
+
private noise;
|
|
30
|
+
/**
|
|
31
|
+
* Constructor
|
|
32
|
+
*
|
|
33
|
+
* @param ctx - Root AudioContext
|
|
34
|
+
* @param options - Configure
|
|
35
|
+
*/
|
|
36
|
+
constructor(ctx: AudioContext, options?: OptionInterface);
|
|
37
|
+
/**
|
|
38
|
+
* Connect the node for the reverb effect to the original sound node.
|
|
39
|
+
*
|
|
40
|
+
* @param sourceNode - Input source node
|
|
41
|
+
*/
|
|
42
|
+
connect(sourceNode: AudioNode): AudioNode;
|
|
43
|
+
/**
|
|
44
|
+
* Disconnect the reverb node
|
|
45
|
+
*
|
|
46
|
+
* @param sourceNode - Input source node
|
|
47
|
+
*/
|
|
48
|
+
disconnect(sourceNode?: AudioNode): AudioNode | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Dry/Wet ratio
|
|
51
|
+
*
|
|
52
|
+
* @param mix - Ratio (0~1)
|
|
53
|
+
*/
|
|
54
|
+
mix(mix: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Set Impulse Response time length (second)
|
|
57
|
+
*
|
|
58
|
+
* @param value - IR length
|
|
59
|
+
*/
|
|
60
|
+
time(value: number): void;
|
|
61
|
+
/**
|
|
62
|
+
* Impulse response decay rate.
|
|
63
|
+
*
|
|
64
|
+
* @param value - Decay value
|
|
65
|
+
*/
|
|
66
|
+
decay(value: number): void;
|
|
67
|
+
/**
|
|
68
|
+
* Delay before reverberation starts
|
|
69
|
+
*
|
|
70
|
+
* @param value - Time[ms]
|
|
71
|
+
*/
|
|
72
|
+
delay(value: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* Reverse the impulse response.
|
|
75
|
+
*
|
|
76
|
+
* @param reverse - Reverse IR
|
|
77
|
+
*/
|
|
78
|
+
reverse(reverse: boolean): void;
|
|
79
|
+
/**
|
|
80
|
+
* Filter for impulse response
|
|
81
|
+
*
|
|
82
|
+
* @param type - Filiter Type
|
|
83
|
+
*/
|
|
84
|
+
filterType(type?: BiquadFilterType): void;
|
|
85
|
+
/**
|
|
86
|
+
* Filter frequency applied to impulse response
|
|
87
|
+
*
|
|
88
|
+
* @param freq - Frequency
|
|
89
|
+
*/
|
|
90
|
+
filterFreq(freq: number): void;
|
|
91
|
+
/**
|
|
92
|
+
* Filter quality.
|
|
93
|
+
*
|
|
94
|
+
* @param q - Quality
|
|
95
|
+
*/
|
|
96
|
+
filterQ(q: number): void;
|
|
97
|
+
/**
|
|
98
|
+
* set IR source noise peaks
|
|
99
|
+
*
|
|
100
|
+
* @param p - Peaks
|
|
101
|
+
*/
|
|
102
|
+
peaks(p: number): void;
|
|
103
|
+
/**
|
|
104
|
+
* set IR source noise scale.
|
|
105
|
+
*
|
|
106
|
+
* @param s - Scale
|
|
107
|
+
*/
|
|
108
|
+
scale(s: number): void;
|
|
109
|
+
/**
|
|
110
|
+
* set IR source noise generator.
|
|
111
|
+
*
|
|
112
|
+
* @param a - Algorithm
|
|
113
|
+
*/
|
|
114
|
+
randomAlgorithm(a: INorm): void;
|
|
115
|
+
/**
|
|
116
|
+
* Inpulse Response Noise algorithm.
|
|
117
|
+
*
|
|
118
|
+
* @param type - IR noise algorithm type.
|
|
119
|
+
*/
|
|
120
|
+
setNoise(type: NoiseType): void;
|
|
121
|
+
/**
|
|
122
|
+
* Set Random Algorythm
|
|
123
|
+
*
|
|
124
|
+
* @param algorithm - Algorythm
|
|
125
|
+
*/
|
|
126
|
+
setRandomAlgorythm(algorithm: INorm): void;
|
|
127
|
+
/**
|
|
128
|
+
* Return true if in range, otherwise false
|
|
129
|
+
*
|
|
130
|
+
* @param x - Target value
|
|
131
|
+
* @param min - Minimum value
|
|
132
|
+
* @param max - Maximum value
|
|
133
|
+
*/
|
|
134
|
+
private inRange;
|
|
135
|
+
/** Utility function for building an impulse response from the module parameters. */
|
|
136
|
+
private buildImpulse;
|
|
137
|
+
/**
|
|
138
|
+
* Noise source
|
|
139
|
+
*
|
|
140
|
+
* @param duration - length of IR.
|
|
141
|
+
*/
|
|
142
|
+
private getNoise;
|
|
143
|
+
}
|
|
144
144
|
//# sourceMappingURL=Reverb.d.ts.map
|
package/dist/Reverb.es.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author Logue <logue@hotmail.co.jp>
|
|
6
6
|
* @copyright 2019-2022 By Masashi Yoshikawa All rights reserved.
|
|
7
7
|
* @license MIT
|
|
8
|
-
* @version 1.2.
|
|
8
|
+
* @version 1.2.3
|
|
9
9
|
* @see {@link https://github.com/logue/Reverb.js}
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -13,35 +13,45 @@ import { SYSTEM } from '@thi.ng/random';
|
|
|
13
13
|
import { white, violet, red, pink, green, blue } from '@thi.ng/colored-noise';
|
|
14
14
|
import { take } from '@thi.ng/transducers';
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
/** Impulse response noise generation algorithm */
|
|
17
|
+
const Noise = {
|
|
18
|
+
/** Blue noise */
|
|
19
|
+
BLUE: 'blue',
|
|
20
|
+
/** Green noise */
|
|
21
|
+
GREEN: 'green',
|
|
22
|
+
/** Pink noise */
|
|
23
|
+
PINK: 'pink',
|
|
24
|
+
/** Red noise */
|
|
25
|
+
RED: 'red',
|
|
26
|
+
/** Violet noise */
|
|
27
|
+
VIOLET: 'violet',
|
|
28
|
+
/** White noise */
|
|
29
|
+
WHITE: 'white',
|
|
30
|
+
/** Brown noise (same as red noise) */
|
|
31
|
+
BROWN: 'red',
|
|
24
32
|
};
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
/** デフォルト値 */
|
|
35
|
+
const defaults = {
|
|
36
|
+
noise: Noise.WHITE,
|
|
37
|
+
scale: 1,
|
|
38
|
+
peaks: 2,
|
|
39
|
+
randomAlgorithm: SYSTEM,
|
|
40
|
+
decay: 2,
|
|
41
|
+
delay: 0,
|
|
42
|
+
reverse: false,
|
|
43
|
+
time: 2,
|
|
44
|
+
filterType: 'allpass',
|
|
45
|
+
filterFreq: 2200,
|
|
46
|
+
filterQ: 1,
|
|
47
|
+
mix: 0.5,
|
|
48
|
+
once: false,
|
|
40
49
|
};
|
|
41
50
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
// This file is auto-generated by the build system.
|
|
52
|
+
const meta = {
|
|
53
|
+
version: '1.2.3',
|
|
54
|
+
date: '2023-01-03T08:14:36.986Z',
|
|
45
55
|
};
|
|
46
56
|
|
|
47
57
|
class Reverb {
|