spessasynth_lib 3.26.12 → 3.26.14
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/index.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { Synthetizer } from "./src/synthetizer/synthetizer.js";
|
|
4
4
|
import { Sequencer } from "./src/sequencer/sequencer.js";
|
|
5
|
+
import { getReverbProcessor } from "./src/synthetizer/audio_effects/reverb.js";
|
|
6
|
+
import { FancyChorus } from "./src/synthetizer/audio_effects/fancy_chorus.js";
|
|
5
7
|
import { audioBufferToWav } from "./src/utils/buffer_to_wav.js";
|
|
6
8
|
import { MIDIDeviceHandler } from "./src/external_midi/midi_handler.js";
|
|
7
9
|
import { WebMIDILinkHandler } from "./src/external_midi/web_midi_link.js";
|
|
@@ -15,6 +17,10 @@ export {
|
|
|
15
17
|
Synthetizer,
|
|
16
18
|
DEFAULT_SYNTH_CONFIG,
|
|
17
19
|
|
|
20
|
+
// Effects
|
|
21
|
+
getReverbProcessor,
|
|
22
|
+
FancyChorus,
|
|
23
|
+
|
|
18
24
|
// Utilities
|
|
19
25
|
audioBufferToWav,
|
|
20
26
|
MIDIDeviceHandler,
|
package/package.json
CHANGED
|
@@ -45,8 +45,8 @@ export class FancyChorus
|
|
|
45
45
|
{
|
|
46
46
|
/**
|
|
47
47
|
* Creates a fancy chorus effect
|
|
48
|
-
* @param output {AudioNode}
|
|
49
|
-
* @param config {ChorusConfig}
|
|
48
|
+
* @param output {AudioNode} - the target output node
|
|
49
|
+
* @param config {ChorusConfig} - the configuration for the chorus
|
|
50
50
|
*/
|
|
51
51
|
constructor(output, config = DEFAULT_CHORUS_CONFIG)
|
|
52
52
|
{
|
|
@@ -69,7 +69,7 @@ export class FancyChorus
|
|
|
69
69
|
for (let i = 0; i < config.nodesAmount; i++)
|
|
70
70
|
{
|
|
71
71
|
// left node
|
|
72
|
-
this.
|
|
72
|
+
this._createChorusNode(
|
|
73
73
|
freq,
|
|
74
74
|
delay - config.stereoDifference,
|
|
75
75
|
chorusNodesLeft,
|
|
@@ -80,7 +80,7 @@ export class FancyChorus
|
|
|
80
80
|
config
|
|
81
81
|
);
|
|
82
82
|
// right node
|
|
83
|
-
this.
|
|
83
|
+
this._createChorusNode(
|
|
84
84
|
freq,
|
|
85
85
|
delay + config.stereoDifference,
|
|
86
86
|
chorusNodesRight,
|
|
@@ -100,6 +100,9 @@ export class FancyChorus
|
|
|
100
100
|
this.chorusRight = chorusNodesRight;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/**
|
|
104
|
+
* Disconnects and deletes the chorus effect
|
|
105
|
+
*/
|
|
103
106
|
delete()
|
|
104
107
|
{
|
|
105
108
|
this.input.disconnect();
|
|
@@ -135,8 +138,9 @@ export class FancyChorus
|
|
|
135
138
|
* @param outputNum {number}
|
|
136
139
|
* @param context {BaseAudioContext}
|
|
137
140
|
* @param config {ChorusConfig}
|
|
141
|
+
* @private
|
|
138
142
|
*/
|
|
139
|
-
|
|
143
|
+
_createChorusNode(freq, delay, list, input, output, outputNum, context, config)
|
|
140
144
|
{
|
|
141
145
|
const oscillator = context.createOscillator();
|
|
142
146
|
oscillator.type = "sine";
|
|
@@ -55,16 +55,19 @@ export class SoundfontManager
|
|
|
55
55
|
*/
|
|
56
56
|
async addNewSoundFont(soundfontBuffer, id, bankOffset = 0)
|
|
57
57
|
{
|
|
58
|
+
this._sendToWorklet(WorkletSoundfontManagerMessageType.addNewSoundFont, [soundfontBuffer, id, bankOffset]);
|
|
59
|
+
await new Promise(r => this.synth._resolveWhenReady = r);
|
|
58
60
|
if (this.soundfontList.find(s => s.id === id) !== undefined)
|
|
59
61
|
{
|
|
60
|
-
|
|
62
|
+
this.soundfontList.find(s => s.id === id).bankOffset = bankOffset;
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
{
|
|
66
|
+
this.soundfontList.push({
|
|
67
|
+
id: id,
|
|
68
|
+
bankOffset: bankOffset
|
|
69
|
+
});
|
|
61
70
|
}
|
|
62
|
-
this._sendToWorklet(WorkletSoundfontManagerMessageType.addNewSoundFont, [soundfontBuffer, id, bankOffset]);
|
|
63
|
-
await new Promise(r => this.synth._resolveWhenReady = r);
|
|
64
|
-
this.soundfontList.push({
|
|
65
|
-
id: id,
|
|
66
|
-
bankOffset: bankOffset
|
|
67
|
-
});
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
// noinspection JSUnusedGlobalSymbols
|