spessasynth_lib 3.24.2 → 3.24.4
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 +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 -2
- package/sequencer/README.md +0 -0
- package/sequencer/worklet_sequencer/worklet_sequencer.js +6 -0
- 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 +6 -6
- 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
- package/@types/external_midi/midi_handler.d.ts +0 -39
- package/@types/external_midi/web_midi_link.d.ts +0 -12
- package/@types/externals/stbvorbis_sync/stbvorbis_sync.min.d.ts +0 -1
- package/@types/index.d.ts +0 -44
- package/@types/midi_parser/basic_midi.d.ts +0 -36
- package/@types/midi_parser/midi_builder.d.ts +0 -68
- package/@types/midi_parser/midi_data.d.ts +0 -46
- package/@types/midi_parser/midi_editor.d.ts +0 -89
- package/@types/midi_parser/midi_loader.d.ts +0 -30
- package/@types/midi_parser/midi_message.d.ts +0 -155
- package/@types/midi_parser/midi_sequence.d.ts +0 -135
- package/@types/midi_parser/midi_writer.d.ts +0 -6
- package/@types/midi_parser/rmidi_writer.d.ts +0 -85
- package/@types/midi_parser/used_keys_loaded.d.ts +0 -10
- package/@types/sequencer/sequencer.d.ts +0 -277
- package/@types/sequencer/worklet_sequencer/sequencer_message.d.ts +0 -31
- package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +0 -29
- package/@types/soundfont/basic_soundfont/basic_preset.d.ts +0 -86
- package/@types/soundfont/basic_soundfont/basic_sample.d.ts +0 -88
- package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +0 -102
- package/@types/soundfont/basic_soundfont/basic_zone.d.ts +0 -58
- package/@types/soundfont/basic_soundfont/basic_zones.d.ts +0 -22
- package/@types/soundfont/basic_soundfont/generator.d.ts +0 -102
- package/@types/soundfont/basic_soundfont/modulator.d.ts +0 -92
- package/@types/soundfont/basic_soundfont/riff_chunk.d.ts +0 -45
- package/@types/soundfont/basic_soundfont/write_dls/art2.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_dls/articulator.d.ts +0 -28
- package/@types/soundfont/basic_soundfont/write_dls/combine_zones.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_dls/ins.d.ts +0 -7
- package/@types/soundfont/basic_soundfont/write_dls/lins.d.ts +0 -5
- package/@types/soundfont/basic_soundfont/write_dls/modulator_converter.d.ts +0 -11
- package/@types/soundfont/basic_soundfont/write_dls/rgn2.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_dls/wave.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_dls/write_dls.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_dls/wsmp.d.ts +0 -12
- package/@types/soundfont/basic_soundfont/write_dls/wvpl.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +0 -11
- package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/write.d.ts +0 -21
- package/@types/soundfont/dls/articulator_converter.d.ts +0 -19
- package/@types/soundfont/dls/dls_destinations.d.ts +0 -29
- package/@types/soundfont/dls/dls_preset.d.ts +0 -13
- package/@types/soundfont/dls/dls_sample.d.ts +0 -19
- package/@types/soundfont/dls/dls_soundfont.d.ts +0 -31
- package/@types/soundfont/dls/dls_sources.d.ts +0 -27
- package/@types/soundfont/dls/dls_zone.d.ts +0 -23
- package/@types/soundfont/dls/read_articulation.d.ts +0 -12
- package/@types/soundfont/dls/read_instrument.d.ts +0 -5
- package/@types/soundfont/dls/read_instrument_list.d.ts +0 -5
- package/@types/soundfont/dls/read_lart.d.ts +0 -7
- package/@types/soundfont/dls/read_region.d.ts +0 -7
- package/@types/soundfont/dls/read_samples.d.ts +0 -5
- package/@types/soundfont/load_soundfont.d.ts +0 -6
- package/@types/soundfont/read_sf2/generators.d.ts +0 -16
- package/@types/soundfont/read_sf2/instruments.d.ts +0 -29
- package/@types/soundfont/read_sf2/modulators.d.ts +0 -15
- package/@types/soundfont/read_sf2/presets.d.ts +0 -30
- package/@types/soundfont/read_sf2/samples.d.ts +0 -55
- package/@types/soundfont/read_sf2/soundfont.d.ts +0 -28
- package/@types/soundfont/read_sf2/zones.d.ts +0 -99
- package/@types/synthetizer/audio_effects/effects_config.d.ts +0 -29
- package/@types/synthetizer/audio_effects/fancy_chorus.d.ts +0 -97
- package/@types/synthetizer/audio_effects/reverb.d.ts +0 -7
- package/@types/synthetizer/key_modifier_manager.d.ts +0 -56
- package/@types/synthetizer/synth_event_handler.d.ts +0 -263
- package/@types/synthetizer/synth_soundfont_manager.d.ts +0 -52
- package/@types/synthetizer/synthetizer.d.ts +0 -364
- package/@types/synthetizer/worklet_system/message_protocol/worklet_message.d.ts +0 -98
- package/@types/synthetizer/worklet_system/worklet_methods/worklet_key_modifier.d.ts +0 -77
- package/@types/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/sfman_message.d.ts +0 -7
- package/@types/synthetizer/worklet_system/worklet_utilities/controller_tables.d.ts +0 -23
- package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +0 -155
- package/@types/synthetizer/worklet_url.d.ts +0 -5
- package/@types/utils/buffer_to_wav.d.ts +0 -31
- package/@types/utils/byte_functions/big_endian.d.ts +0 -13
- package/@types/utils/byte_functions/little_endian.d.ts +0 -35
- package/@types/utils/byte_functions/string.d.ts +0 -27
- package/@types/utils/byte_functions/variable_length_quantity.d.ts +0 -12
- package/@types/utils/indexed_array.d.ts +0 -21
- package/@types/utils/loggin.d.ts +0 -26
- package/@types/utils/other.d.ts +0 -37
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
export namespace DEFAULT_CHORUS_CONFIG {
|
|
2
|
-
export { NODES_AMOUNT as nodesAmount };
|
|
3
|
-
export { DEFAULT_DELAY as defaultDelay };
|
|
4
|
-
export { DELAY_VARIATION as delayVariation };
|
|
5
|
-
export { STEREO_DIFF as stereoDifference };
|
|
6
|
-
export { OSC_FREQ as oscillatorFrequency };
|
|
7
|
-
export { OSC_FREQ_VARIATION as oscillatorFrequencyVariation };
|
|
8
|
-
export { OSC_GAIN as oscillatorGain };
|
|
9
|
-
}
|
|
10
|
-
export class FancyChorus {
|
|
11
|
-
/**
|
|
12
|
-
* Creates a fancy chorus effect
|
|
13
|
-
* @param output {AudioNode}
|
|
14
|
-
* @param config {ChorusConfig}
|
|
15
|
-
*/
|
|
16
|
-
constructor(output: AudioNode, config?: ChorusConfig);
|
|
17
|
-
input: ChannelSplitterNode;
|
|
18
|
-
merger: ChannelMergerNode;
|
|
19
|
-
chorusLeft: ChorusNode[];
|
|
20
|
-
chorusRight: ChorusNode[];
|
|
21
|
-
delete(): void;
|
|
22
|
-
/**
|
|
23
|
-
* @param freq {number}
|
|
24
|
-
* @param delay {number}
|
|
25
|
-
* @param list {ChorusNode[]}
|
|
26
|
-
* @param input {number}
|
|
27
|
-
* @param output {AudioNode}
|
|
28
|
-
* @param outputNum {number}
|
|
29
|
-
* @param context {BaseAudioContext}
|
|
30
|
-
* @param config {ChorusConfig}
|
|
31
|
-
*/
|
|
32
|
-
createChorusNode(freq: number, delay: number, list: ChorusNode[], input: number, output: AudioNode, outputNum: number, context: BaseAudioContext, config: ChorusConfig): void;
|
|
33
|
-
}
|
|
34
|
-
export type ChorusNode = {
|
|
35
|
-
oscillator: OscillatorNode;
|
|
36
|
-
oscillatorGain: GainNode;
|
|
37
|
-
delay: DelayNode;
|
|
38
|
-
};
|
|
39
|
-
export type ChorusConfig = {
|
|
40
|
-
/**
|
|
41
|
-
* - the amount of delay nodes (for each channel) and the corresponding oscillators
|
|
42
|
-
*/
|
|
43
|
-
nodesAmount: number;
|
|
44
|
-
/**
|
|
45
|
-
* - the initial delay, in seconds
|
|
46
|
-
*/
|
|
47
|
-
defaultDelay: number;
|
|
48
|
-
/**
|
|
49
|
-
* - the difference between delays in the delay nodes
|
|
50
|
-
*/
|
|
51
|
-
delayVariation: number;
|
|
52
|
-
/**
|
|
53
|
-
* - the difference of delays between two channels (added to the left channel and subtracted from the right)
|
|
54
|
-
*/
|
|
55
|
-
stereoDifference: number;
|
|
56
|
-
/**
|
|
57
|
-
* - the initial delay time oscillator frequency, in Hz.
|
|
58
|
-
*/
|
|
59
|
-
oscillatorFrequency: number;
|
|
60
|
-
/**
|
|
61
|
-
* - the difference between frequencies of oscillators, in Hz
|
|
62
|
-
*/
|
|
63
|
-
oscillatorFrequencyVariation: number;
|
|
64
|
-
/**
|
|
65
|
-
* - how much will oscillator alter the delay in delay nodes, in seconds
|
|
66
|
-
*/
|
|
67
|
-
oscillatorGain: number;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* fancy_chorus.js
|
|
71
|
-
* purpose: creates a simple chorus effect node
|
|
72
|
-
*/
|
|
73
|
-
/**
|
|
74
|
-
* @typedef {{
|
|
75
|
-
* oscillator: OscillatorNode,
|
|
76
|
-
* oscillatorGain: GainNode,
|
|
77
|
-
* delay: DelayNode
|
|
78
|
-
* }} ChorusNode
|
|
79
|
-
*/
|
|
80
|
-
/**
|
|
81
|
-
* @typedef {Object} ChorusConfig
|
|
82
|
-
* @property {number} nodesAmount - the amount of delay nodes (for each channel) and the corresponding oscillators
|
|
83
|
-
* @property {number} defaultDelay - the initial delay, in seconds
|
|
84
|
-
* @property {number} delayVariation - the difference between delays in the delay nodes
|
|
85
|
-
* @property {number} stereoDifference - the difference of delays between two channels (added to the left channel and subtracted from the right)
|
|
86
|
-
* @property {number} oscillatorFrequency - the initial delay time oscillator frequency, in Hz.
|
|
87
|
-
* @property {number} oscillatorFrequencyVariation - the difference between frequencies of oscillators, in Hz
|
|
88
|
-
* @property {number} oscillatorGain - how much will oscillator alter the delay in delay nodes, in seconds
|
|
89
|
-
*/
|
|
90
|
-
declare const NODES_AMOUNT: 4;
|
|
91
|
-
declare const DEFAULT_DELAY: 0.03;
|
|
92
|
-
declare const DELAY_VARIATION: 0.01;
|
|
93
|
-
declare const STEREO_DIFF: 0.02;
|
|
94
|
-
declare const OSC_FREQ: 0.2;
|
|
95
|
-
declare const OSC_FREQ_VARIATION: 0.05;
|
|
96
|
-
declare const OSC_GAIN: 0.003;
|
|
97
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
export class KeyModifierManager {
|
|
2
|
-
/**
|
|
3
|
-
* @param synth {Synthetizer}
|
|
4
|
-
*/
|
|
5
|
-
constructor(synth: Synthetizer);
|
|
6
|
-
synth: Synthetizer;
|
|
7
|
-
/**
|
|
8
|
-
* The velocity override mappings for MIDI keys
|
|
9
|
-
* @type {KeyModifier[][]}
|
|
10
|
-
* @private
|
|
11
|
-
*/
|
|
12
|
-
private _keyModifiers;
|
|
13
|
-
/**
|
|
14
|
-
* @private
|
|
15
|
-
* @param type {workletKeyModifierMessageType}
|
|
16
|
-
* @param data {any}
|
|
17
|
-
*/
|
|
18
|
-
private _sendToWorklet;
|
|
19
|
-
/**
|
|
20
|
-
* Modifies a single key
|
|
21
|
-
* @param channel {number} the channel affected. Usually 0-15
|
|
22
|
-
* @param midiNote {number} the MIDI note to change. 0-127
|
|
23
|
-
* @param options {{
|
|
24
|
-
* velocity: number|undefined,
|
|
25
|
-
* patch: {
|
|
26
|
-
* bank: number,
|
|
27
|
-
* program: number
|
|
28
|
-
* }|undefined
|
|
29
|
-
* }} the key's modifiers
|
|
30
|
-
*/
|
|
31
|
-
addModifier(channel: number, midiNote: number, options: {
|
|
32
|
-
velocity: number | undefined;
|
|
33
|
-
patch: {
|
|
34
|
-
bank: number;
|
|
35
|
-
program: number;
|
|
36
|
-
} | undefined;
|
|
37
|
-
}): void;
|
|
38
|
-
/**
|
|
39
|
-
* Gets a key modifier
|
|
40
|
-
* @param channel {number} the channel affected. Usually 0-15
|
|
41
|
-
* @param midiNote {number} the MIDI note to change. 0-127
|
|
42
|
-
* @returns {KeyModifier|undefined}
|
|
43
|
-
*/
|
|
44
|
-
getModifier(channel: number, midiNote: number): KeyModifier | undefined;
|
|
45
|
-
/**
|
|
46
|
-
* Deletes a key modifier
|
|
47
|
-
* @param channel {number} the channel affected. Usually 0-15
|
|
48
|
-
* @param midiNote {number} the MIDI note to change. 0-127
|
|
49
|
-
*/
|
|
50
|
-
deleteModifier(channel: number, midiNote: number): void;
|
|
51
|
-
/**
|
|
52
|
-
* Clears ALL Modifiers
|
|
53
|
-
*/
|
|
54
|
-
clearModifiers(): void;
|
|
55
|
-
}
|
|
56
|
-
import { KeyModifier } from "./worklet_system/worklet_methods/worklet_key_modifier.js";
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* synth_event_handler.js
|
|
3
|
-
* purpose: manages the synthesizer's event system, calling assinged functions when synthesizer requests dispatching the event
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {Object} NoteOnCallback
|
|
7
|
-
* @property {number} midiNote - The MIDI note number.
|
|
8
|
-
* @property {number} channel - The MIDI channel number.
|
|
9
|
-
* @property {number} velocity - The velocity of the note.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {Object} NoteOffCallback
|
|
13
|
-
* @property {number} midiNote - The MIDI note number.
|
|
14
|
-
* @property {number} channel - The MIDI channel number.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* @typedef {Object} DrumChangeCallback
|
|
18
|
-
* @property {number} channel - The MIDI channel number.
|
|
19
|
-
* @property {boolean} isDrumChannel - Indicates if the channel is a drum channel.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @typedef {Object} ProgramChangeCallback
|
|
23
|
-
* @property {number} channel - The MIDI channel number.
|
|
24
|
-
* @property {number} program - The program number.
|
|
25
|
-
* @property {number} bank - The bank number.
|
|
26
|
-
* @property {boolean} userCalled - Indicates if the change was user-initiated.
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* @typedef {Object} ControllerChangeCallback
|
|
30
|
-
* @property {number} channel - The MIDI channel number.
|
|
31
|
-
* @property {number} controllerNumber - The controller number.
|
|
32
|
-
* @property {number} controllerValue - The value of the controller.
|
|
33
|
-
*/
|
|
34
|
-
/**
|
|
35
|
-
* @typedef {Object} MuteChannelCallback
|
|
36
|
-
* @property {number} channel - The MIDI channel number.
|
|
37
|
-
* @property {boolean} isMuted - Indicates if the channel is muted.
|
|
38
|
-
*/
|
|
39
|
-
/**
|
|
40
|
-
* @typedef {Object} PresetListChangeCallbackSingle
|
|
41
|
-
* @property {string} presetName - The name of the preset.
|
|
42
|
-
* @property {number} bank - The bank number.
|
|
43
|
-
* @property {number} program - The program number.
|
|
44
|
-
*/
|
|
45
|
-
/**
|
|
46
|
-
* @typedef {PresetListChangeCallbackSingle[]} PresetListChangeCallback - A list of preset objects.
|
|
47
|
-
*/
|
|
48
|
-
/**
|
|
49
|
-
* @typedef {Object} SynthDisplayCallback
|
|
50
|
-
* @property {Uint8Array} displayData - The data to display.
|
|
51
|
-
* @property {SynthDisplayType} displayType - The type of display.
|
|
52
|
-
*/
|
|
53
|
-
/**
|
|
54
|
-
* @typedef {Object} PitchWheelCallback
|
|
55
|
-
* @property {number} channel - The MIDI channel number.
|
|
56
|
-
* @property {number} MSB - The most significant byte of the pitch wheel value.
|
|
57
|
-
* @property {number} LSB - The least significant byte of the pitch wheel value.
|
|
58
|
-
*/
|
|
59
|
-
/**
|
|
60
|
-
* @typedef {Object} ChannelPressureCallback
|
|
61
|
-
* @property {number} channel - The MIDI channel number.
|
|
62
|
-
* @property {number} pressure - The pressure value.
|
|
63
|
-
*/
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {Error} SoundfontErrorCallback - The error message for soundfont errors.
|
|
66
|
-
*/
|
|
67
|
-
/**
|
|
68
|
-
* @typedef {
|
|
69
|
-
* NoteOnCallback |
|
|
70
|
-
* NoteOffCallback |
|
|
71
|
-
* DrumChangeCallback |
|
|
72
|
-
* ProgramChangeCallback |
|
|
73
|
-
* ControllerChangeCallback |
|
|
74
|
-
* MuteChannelCallback |
|
|
75
|
-
* PresetListChangeCallback |
|
|
76
|
-
* PitchWheelCallback |
|
|
77
|
-
* SoundfontErrorCallback |
|
|
78
|
-
* ChannelPressureCallback |
|
|
79
|
-
* SynthDisplayCallback |
|
|
80
|
-
* undefined
|
|
81
|
-
* } EventCallbackData
|
|
82
|
-
*/
|
|
83
|
-
/**
|
|
84
|
-
* @typedef {
|
|
85
|
-
* "noteon"|
|
|
86
|
-
* "noteoff"|
|
|
87
|
-
* "pitchwheel"|
|
|
88
|
-
* "controllerchange"|
|
|
89
|
-
* "programchange"|
|
|
90
|
-
* "channelpressure"|
|
|
91
|
-
* "polypressure" |
|
|
92
|
-
* "drumchange"|
|
|
93
|
-
* "stopall"|
|
|
94
|
-
* "newchannel"|
|
|
95
|
-
* "mutechannel"|
|
|
96
|
-
* "presetlistchange"|
|
|
97
|
-
* "allcontrollerreset"|
|
|
98
|
-
* "soundfonterror"|
|
|
99
|
-
* "synthdisplay"} EventTypes
|
|
100
|
-
*/
|
|
101
|
-
export class EventHandler {
|
|
102
|
-
/**
|
|
103
|
-
* The main list of events
|
|
104
|
-
* @type {Object<EventTypes, Object<string, function(EventCallbackData)>>}
|
|
105
|
-
*/
|
|
106
|
-
events: any;
|
|
107
|
-
/**
|
|
108
|
-
* Set to 0 to disabled, otherwise in seconds
|
|
109
|
-
* @type {number}
|
|
110
|
-
*/
|
|
111
|
-
timeDelay: number;
|
|
112
|
-
/**
|
|
113
|
-
* Adds a new event listener
|
|
114
|
-
* @param name {EventTypes}
|
|
115
|
-
* @param id {string} the unique identifier for the event (to delete it
|
|
116
|
-
* @param callback {function(EventCallbackData)}
|
|
117
|
-
*/
|
|
118
|
-
addEvent(name: EventTypes, id: string, callback: (arg0: EventCallbackData) => any): void;
|
|
119
|
-
/**
|
|
120
|
-
* Removes an event listener
|
|
121
|
-
* @param name {EventTypes}
|
|
122
|
-
* @param id {string}
|
|
123
|
-
*/
|
|
124
|
-
removeEvent(name: EventTypes, id: string): void;
|
|
125
|
-
/**
|
|
126
|
-
* Calls the given event
|
|
127
|
-
* @param name {EventTypes}
|
|
128
|
-
* @param eventData {EventCallbackData}
|
|
129
|
-
*/
|
|
130
|
-
callEvent(name: EventTypes, eventData: EventCallbackData): void;
|
|
131
|
-
}
|
|
132
|
-
export type NoteOnCallback = {
|
|
133
|
-
/**
|
|
134
|
-
* - The MIDI note number.
|
|
135
|
-
*/
|
|
136
|
-
midiNote: number;
|
|
137
|
-
/**
|
|
138
|
-
* - The MIDI channel number.
|
|
139
|
-
*/
|
|
140
|
-
channel: number;
|
|
141
|
-
/**
|
|
142
|
-
* - The velocity of the note.
|
|
143
|
-
*/
|
|
144
|
-
velocity: number;
|
|
145
|
-
};
|
|
146
|
-
export type NoteOffCallback = {
|
|
147
|
-
/**
|
|
148
|
-
* - The MIDI note number.
|
|
149
|
-
*/
|
|
150
|
-
midiNote: number;
|
|
151
|
-
/**
|
|
152
|
-
* - The MIDI channel number.
|
|
153
|
-
*/
|
|
154
|
-
channel: number;
|
|
155
|
-
};
|
|
156
|
-
export type DrumChangeCallback = {
|
|
157
|
-
/**
|
|
158
|
-
* - The MIDI channel number.
|
|
159
|
-
*/
|
|
160
|
-
channel: number;
|
|
161
|
-
/**
|
|
162
|
-
* - Indicates if the channel is a drum channel.
|
|
163
|
-
*/
|
|
164
|
-
isDrumChannel: boolean;
|
|
165
|
-
};
|
|
166
|
-
export type ProgramChangeCallback = {
|
|
167
|
-
/**
|
|
168
|
-
* - The MIDI channel number.
|
|
169
|
-
*/
|
|
170
|
-
channel: number;
|
|
171
|
-
/**
|
|
172
|
-
* - The program number.
|
|
173
|
-
*/
|
|
174
|
-
program: number;
|
|
175
|
-
/**
|
|
176
|
-
* - The bank number.
|
|
177
|
-
*/
|
|
178
|
-
bank: number;
|
|
179
|
-
/**
|
|
180
|
-
* - Indicates if the change was user-initiated.
|
|
181
|
-
*/
|
|
182
|
-
userCalled: boolean;
|
|
183
|
-
};
|
|
184
|
-
export type ControllerChangeCallback = {
|
|
185
|
-
/**
|
|
186
|
-
* - The MIDI channel number.
|
|
187
|
-
*/
|
|
188
|
-
channel: number;
|
|
189
|
-
/**
|
|
190
|
-
* - The controller number.
|
|
191
|
-
*/
|
|
192
|
-
controllerNumber: number;
|
|
193
|
-
/**
|
|
194
|
-
* - The value of the controller.
|
|
195
|
-
*/
|
|
196
|
-
controllerValue: number;
|
|
197
|
-
};
|
|
198
|
-
export type MuteChannelCallback = {
|
|
199
|
-
/**
|
|
200
|
-
* - The MIDI channel number.
|
|
201
|
-
*/
|
|
202
|
-
channel: number;
|
|
203
|
-
/**
|
|
204
|
-
* - Indicates if the channel is muted.
|
|
205
|
-
*/
|
|
206
|
-
isMuted: boolean;
|
|
207
|
-
};
|
|
208
|
-
export type PresetListChangeCallbackSingle = {
|
|
209
|
-
/**
|
|
210
|
-
* - The name of the preset.
|
|
211
|
-
*/
|
|
212
|
-
presetName: string;
|
|
213
|
-
/**
|
|
214
|
-
* - The bank number.
|
|
215
|
-
*/
|
|
216
|
-
bank: number;
|
|
217
|
-
/**
|
|
218
|
-
* - The program number.
|
|
219
|
-
*/
|
|
220
|
-
program: number;
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* - A list of preset objects.
|
|
224
|
-
*/
|
|
225
|
-
export type PresetListChangeCallback = PresetListChangeCallbackSingle[];
|
|
226
|
-
export type SynthDisplayCallback = {
|
|
227
|
-
/**
|
|
228
|
-
* - The data to display.
|
|
229
|
-
*/
|
|
230
|
-
displayData: Uint8Array;
|
|
231
|
-
/**
|
|
232
|
-
* - The type of display.
|
|
233
|
-
*/
|
|
234
|
-
displayType: SynthDisplayType;
|
|
235
|
-
};
|
|
236
|
-
export type PitchWheelCallback = {
|
|
237
|
-
/**
|
|
238
|
-
* - The MIDI channel number.
|
|
239
|
-
*/
|
|
240
|
-
channel: number;
|
|
241
|
-
/**
|
|
242
|
-
* - The most significant byte of the pitch wheel value.
|
|
243
|
-
*/
|
|
244
|
-
MSB: number;
|
|
245
|
-
/**
|
|
246
|
-
* - The least significant byte of the pitch wheel value.
|
|
247
|
-
*/
|
|
248
|
-
LSB: number;
|
|
249
|
-
};
|
|
250
|
-
export type ChannelPressureCallback = {
|
|
251
|
-
/**
|
|
252
|
-
* - The MIDI channel number.
|
|
253
|
-
*/
|
|
254
|
-
channel: number;
|
|
255
|
-
/**
|
|
256
|
-
* - The pressure value.
|
|
257
|
-
*/
|
|
258
|
-
pressure: number;
|
|
259
|
-
};
|
|
260
|
-
/**
|
|
261
|
-
* - The error message for soundfont errors.
|
|
262
|
-
*/
|
|
263
|
-
export type SoundfontErrorCallback = Error;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export class SoundfontManager {
|
|
2
|
-
/**
|
|
3
|
-
* Creates a new instance of the soundfont manager
|
|
4
|
-
* @param synth {Synthetizer}
|
|
5
|
-
*/
|
|
6
|
-
constructor(synth: Synthetizer);
|
|
7
|
-
/**
|
|
8
|
-
* The current list of soundfonts, in order from the most important to the least.
|
|
9
|
-
* @type {{
|
|
10
|
-
* id: string,
|
|
11
|
-
* bankOffset: number
|
|
12
|
-
* }[]}
|
|
13
|
-
*/
|
|
14
|
-
soundfontList: {
|
|
15
|
-
id: string;
|
|
16
|
-
bankOffset: number;
|
|
17
|
-
}[];
|
|
18
|
-
/**
|
|
19
|
-
* @type {MessagePort}
|
|
20
|
-
* @private
|
|
21
|
-
*/
|
|
22
|
-
private _port;
|
|
23
|
-
synth: Synthetizer;
|
|
24
|
-
/**
|
|
25
|
-
* @private
|
|
26
|
-
* @param type {WorkletSoundfontManagerMessageType}
|
|
27
|
-
* @param data {any}
|
|
28
|
-
*/
|
|
29
|
-
private _sendToWorklet;
|
|
30
|
-
/**
|
|
31
|
-
* Adds a new soundfont buffer with a given ID
|
|
32
|
-
* @param soundfontBuffer {ArrayBuffer} - the soundfont's buffer
|
|
33
|
-
* @param id {string} - the soundfont's unique identifier
|
|
34
|
-
* @param bankOffset {number} - the soundfont's bank offset. Default is 0
|
|
35
|
-
*/
|
|
36
|
-
addNewSoundFont(soundfontBuffer: ArrayBuffer, id: string, bankOffset?: number): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Deletes a soundfont with the given ID
|
|
39
|
-
* @param id {string} - the soundfont to delete
|
|
40
|
-
*/
|
|
41
|
-
deleteSoundFont(id: string): void;
|
|
42
|
-
/**
|
|
43
|
-
* Rearranges the soundfonts in a given order
|
|
44
|
-
* @param newList {string[]} the order of soundfonts, a list of identifiers, first overwrites second
|
|
45
|
-
*/
|
|
46
|
-
rearrangeSoundFonts(newList: string[]): void;
|
|
47
|
-
/**
|
|
48
|
-
* DELETES ALL SOUNDFONTS!! and creates a new one with id "main"
|
|
49
|
-
* @param newBuffer {ArrayBuffer}
|
|
50
|
-
*/
|
|
51
|
-
reloadManager(newBuffer: ArrayBuffer): Promise<void>;
|
|
52
|
-
}
|