spessasynth_lib 3.24.0 → 3.24.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/@types/sequencer/sequencer.d.ts +63 -28
- package/@types/sequencer/worklet_sequencer/sequencer_message.d.ts +1 -0
- package/@types/synthetizer/audio_effects/effects_config.d.ts +20 -8
- package/@types/synthetizer/synthetizer.d.ts +17 -23
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/external_midi/README.md +0 -0
- package/external_midi/midi_handler.js +0 -0
- package/external_midi/web_midi_link.js +0 -0
- package/externals/stbvorbis_sync/@types/stbvorbis_sync.d.ts +0 -0
- package/externals/stbvorbis_sync/LICENSE +0 -0
- package/externals/stbvorbis_sync/stbvorbis_sync.min.js +0 -0
- package/midi_parser/README.md +0 -0
- package/midi_parser/midi_message.js +0 -0
- package/midi_parser/midi_writer.js +0 -0
- package/midi_parser/used_keys_loaded.js +0 -0
- package/package.json +1 -1
- package/sequencer/README.md +0 -0
- package/sequencer/sequencer.js +134 -77
- package/sequencer/worklet_sequencer/process_event.js +4 -1
- package/sequencer/worklet_sequencer/process_tick.js +4 -4
- package/sequencer/worklet_sequencer/sequencer_message.js +2 -1
- package/soundfont/README.md +0 -0
- package/soundfont/basic_soundfont/basic_instrument.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/ibag.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/imod.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/inst.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/pbag.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/phdr.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/pmod.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/sdta.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/shdr.js +0 -0
- package/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js +0 -0
- package/soundfont/dls/dls_destinations.js +0 -0
- package/soundfont/dls/dls_preset.js +0 -0
- package/soundfont/dls/dls_sources.js +0 -0
- package/soundfont/dls/read_instrument_list.js +0 -0
- package/soundfont/load_soundfont.js +0 -0
- package/soundfont/read_sf2/generators.js +0 -0
- package/soundfont/read_sf2/instruments.js +0 -0
- package/soundfont/read_sf2/modulators.js +0 -0
- package/soundfont/read_sf2/presets.js +0 -0
- package/soundfont/read_sf2/zones.js +0 -0
- package/synthetizer/README.md +0 -0
- package/synthetizer/audio_effects/effects_config.js +10 -6
- package/synthetizer/audio_effects/fancy_chorus.js +9 -16
- package/synthetizer/audio_effects/reverb.js +1 -1
- package/synthetizer/synthetizer.js +43 -37
- package/synthetizer/worklet_processor.min.js +8 -8
- package/synthetizer/worklet_system/README.md +0 -0
- package/synthetizer/worklet_system/message_protocol/message_sending.js +0 -0
- package/synthetizer/worklet_system/snapshot/snapshot.js +1 -1
- package/synthetizer/worklet_system/worklet_methods/data_entry.js +0 -0
- package/synthetizer/worklet_system/worklet_methods/note_on.js +5 -2
- package/synthetizer/worklet_system/worklet_methods/system_exclusive.js +0 -0
- package/synthetizer/worklet_system/worklet_methods/tuning_control.js +0 -0
- package/synthetizer/worklet_system/worklet_methods/vibrato_control.js +0 -0
- package/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/sfman_message.js +0 -0
- package/synthetizer/worklet_system/worklet_processor.js +0 -0
- package/synthetizer/worklet_system/worklet_utilities/controller_tables.js +0 -0
- package/synthetizer/worklet_system/worklet_utilities/lfo.js +0 -0
- package/synthetizer/worklet_system/worklet_utilities/modulator_curves.js +0 -0
- package/synthetizer/worklet_system/worklet_utilities/unit_converter.js +0 -0
- package/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +0 -0
- package/synthetizer/worklet_system/worklet_utilities/wavetable_oscillator.js +0 -0
- package/synthetizer/worklet_url.js +0 -0
- package/utils/README.md +0 -0
- package/utils/byte_functions/big_endian.js +0 -0
- package/utils/byte_functions/little_endian.js +0 -0
- package/utils/byte_functions/variable_length_quantity.js +0 -0
- package/utils/indexed_array.js +0 -0
- package/utils/loggin.js +0 -0
|
@@ -25,7 +25,7 @@ export class Sequencer {
|
|
|
25
25
|
* Fires on text event
|
|
26
26
|
* @type {function}
|
|
27
27
|
* @param data {Uint8Array} the data text
|
|
28
|
-
* @param type {number} the status byte of the message (the meta
|
|
28
|
+
* @param type {number} the status byte of the message (the meta-status byte)
|
|
29
29
|
* @param lyricsIndex {number} if the text is a lyric, the index of the lyric in midiData.lyrics, otherwise -1
|
|
30
30
|
*/
|
|
31
31
|
onTextEvent: Function;
|
|
@@ -40,47 +40,58 @@ export class Sequencer {
|
|
|
40
40
|
* @private
|
|
41
41
|
*/
|
|
42
42
|
private onSongEnded;
|
|
43
|
-
ignoreEvents: boolean;
|
|
44
|
-
synth: Synthetizer;
|
|
45
|
-
highResTimeOffset: number;
|
|
46
43
|
/**
|
|
47
|
-
*
|
|
48
|
-
* @type {number}
|
|
44
|
+
* Fires on tempo change
|
|
45
|
+
* @type {Object<string, function(number)>}
|
|
49
46
|
*/
|
|
50
|
-
|
|
47
|
+
onTempoChange: {
|
|
48
|
+
[x: string]: (arg0: number) => any;
|
|
49
|
+
};
|
|
51
50
|
/**
|
|
52
|
-
*
|
|
53
|
-
* @
|
|
51
|
+
* Current song's tempo in BPM
|
|
52
|
+
* @type {number}
|
|
54
53
|
*/
|
|
55
|
-
|
|
54
|
+
currentTempo: number;
|
|
56
55
|
/**
|
|
57
|
-
*
|
|
56
|
+
* Current song index
|
|
58
57
|
* @type {number}
|
|
59
58
|
*/
|
|
60
|
-
_playbackRate: number;
|
|
61
59
|
songIndex: number;
|
|
62
60
|
/**
|
|
63
|
-
*
|
|
61
|
+
* @type {function(BasicMIDI)}
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
private _getMIDIResolve;
|
|
65
|
+
/**
|
|
66
|
+
* Indicates if the current midiData property has fake data in it (not yet loaded)
|
|
64
67
|
* @type {boolean}
|
|
65
68
|
*/
|
|
66
69
|
hasDummyData: boolean;
|
|
67
|
-
_loop: boolean;
|
|
68
70
|
/**
|
|
69
71
|
* Indicates whether the sequencer has finished playing a sequence
|
|
70
72
|
* @type {boolean}
|
|
71
73
|
*/
|
|
72
74
|
isFinished: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The current sequence's length, in seconds
|
|
77
|
+
* @type {number}
|
|
78
|
+
*/
|
|
79
|
+
duration: number;
|
|
73
80
|
/**
|
|
74
81
|
* Indicates if the sequencer is paused.
|
|
75
82
|
* Paused if a number, undefined if playing
|
|
76
83
|
* @type {undefined|number}
|
|
84
|
+
* @private
|
|
77
85
|
*/
|
|
78
|
-
pausedTime
|
|
86
|
+
private pausedTime;
|
|
87
|
+
ignoreEvents: boolean;
|
|
88
|
+
synth: Synthetizer;
|
|
89
|
+
highResTimeOffset: number;
|
|
79
90
|
/**
|
|
80
|
-
*
|
|
91
|
+
* Absolute playback startTime, bases on the synth's time
|
|
81
92
|
* @type {number}
|
|
82
93
|
*/
|
|
83
|
-
|
|
94
|
+
absoluteStartTime: number;
|
|
84
95
|
/**
|
|
85
96
|
* @type {boolean}
|
|
86
97
|
* @private
|
|
@@ -91,6 +102,28 @@ export class Sequencer {
|
|
|
91
102
|
* @private
|
|
92
103
|
*/
|
|
93
104
|
private _preservePlaybackState;
|
|
105
|
+
/**
|
|
106
|
+
* Internal loop marker
|
|
107
|
+
* @type {boolean}
|
|
108
|
+
* @private
|
|
109
|
+
*/
|
|
110
|
+
private _loop;
|
|
111
|
+
set loop(value: boolean);
|
|
112
|
+
get loop(): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Controls the playback's rate
|
|
115
|
+
* @type {number}
|
|
116
|
+
* @private
|
|
117
|
+
*/
|
|
118
|
+
private _playbackRate;
|
|
119
|
+
/**
|
|
120
|
+
* @param value {number}
|
|
121
|
+
*/
|
|
122
|
+
set playbackRate(value: number);
|
|
123
|
+
/**
|
|
124
|
+
* @returns {number}
|
|
125
|
+
*/
|
|
126
|
+
get playbackRate(): number;
|
|
94
127
|
/**
|
|
95
128
|
* Indicates if the sequencer should skip to first note on
|
|
96
129
|
* @param val {boolean}
|
|
@@ -118,21 +151,11 @@ export class Sequencer {
|
|
|
118
151
|
* @returns {number} Current playback time, in seconds
|
|
119
152
|
*/
|
|
120
153
|
get currentTime(): number;
|
|
121
|
-
set loop(value: boolean);
|
|
122
|
-
get loop(): boolean;
|
|
123
154
|
/**
|
|
124
155
|
* Use for visualization as it's not affected by the audioContext stutter
|
|
125
156
|
* @returns {number}
|
|
126
157
|
*/
|
|
127
158
|
get currentHighResolutionTime(): number;
|
|
128
|
-
/**
|
|
129
|
-
* @param value {number}
|
|
130
|
-
*/
|
|
131
|
-
set playbackRate(value: number);
|
|
132
|
-
/**
|
|
133
|
-
* @returns {number}
|
|
134
|
-
*/
|
|
135
|
-
get playbackRate(): number;
|
|
136
159
|
/**
|
|
137
160
|
* true if paused, false if playing or stopped
|
|
138
161
|
* @returns {boolean}
|
|
@@ -156,6 +179,12 @@ export class Sequencer {
|
|
|
156
179
|
* @param id {string} must be unique
|
|
157
180
|
*/
|
|
158
181
|
addOnTimeChangeEvent(callback: (arg0: number) => any, id: string): void;
|
|
182
|
+
/**
|
|
183
|
+
* Adds a new event that gets called when the tempo changes
|
|
184
|
+
* @param callback {function(number)} the new tempo, in BPM
|
|
185
|
+
* @param id {string} must be unique
|
|
186
|
+
*/
|
|
187
|
+
addOnTempoChangeEvent(callback: (arg0: number) => any, id: string): void;
|
|
159
188
|
resetMIDIOut(): void;
|
|
160
189
|
/**
|
|
161
190
|
* @param messageType {WorkletSequencerMessageType}
|
|
@@ -165,6 +194,12 @@ export class Sequencer {
|
|
|
165
194
|
private _sendMessage;
|
|
166
195
|
nextSong(): void;
|
|
167
196
|
previousSong(): void;
|
|
197
|
+
/**
|
|
198
|
+
* @param type {Object<string, function>}
|
|
199
|
+
* @param params {any}
|
|
200
|
+
* @private
|
|
201
|
+
*/
|
|
202
|
+
private _callEvents;
|
|
168
203
|
/**
|
|
169
204
|
* @param {WorkletSequencerReturnMessageType} messageType
|
|
170
205
|
* @param {any} messageData
|
|
@@ -199,7 +234,7 @@ export class Sequencer {
|
|
|
199
234
|
unpause(): void;
|
|
200
235
|
/**
|
|
201
236
|
* Starts the playback
|
|
202
|
-
* @param resetTime {boolean} If true, time is set to
|
|
237
|
+
* @param resetTime {boolean} If true, time is set to 0 s
|
|
203
238
|
*/
|
|
204
239
|
play(resetTime?: boolean): void;
|
|
205
240
|
/**
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {Object}
|
|
2
|
+
* @typedef {Object} SynthConfig
|
|
3
3
|
* @property {boolean} chorusEnabled - indicates if the chorus effect is enabled.
|
|
4
|
-
* @property {ChorusConfig} chorusConfig - the configuration for chorus. Pass undefined to use defaults
|
|
4
|
+
* @property {ChorusConfig?} chorusConfig - the configuration for chorus. Pass undefined to use defaults
|
|
5
5
|
* @property {boolean} reverbEnabled - indicates if the reverb effect is enabled.
|
|
6
|
-
* @property {AudioBuffer} reverbImpulseResponse - the impulse response for the reverb. Pass undefined to use defaults
|
|
6
|
+
* @property {AudioBuffer?} reverbImpulseResponse - the impulse response for the reverb. Pass undefined to use defaults
|
|
7
|
+
* @property {{
|
|
8
|
+
* worklet: function(context: object, name: string, options?: Object)
|
|
9
|
+
* }} audioNodeCreators - custom audio node creation functions for Web Audio wrappers.
|
|
7
10
|
*/
|
|
8
11
|
/**
|
|
9
|
-
* @type {
|
|
12
|
+
* @type {SynthConfig}
|
|
10
13
|
*/
|
|
11
|
-
export const
|
|
12
|
-
export type
|
|
14
|
+
export const DEFAULT_SYNTH_CONFIG: SynthConfig;
|
|
15
|
+
export type SynthConfig = {
|
|
13
16
|
/**
|
|
14
17
|
* - indicates if the chorus effect is enabled.
|
|
15
18
|
*/
|
|
@@ -17,7 +20,7 @@ export type EffectsConfig = {
|
|
|
17
20
|
/**
|
|
18
21
|
* - the configuration for chorus. Pass undefined to use defaults
|
|
19
22
|
*/
|
|
20
|
-
chorusConfig: ChorusConfig;
|
|
23
|
+
chorusConfig: ChorusConfig | null;
|
|
21
24
|
/**
|
|
22
25
|
* - indicates if the reverb effect is enabled.
|
|
23
26
|
*/
|
|
@@ -25,5 +28,14 @@ export type EffectsConfig = {
|
|
|
25
28
|
/**
|
|
26
29
|
* - the impulse response for the reverb. Pass undefined to use defaults
|
|
27
30
|
*/
|
|
28
|
-
reverbImpulseResponse: AudioBuffer;
|
|
31
|
+
reverbImpulseResponse: AudioBuffer | null;
|
|
32
|
+
/**
|
|
33
|
+
* )
|
|
34
|
+
* }} audioNodeCreators - custom audio node creation functions for Web Audio wrappers.
|
|
35
|
+
*/
|
|
36
|
+
"": {
|
|
37
|
+
worklet: (arg0: context) => object;
|
|
38
|
+
name: string;
|
|
39
|
+
options?: any;
|
|
40
|
+
};
|
|
29
41
|
};
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* @typedef {Object} StartRenderingDataConfig
|
|
7
7
|
* @property {BasicMIDI} parsedMIDI - the MIDI to render
|
|
8
8
|
* @property {SynthesizerSnapshot} snapshot - the snapshot to apply
|
|
9
|
-
* @property {boolean|undefined} oneOutput - if synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
9
|
+
* @property {boolean|undefined} oneOutput - if synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
10
|
+
* this disabled chorus and reverb.
|
|
10
11
|
* @property {number|undefined} loopCount - the times to loop the song
|
|
11
12
|
*/
|
|
12
13
|
export const WORKLET_PROCESSOR_NAME: "spessasynth-worklet-system";
|
|
@@ -14,14 +15,6 @@ export const VOICE_CAP: 350;
|
|
|
14
15
|
export const DEFAULT_PERCUSSION: 9;
|
|
15
16
|
export const MIDI_CHANNEL_COUNT: 16;
|
|
16
17
|
export const DEFAULT_SYNTH_MODE: "gs";
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new instance of the SpessaSynth synthesizer
|
|
19
|
-
* @param targetNode {AudioNode}
|
|
20
|
-
* @param soundFontBuffer {ArrayBuffer} the soundfont file array buffer
|
|
21
|
-
* @param enableEventSystem {boolean} enables the event system. Defaults to true
|
|
22
|
-
* @param startRenderingData {StartRenderingDataConfig} if set, starts playing this immediately and restores the values
|
|
23
|
-
* @param effectsConfig {EffectsConfig} optional configuration for the audio effects.
|
|
24
|
-
*/
|
|
25
18
|
export class Synthetizer {
|
|
26
19
|
/**
|
|
27
20
|
* Creates a new instance of the SpessaSynth synthesizer
|
|
@@ -29,13 +22,13 @@ export class Synthetizer {
|
|
|
29
22
|
* @param soundFontBuffer {ArrayBuffer} the soundfont file array buffer
|
|
30
23
|
* @param enableEventSystem {boolean} enables the event system. Defaults to true
|
|
31
24
|
* @param startRenderingData {StartRenderingDataConfig} if set, starts playing this immediately and restores the values
|
|
32
|
-
* @param
|
|
25
|
+
* @param synthConfig {SynthConfig} optional configuration for the synthesizer.
|
|
33
26
|
*/
|
|
34
|
-
constructor(targetNode: AudioNode, soundFontBuffer: ArrayBuffer, enableEventSystem?: boolean, startRenderingData?: StartRenderingDataConfig,
|
|
27
|
+
constructor(targetNode: AudioNode, soundFontBuffer: ArrayBuffer, enableEventSystem?: boolean, startRenderingData?: StartRenderingDataConfig, synthConfig?: SynthConfig);
|
|
35
28
|
context: BaseAudioContext;
|
|
36
29
|
targetNode: AudioNode;
|
|
37
30
|
/**
|
|
38
|
-
* Allows
|
|
31
|
+
* Allows setting up custom event listeners for the synthesizer
|
|
39
32
|
* @type {EventHandler}
|
|
40
33
|
*/
|
|
41
34
|
eventHandler: EventHandler;
|
|
@@ -43,13 +36,13 @@ export class Synthetizer {
|
|
|
43
36
|
_destroyed: boolean;
|
|
44
37
|
/**
|
|
45
38
|
* the new channels will have their audio sent to the moduled output by this constant.
|
|
46
|
-
* what does that mean? e.g
|
|
39
|
+
* what does that mean? e.g., if outputsAmount is 16, then channel's 16 audio data will be sent to channel 0
|
|
47
40
|
* @type {number}
|
|
48
41
|
* @private
|
|
49
42
|
*/
|
|
50
43
|
private _outputsAmount;
|
|
51
44
|
/**
|
|
52
|
-
* the
|
|
45
|
+
* the number of midi channels
|
|
53
46
|
* @type {number}
|
|
54
47
|
*/
|
|
55
48
|
channelsAmount: number;
|
|
@@ -74,10 +67,10 @@ export class Synthetizer {
|
|
|
74
67
|
*/
|
|
75
68
|
_highPerformanceMode: boolean;
|
|
76
69
|
/**
|
|
77
|
-
* @type {
|
|
70
|
+
* @type {SynthConfig}
|
|
78
71
|
*/
|
|
79
|
-
effectsConfig:
|
|
80
|
-
worklet:
|
|
72
|
+
effectsConfig: SynthConfig;
|
|
73
|
+
worklet: any;
|
|
81
74
|
/**
|
|
82
75
|
* The synth's soundfont manager
|
|
83
76
|
* @type {SoundfontManager}
|
|
@@ -101,12 +94,12 @@ export class Synthetizer {
|
|
|
101
94
|
reverbProcessor: ConvolverNode;
|
|
102
95
|
chorusProcessor: FancyChorus;
|
|
103
96
|
/**
|
|
104
|
-
* The maximum
|
|
97
|
+
* The maximum number of voices allowed at once
|
|
105
98
|
* @param value {number}
|
|
106
99
|
*/
|
|
107
100
|
set voiceCap(value: number);
|
|
108
101
|
/**
|
|
109
|
-
* The maximum
|
|
102
|
+
* The maximum number of voices allowed at once
|
|
110
103
|
* @returns {number}
|
|
111
104
|
*/
|
|
112
105
|
get voiceCap(): number;
|
|
@@ -121,7 +114,7 @@ export class Synthetizer {
|
|
|
121
114
|
*/
|
|
122
115
|
get currentTime(): number;
|
|
123
116
|
/**
|
|
124
|
-
* @returns {number} the current
|
|
117
|
+
* @returns {number} the current number of voices playing
|
|
125
118
|
*/
|
|
126
119
|
get voicesAmount(): number;
|
|
127
120
|
/**
|
|
@@ -171,7 +164,7 @@ export class Synthetizer {
|
|
|
171
164
|
rate: number;
|
|
172
165
|
}): void;
|
|
173
166
|
/**
|
|
174
|
-
* Connects the individual audio outputs to the given audio nodes. In the app it's used by the renderer.
|
|
167
|
+
* Connects the individual audio outputs to the given audio nodes. In the app, it's used by the renderer.
|
|
175
168
|
* @param audioNodes {AudioNode[]}
|
|
176
169
|
*/
|
|
177
170
|
connectIndividualOutputs(audioNodes: AudioNode[]): void;
|
|
@@ -237,7 +230,7 @@ export class Synthetizer {
|
|
|
237
230
|
*/
|
|
238
231
|
pitchWheel(channel: number, MSB: number, LSB: number): void;
|
|
239
232
|
/**
|
|
240
|
-
* Transposes the synthetizer's pitch by given semitones amount (percussion channels
|
|
233
|
+
* Transposes the synthetizer's pitch by given semitones amount (percussion channels don’t get affected)
|
|
241
234
|
* @param semitones {number} the semitones to transpose by. Can be a floating point number for more precision
|
|
242
235
|
*/
|
|
243
236
|
transpose(semitones: number): void;
|
|
@@ -350,7 +343,8 @@ export type StartRenderingDataConfig = {
|
|
|
350
343
|
*/
|
|
351
344
|
snapshot: SynthesizerSnapshot;
|
|
352
345
|
/**
|
|
353
|
-
* - if synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
346
|
+
* - if synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
347
|
+
* this disabled chorus and reverb.
|
|
354
348
|
*/
|
|
355
349
|
oneOutput: boolean | undefined;
|
|
356
350
|
/**
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/external_midi/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/midi_parser/README.md
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/package.json
CHANGED
package/sequencer/README.md
CHANGED
|
File without changes
|