spessasynth_lib 3.20.42 → 3.21.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.
Files changed (161) hide show
  1. package/@types/external_midi/midi_handler.d.ts +1 -1
  2. package/@types/external_midi/web_midi_link.d.ts +1 -1
  3. package/@types/index.d.ts +0 -2
  4. package/@types/midi_parser/midi_builder.d.ts +1 -1
  5. package/@types/midi_parser/midi_editor.d.ts +1 -1
  6. package/@types/midi_parser/midi_loader.d.ts +2 -2
  7. package/@types/midi_parser/midi_message.d.ts +5 -5
  8. package/@types/midi_parser/rmidi_writer.d.ts +1 -1
  9. package/@types/sequencer/sequencer.d.ts +65 -65
  10. package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +2 -2
  11. package/@types/soundfont/basic_soundfont/basic_preset.d.ts +1 -1
  12. package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +9 -9
  13. package/@types/soundfont/basic_soundfont/basic_zones.d.ts +1 -1
  14. package/@types/soundfont/basic_soundfont/generator.d.ts +101 -0
  15. package/@types/soundfont/basic_soundfont/modulator.d.ts +79 -0
  16. package/@types/soundfont/basic_soundfont/riff_chunk.d.ts +1 -1
  17. package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +1 -1
  18. package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +1 -1
  19. package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +1 -1
  20. package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +1 -1
  21. package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +1 -1
  22. package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +1 -1
  23. package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +1 -1
  24. package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +1 -1
  25. package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +1 -1
  26. package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +1 -1
  27. package/@types/soundfont/dls/articulator_converter.d.ts +1 -1
  28. package/@types/soundfont/dls/dls_preset.d.ts +3 -3
  29. package/@types/soundfont/dls/dls_sample.d.ts +5 -5
  30. package/@types/soundfont/dls/dls_soundfont.d.ts +7 -7
  31. package/@types/soundfont/dls/dls_zone.d.ts +1 -1
  32. package/@types/soundfont/dls/read_articulation.d.ts +2 -2
  33. package/@types/soundfont/dls/read_region.d.ts +1 -1
  34. package/@types/soundfont/read_sf2/generators.d.ts +3 -99
  35. package/@types/soundfont/read_sf2/instruments.d.ts +1 -1
  36. package/@types/soundfont/read_sf2/modulators.d.ts +5 -80
  37. package/@types/soundfont/read_sf2/presets.d.ts +1 -1
  38. package/@types/soundfont/read_sf2/samples.d.ts +3 -3
  39. package/@types/soundfont/read_sf2/soundfont.d.ts +3 -3
  40. package/@types/soundfont/read_sf2/zones.d.ts +4 -4
  41. package/@types/synthetizer/synthetizer.d.ts +12 -12
  42. package/@types/synthetizer/worklet_system/worklet_utilities/controller_tables.d.ts +23 -0
  43. package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +2 -23
  44. package/@types/utils/byte_functions/string.d.ts +1 -1
  45. package/README.md +47 -41
  46. package/external_midi/README.md +1 -0
  47. package/external_midi/midi_handler.js +37 -25
  48. package/external_midi/web_midi_link.js +13 -12
  49. package/externals/stbvorbis_sync/@types/stbvorbis_sync.d.ts +6 -6
  50. package/midi_parser/README.md +1 -0
  51. package/midi_parser/basic_midi.js +22 -21
  52. package/midi_parser/midi_builder.js +49 -46
  53. package/midi_parser/midi_data.js +17 -17
  54. package/midi_parser/midi_editor.js +171 -105
  55. package/midi_parser/midi_loader.js +193 -153
  56. package/midi_parser/midi_message.js +28 -22
  57. package/midi_parser/midi_writer.js +13 -13
  58. package/midi_parser/rmidi_writer.js +140 -89
  59. package/midi_parser/used_keys_loaded.js +51 -40
  60. package/package.json +1 -1
  61. package/sequencer/README.md +10 -3
  62. package/sequencer/sequencer.js +230 -230
  63. package/sequencer/worklet_sequencer/events.js +23 -23
  64. package/sequencer/worklet_sequencer/play.js +76 -63
  65. package/sequencer/worklet_sequencer/process_event.js +39 -32
  66. package/sequencer/worklet_sequencer/process_tick.js +15 -14
  67. package/sequencer/worklet_sequencer/sequencer_message.js +3 -3
  68. package/sequencer/worklet_sequencer/song_control.js +51 -39
  69. package/sequencer/worklet_sequencer/worklet_sequencer.js +54 -54
  70. package/soundfont/README.md +2 -1
  71. package/soundfont/basic_soundfont/basic_instrument.js +16 -16
  72. package/soundfont/basic_soundfont/basic_preset.js +90 -58
  73. package/soundfont/basic_soundfont/basic_sample.js +46 -38
  74. package/soundfont/basic_soundfont/basic_soundfont.js +85 -76
  75. package/soundfont/basic_soundfont/basic_zone.js +4 -4
  76. package/soundfont/basic_soundfont/basic_zones.js +8 -8
  77. package/soundfont/basic_soundfont/generator.js +212 -0
  78. package/soundfont/basic_soundfont/modulator.js +283 -0
  79. package/soundfont/basic_soundfont/riff_chunk.js +27 -24
  80. package/soundfont/basic_soundfont/write_sf2/ibag.js +6 -6
  81. package/soundfont/basic_soundfont/write_sf2/igen.js +13 -11
  82. package/soundfont/basic_soundfont/write_sf2/imod.js +7 -7
  83. package/soundfont/basic_soundfont/write_sf2/inst.js +6 -6
  84. package/soundfont/basic_soundfont/write_sf2/pbag.js +6 -6
  85. package/soundfont/basic_soundfont/write_sf2/pgen.js +12 -10
  86. package/soundfont/basic_soundfont/write_sf2/phdr.js +5 -5
  87. package/soundfont/basic_soundfont/write_sf2/pmod.js +7 -7
  88. package/soundfont/basic_soundfont/write_sf2/sdta.js +20 -15
  89. package/soundfont/basic_soundfont/write_sf2/shdr.js +9 -8
  90. package/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js +56 -40
  91. package/soundfont/basic_soundfont/write_sf2/write.js +96 -64
  92. package/soundfont/dls/articulator_converter.js +41 -45
  93. package/soundfont/dls/dls_destinations.js +6 -6
  94. package/soundfont/dls/dls_preset.js +8 -8
  95. package/soundfont/dls/dls_sample.js +15 -16
  96. package/soundfont/dls/dls_soundfont.js +52 -45
  97. package/soundfont/dls/dls_sources.js +3 -3
  98. package/soundfont/dls/dls_zone.js +14 -14
  99. package/soundfont/dls/read_articulation.js +76 -59
  100. package/soundfont/dls/read_instrument.js +29 -27
  101. package/soundfont/dls/read_instrument_list.js +4 -4
  102. package/soundfont/dls/read_lart.js +7 -7
  103. package/soundfont/dls/read_region.js +31 -30
  104. package/soundfont/dls/read_samples.js +39 -34
  105. package/soundfont/load_soundfont.js +5 -5
  106. package/soundfont/read_sf2/generators.js +6 -219
  107. package/soundfont/read_sf2/instruments.js +10 -10
  108. package/soundfont/read_sf2/modulators.js +15 -270
  109. package/soundfont/read_sf2/presets.js +10 -10
  110. package/soundfont/read_sf2/samples.js +51 -49
  111. package/soundfont/read_sf2/soundfont.js +90 -70
  112. package/soundfont/read_sf2/zones.js +34 -34
  113. package/synthetizer/README.md +3 -1
  114. package/synthetizer/audio_effects/effects_config.js +3 -3
  115. package/synthetizer/audio_effects/fancy_chorus.js +33 -13
  116. package/synthetizer/audio_effects/reverb.js +3 -2
  117. package/synthetizer/synth_event_handler.js +6 -5
  118. package/synthetizer/synth_soundfont_manager.js +12 -12
  119. package/synthetizer/synthetizer.js +164 -147
  120. package/synthetizer/worklet_processor.min.js +10 -10
  121. package/synthetizer/worklet_system/README.md +6 -2
  122. package/synthetizer/worklet_system/main_processor.js +106 -91
  123. package/synthetizer/worklet_system/message_protocol/handle_message.js +41 -41
  124. package/synthetizer/worklet_system/message_protocol/message_sending.js +10 -8
  125. package/synthetizer/worklet_system/message_protocol/worklet_message.js +28 -28
  126. package/synthetizer/worklet_system/worklet_methods/controller_control.js +50 -42
  127. package/synthetizer/worklet_system/worklet_methods/data_entry.js +88 -71
  128. package/synthetizer/worklet_system/worklet_methods/note_off.js +30 -21
  129. package/synthetizer/worklet_system/worklet_methods/note_on.js +31 -26
  130. package/synthetizer/worklet_system/worklet_methods/program_control.js +48 -37
  131. package/synthetizer/worklet_system/worklet_methods/reset_controllers.js +47 -40
  132. package/synthetizer/worklet_system/worklet_methods/snapshot.js +21 -20
  133. package/synthetizer/worklet_system/worklet_methods/system_exclusive.js +190 -142
  134. package/synthetizer/worklet_system/worklet_methods/tuning_control.js +48 -25
  135. package/synthetizer/worklet_system/worklet_methods/vibrato_control.js +1 -1
  136. package/synthetizer/worklet_system/worklet_methods/voice_control.js +66 -55
  137. package/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/sfman_message.js +2 -2
  138. package/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/worklet_soundfont_manager.js +35 -34
  139. package/synthetizer/worklet_system/worklet_processor.js +4 -4
  140. package/synthetizer/worklet_system/worklet_utilities/controller_tables.js +62 -0
  141. package/synthetizer/worklet_system/worklet_utilities/lfo.js +6 -4
  142. package/synthetizer/worklet_system/worklet_utilities/lowpass_filter.js +36 -35
  143. package/synthetizer/worklet_system/worklet_utilities/modulation_envelope.js +32 -28
  144. package/synthetizer/worklet_system/worklet_utilities/modulator_curves.js +20 -16
  145. package/synthetizer/worklet_system/worklet_utilities/stereo_panner.js +9 -8
  146. package/synthetizer/worklet_system/worklet_utilities/unit_converter.js +11 -5
  147. package/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +77 -83
  148. package/synthetizer/worklet_system/worklet_utilities/wavetable_oscillator.js +64 -52
  149. package/synthetizer/worklet_system/worklet_utilities/worklet_modulator.js +78 -54
  150. package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +14 -53
  151. package/synthetizer/worklet_system/worklet_utilities/worklet_voice.js +213 -211
  152. package/utils/README.md +1 -0
  153. package/utils/buffer_to_wav.js +48 -35
  154. package/utils/byte_functions/big_endian.js +16 -12
  155. package/utils/byte_functions/little_endian.js +10 -7
  156. package/utils/byte_functions/string.js +21 -20
  157. package/utils/byte_functions/variable_length_quantity.js +22 -17
  158. package/utils/encode_vorbis.js +3 -3
  159. package/utils/indexed_array.js +7 -7
  160. package/utils/loggin.js +6 -6
  161. package/utils/other.js +17 -10
@@ -36,4 +36,4 @@ export class MIDIDeviceHandler {
36
36
  disconnectDeviceFromSynth(input: MIDIInput): void;
37
37
  disconnectAllDevicesFromSynth(): void;
38
38
  }
39
- import { Synthetizer } from '../synthetizer/synthetizer.js';
39
+ import { Synthetizer } from "../synthetizer/synthetizer.js";
@@ -9,4 +9,4 @@ export class WebMidiLinkHandler {
9
9
  */
10
10
  constructor(synth: Synthetizer);
11
11
  }
12
- import { Synthetizer } from '../synthetizer/synthetizer.js';
12
+ import { Synthetizer } from "../synthetizer/synthetizer.js";
package/@types/index.d.ts CHANGED
@@ -5,7 +5,6 @@ import { VOICE_CAP } from './synthetizer/synthetizer.js';
5
5
  import { BasicSoundFont } from "./soundfont/basic_soundfont/basic_soundfont.js";
6
6
  import { loadSoundFont } from "./soundfont/load_soundfont.js";
7
7
  import { trimSoundfont } from "./soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js";
8
- import { modulatorSources } from "./soundfont/read_sf2/modulators.js";
9
8
  import { encodeVorbis } from "./utils/encode_vorbis.js";
10
9
  import { MIDI } from './midi_parser/midi_loader.js';
11
10
  import { MIDIBuilder } from "./midi_parser/midi_builder.js";
@@ -32,7 +31,6 @@ import { consoleColors } from './utils/other.js';
32
31
  import { formatTitle } from './utils/other.js';
33
32
  import { formatTime } from './utils/other.js';
34
33
  import { readBytesAsUintBigEndian } from './utils/byte_functions/big_endian.js';
35
- import { NON_CC_INDEX_OFFSET } from './synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js';
36
34
  import { ALL_CHANNELS_OR_DIFFERENT_ACTION } from './synthetizer/worklet_system/message_protocol/worklet_message.js';
37
35
  import { WORKLET_URL_ABSOLUTE } from './synthetizer/worklet_url.js';
38
36
  export { Sequencer, Synthetizer, DEFAULT_PERCUSSION, VOICE_CAP, BasicSoundFont, loadSoundFont, trimSoundfont, modulatorSources, encodeVorbis, MIDI, MIDIBuilder, IndexedByteArray, writeMIDIFile, writeRMIDI, applySnapshotToMIDI, modifyMIDI, MIDIticksToSeconds, audioBufferToWav, SpessaSynthLogging, SpessaSynthGroup, SpessaSynthTable, SpessaSynthGroupEnd, SpessaSynthInfo, SpessaSynthWarn, SpessaSynthGroupCollapsed, midiControllers, messageTypes, MIDIDeviceHandler, WebMidiLinkHandler, arrayToHexString, consoleColors, formatTitle, formatTime, readBytesAsUintBigEndian, NON_CC_INDEX_OFFSET, ALL_CHANNELS_OR_DIFFERENT_ACTION, WORKLET_URL_ABSOLUTE };
@@ -66,4 +66,4 @@ export class MIDIBuilder extends BasicMIDI {
66
66
  */
67
67
  addPitchWheel(ticks: number, track: number, channel: number, MSB: number, LSB: number): void;
68
68
  }
69
- import { BasicMIDI } from './basic_midi.js';
69
+ import { BasicMIDI } from "./basic_midi.js";
@@ -42,4 +42,4 @@ export function modifyMIDI(midi: BasicMIDI, desiredProgramChanges?: {
42
42
  * @param snapshot {SynthesizerSnapshot}
43
43
  */
44
44
  export function applySnapshotToMIDI(midi: BasicMIDI, snapshot: SynthesizerSnapshot): void;
45
- import { MidiMessage } from './midi_message.js';
45
+ import { MidiMessage } from "./midi_message.js";
@@ -22,5 +22,5 @@ export class MIDI extends BasicMIDI {
22
22
  data: IndexedByteArray;
23
23
  };
24
24
  }
25
- import { BasicMIDI } from './basic_midi.js';
26
- import { IndexedByteArray } from '../utils/indexed_array.js';
25
+ import { BasicMIDI } from "./basic_midi.js";
26
+ import { IndexedByteArray } from "../utils/indexed_array.js";
@@ -120,11 +120,11 @@ export namespace midiControllers {
120
120
  let generalPurposeController7: number;
121
121
  let generalPurposeController8: number;
122
122
  let portamentoControl: number;
123
- let effects1Depth: number;
124
- let effects2Depth: number;
125
- let effects3Depth: number;
126
- let effects4Depth: number;
127
- let effects5Depth: number;
123
+ let reverbDepth: number;
124
+ let tremoloDepth: number;
125
+ let chorusDepth: number;
126
+ let detuneDepth: number;
127
+ let phaserDepth: number;
128
128
  let dataIncrement: number;
129
129
  let dataDecrement: number;
130
130
  let NRPNLsb: number;
@@ -81,4 +81,4 @@ export type RMIDMetadata = {
81
81
  */
82
82
  midiEncoding: string | typeof unescape;
83
83
  };
84
- import { IndexedByteArray } from '../utils/indexed_array.js';
84
+ import { IndexedByteArray } from "../utils/indexed_array.js";
@@ -6,6 +6,38 @@ export class Sequencer {
6
6
  * @param options {SequencerOptions} the sequencer's options
7
7
  */
8
8
  constructor(midiBinaries: MIDIFile[], synth: Synthetizer, options?: SequencerOptions);
9
+ /**
10
+ * Executes when MIDI parsing has an error.
11
+ * @type {function(string)}
12
+ */
13
+ onError: (arg0: string) => any;
14
+ /**
15
+ * The sequence's data, except for the track data.
16
+ * @type {MidiData}
17
+ */
18
+ midiData: MidiData;
19
+ /**
20
+ * @type {Object<string, function(MidiData)>}
21
+ * @private
22
+ */
23
+ private onSongChange;
24
+ /**
25
+ * Fires on text event
26
+ * @param data {Uint8Array} the data text
27
+ * @param type {number} the status byte of the message (the meta status byte)
28
+ */
29
+ onTextEvent: any;
30
+ /**
31
+ * Fires when CurrentTime changes
32
+ * @type {Object<string, function(number)>} the time that was changed to
33
+ * @private
34
+ */
35
+ private onTimeChange;
36
+ /**
37
+ * @type {Object<string, function>}
38
+ * @private
39
+ */
40
+ private onSongEnded;
9
41
  ignoreEvents: boolean;
10
42
  synth: Synthetizer;
11
43
  highResTimeOffset: number;
@@ -56,32 +88,18 @@ export class Sequencer {
56
88
  * @return {boolean}
57
89
  */
58
90
  get skipToFirstNoteOn(): boolean;
59
- resetMIDIOut(): void;
60
- set loop(value: boolean);
61
- get loop(): boolean;
62
- /**
63
- * @param messageType {WorkletSequencerMessageType}
64
- * @param messageData {any}
65
- * @private
66
- */
67
- private _sendMessage;
68
- /**
69
- * Executes when MIDI parsing has an error.
70
- * @type {function(string)}
71
- */
72
- onError: (arg0: string) => any;
91
+ set currentTime(time: number);
73
92
  /**
74
- * @param {WorkletSequencerReturnMessageType} messageType
75
- * @param {any} messageData
76
- * @private
93
+ * @returns {number} Current playback time, in seconds
77
94
  */
78
- private _handleMessage;
95
+ get currentTime(): number;
96
+ set loop(value: boolean);
97
+ get loop(): boolean;
79
98
  /**
80
- * The sequence's data, except for the track data.
81
- * @type {MidiData}
99
+ * Use for visualization as it's not affected by the audioContext stutter
100
+ * @returns {number}
82
101
  */
83
- midiData: MidiData;
84
- pausedTime: number;
102
+ get currentHighResolutionTime(): number;
85
103
  /**
86
104
  * @param value {number}
87
105
  */
@@ -90,6 +108,11 @@ export class Sequencer {
90
108
  * @returns {number}
91
109
  */
92
110
  get playbackRate(): number;
111
+ /**
112
+ * true if paused, false if playing or stopped
113
+ * @returns {boolean}
114
+ */
115
+ get paused(): boolean;
93
116
  /**
94
117
  * Adds a new event that gets called when the song changes
95
118
  * @param callback {function(MidiData)}
@@ -108,32 +131,36 @@ export class Sequencer {
108
131
  * @param id {string} must be unique
109
132
  */
110
133
  addOnTimeChangeEvent(callback: (arg0: number) => any, id: string): void;
134
+ resetMIDIOut(): void;
111
135
  /**
112
- * @returns {Promise<MIDI>}
113
- */
114
- getMIDI(): Promise<MIDI>;
115
- /**
116
- * @param midiBuffers {MIDIFile[]}
136
+ * @param messageType {WorkletSequencerMessageType}
137
+ * @param messageData {any}
138
+ * @private
117
139
  */
118
- loadNewSongList(midiBuffers: MIDIFile[]): void;
119
- songsAmount: number;
140
+ private _sendMessage;
120
141
  nextSong(): void;
121
142
  previousSong(): void;
122
- set currentTime(time: number);
123
143
  /**
124
- * @returns {number} Current playback time, in seconds
144
+ * @param {WorkletSequencerReturnMessageType} messageType
145
+ * @param {any} messageData
146
+ * @private
125
147
  */
126
- get currentTime(): number;
148
+ private _handleMessage;
149
+ pausedTime: number;
127
150
  /**
128
151
  * @param time
129
152
  * @private
130
153
  */
131
154
  private _recalculateStartTime;
132
155
  /**
133
- * Use for visualization as it's not affected by the audioContext stutter
134
- * @returns {number}
156
+ * @returns {Promise<MIDI>}
135
157
  */
136
- get currentHighResolutionTime(): number;
158
+ getMIDI(): Promise<MIDI>;
159
+ /**
160
+ * @param midiBuffers {MIDIFile[]}
161
+ */
162
+ loadNewSongList(midiBuffers: MIDIFile[]): void;
163
+ songsAmount: number;
137
164
  /**
138
165
  * @param output {MIDIOutput}
139
166
  */
@@ -144,11 +171,6 @@ export class Sequencer {
144
171
  */
145
172
  pause(): void;
146
173
  unpause(): void;
147
- /**
148
- * true if paused, false if playing or stopped
149
- * @returns {boolean}
150
- */
151
- get paused(): boolean;
152
174
  /**
153
175
  * Starts the playback
154
176
  * @param resetTime {boolean} If true, time is set to 0s
@@ -158,28 +180,6 @@ export class Sequencer {
158
180
  * Stops the playback
159
181
  */
160
182
  stop(): void;
161
- /**
162
- * @type {Object<string, function(MidiData)>}
163
- * @private
164
- */
165
- private onSongChange;
166
- /**
167
- * Fires on text event
168
- * @param data {Uint8Array} the data text
169
- * @param type {number} the status byte of the message (the meta status byte)
170
- */
171
- onTextEvent: any;
172
- /**
173
- * Fires when CurrentTime changes
174
- * @type {Object<string, function(number)>} the time that was changed to
175
- * @private
176
- */
177
- private onTimeChange;
178
- /**
179
- * @type {Object<string, function>}
180
- * @private
181
- */
182
- private onSongEnded;
183
183
  }
184
184
  /**
185
185
  * {Object}
@@ -201,6 +201,6 @@ export type SequencerOptions = {
201
201
  */
202
202
  skipToFirstNoteOn: boolean;
203
203
  };
204
- import { Synthetizer } from '../synthetizer/synthetizer.js';
205
- import { MidiData } from '../midi_parser/midi_data.js';
206
- import { MIDI } from '../midi_parser/midi_loader.js';
204
+ import { MidiData } from "../midi_parser/midi_data.js";
205
+ import { Synthetizer } from "../synthetizer/synthetizer.js";
206
+ import { MIDI } from "../midi_parser/midi_loader.js";
@@ -10,12 +10,12 @@ export class BasicInstrument {
10
10
  */
11
11
  instrumentZones: BasicInstrumentZone[];
12
12
  _useCount: number;
13
- addUseCount(): void;
14
- removeUseCount(): void;
15
13
  /**
16
14
  * @returns {number}
17
15
  */
18
16
  get useCount(): number;
17
+ addUseCount(): void;
18
+ removeUseCount(): void;
19
19
  deleteInstrument(): void;
20
20
  /**
21
21
  * @param index {number}
@@ -83,4 +83,4 @@ export type SampleAndGenerators = {
83
83
  sample: BasicSample;
84
84
  sampleID: number;
85
85
  };
86
- import { Modulator } from '../read_sf2/modulators.js';
86
+ import { Modulator } from "./modulator.js";
@@ -47,14 +47,19 @@ export class BasicSoundFont {
47
47
  * @param instrument {BasicInstrument}
48
48
  */
49
49
  deleteInstrument(instrument: BasicInstrument): void;
50
+ /**
51
+ * @param preset {BasicPreset}
52
+ */
53
+ deletePreset(preset: BasicPreset): void;
50
54
  /**
51
55
  * @param sample {BasicSample}
52
56
  */
53
57
  deleteSample(sample: BasicSample): void;
54
58
  /**
55
- * @param preset {BasicPreset}
59
+ * To avoid overlapping on multiple desfonts
60
+ * @param offset {number}
56
61
  */
57
- deletePreset(preset: BasicPreset): void;
62
+ setSampleIDOffset(offset: number): void;
58
63
  /**
59
64
  * Get the appropriate preset, undefined if not foun d
60
65
  * @param bankNr {number}
@@ -63,11 +68,6 @@ export class BasicSoundFont {
63
68
  * @return {BasicPreset}
64
69
  */
65
70
  getPresetNoFallback(bankNr: number, programNr: number, fallbackToProgram?: boolean): BasicPreset;
66
- /**
67
- * To avoid overlapping on multiple desfonts
68
- * @param offset {number}
69
- */
70
- setSampleIDOffset(offset: number): void;
71
71
  /**
72
72
  * Get the appropriate preset
73
73
  * @param bankNr {number}
@@ -83,5 +83,5 @@ export class BasicSoundFont {
83
83
  getPresetByName(presetName: string): BasicPreset;
84
84
  write: typeof write;
85
85
  }
86
- import { Modulator } from '../read_sf2/modulators.js';
87
- import { write } from './write_sf2/write.js';
86
+ import { Modulator } from "./modulator.js";
87
+ import { write } from "./write_sf2/write.js";
@@ -19,4 +19,4 @@ export class BasicPresetZone extends BasicZone {
19
19
  instrument: BasicInstrument | undefined;
20
20
  deleteZone(): void;
21
21
  }
22
- import { BasicZone } from './basic_zone.js';
22
+ import { BasicZone } from "./basic_zone.js";
@@ -0,0 +1,101 @@
1
+ /**
2
+ * generator.js
3
+ * purpose: contains enums for generators and their limis parses reads soundfont generators, sums them and applies limits
4
+ */
5
+ /**
6
+ * @param generatorType {number}
7
+ * @param presetGens {Generator[]}
8
+ * @param instrumentGens {Generator[]}
9
+ */
10
+ export function addAndClampGenerator(generatorType: number, presetGens: Generator[], instrumentGens: Generator[]): number;
11
+ export type generatorTypes = number;
12
+ export namespace generatorTypes {
13
+ let INVALID: number;
14
+ let startAddrsOffset: number;
15
+ let endAddrOffset: number;
16
+ let startloopAddrsOffset: number;
17
+ let endloopAddrsOffset: number;
18
+ let startAddrsCoarseOffset: number;
19
+ let modLfoToPitch: number;
20
+ let vibLfoToPitch: number;
21
+ let modEnvToPitch: number;
22
+ let initialFilterFc: number;
23
+ let initialFilterQ: number;
24
+ let modLfoToFilterFc: number;
25
+ let modEnvToFilterFc: number;
26
+ let endAddrsCoarseOffset: number;
27
+ let modLfoToVolume: number;
28
+ let unused1: number;
29
+ let chorusEffectsSend: number;
30
+ let reverbEffectsSend: number;
31
+ let pan: number;
32
+ let unused2: number;
33
+ let unused3: number;
34
+ let unused4: number;
35
+ let delayModLFO: number;
36
+ let freqModLFO: number;
37
+ let delayVibLFO: number;
38
+ let freqVibLFO: number;
39
+ let delayModEnv: number;
40
+ let attackModEnv: number;
41
+ let holdModEnv: number;
42
+ let decayModEnv: number;
43
+ let sustainModEnv: number;
44
+ let releaseModEnv: number;
45
+ let keyNumToModEnvHold: number;
46
+ let keyNumToModEnvDecay: number;
47
+ let delayVolEnv: number;
48
+ let attackVolEnv: number;
49
+ let holdVolEnv: number;
50
+ let decayVolEnv: number;
51
+ let sustainVolEnv: number;
52
+ let releaseVolEnv: number;
53
+ let keyNumToVolEnvHold: number;
54
+ let keyNumToVolEnvDecay: number;
55
+ let instrument: number;
56
+ let reserved1: number;
57
+ let keyRange: number;
58
+ let velRange: number;
59
+ let startloopAddrsCoarseOffset: number;
60
+ let keyNum: number;
61
+ let velocity: number;
62
+ let initialAttenuation: number;
63
+ let reserved2: number;
64
+ let endloopAddrsCoarseOffset: number;
65
+ let coarseTune: number;
66
+ let fineTune: number;
67
+ let sampleID: number;
68
+ let sampleModes: number;
69
+ let reserved3: number;
70
+ let scaleTuning: number;
71
+ let exclusiveClass: number;
72
+ let overridingRootKey: number;
73
+ let unused5: number;
74
+ let endOper: number;
75
+ }
76
+ /**
77
+ * @type {{min: number, max: number, def: number}[]}
78
+ */
79
+ export const generatorLimits: {
80
+ min: number;
81
+ max: number;
82
+ def: number;
83
+ }[];
84
+ export class Generator {
85
+ /**
86
+ * Constructs a new generator
87
+ * @param type {generatorTypes|number}
88
+ * @param value {number}
89
+ */
90
+ constructor(type?: generatorTypes | number, value?: number);
91
+ /**
92
+ * The generator's enum number
93
+ * @type {generatorTypes|number}
94
+ */
95
+ generatorType: generatorTypes | number;
96
+ /**
97
+ * The generator's 16-bit value
98
+ * @type {number}
99
+ */
100
+ generatorValue: number;
101
+ }
@@ -0,0 +1,79 @@
1
+ export function getModSourceEnum(curveType: any, polarity: any, direction: any, isCC: any, index: any): number;
2
+ export namespace modulatorSources {
3
+ let noController: number;
4
+ let noteOnVelocity: number;
5
+ let noteOnKeyNum: number;
6
+ let polyPressure: number;
7
+ let channelPressure: number;
8
+ let pitchWheel: number;
9
+ let pitchWheelRange: number;
10
+ let link: number;
11
+ }
12
+ export namespace modulatorCurveTypes {
13
+ export let linear: number;
14
+ export let concave: number;
15
+ export let convex: number;
16
+ let _switch: number;
17
+ export { _switch as switch };
18
+ }
19
+ export class Modulator {
20
+ /**
21
+ * @param modulator {Modulator}
22
+ * @returns {Modulator}
23
+ */
24
+ static copy(modulator: Modulator): Modulator;
25
+ /**
26
+ * @param mod1 {Modulator}
27
+ * @param mod2 {Modulator}
28
+ * @returns {boolean}
29
+ */
30
+ static isIdentical(mod1: Modulator, mod2: Modulator): boolean;
31
+ /**
32
+ * Creates a modulator
33
+ * @param params {{srcEnum: number, secSrcEnum: number, dest: generatorTypes, amt: number, transform: number}}
34
+ */
35
+ constructor(params: {
36
+ srcEnum: number;
37
+ secSrcEnum: number;
38
+ dest: generatorTypes;
39
+ amt: number;
40
+ transform: number;
41
+ });
42
+ /**
43
+ * The current computed value of this modulator
44
+ * @type {number}
45
+ */
46
+ currentValue: number;
47
+ sourceEnum: number;
48
+ /**
49
+ * @type {generatorTypes}
50
+ */
51
+ modulatorDestination: generatorTypes;
52
+ secondarySourceEnum: number;
53
+ transformAmount: number;
54
+ transformType: number;
55
+ sourcePolarity: number;
56
+ sourceDirection: number;
57
+ sourceUsesCC: number;
58
+ sourceIndex: number;
59
+ sourceCurveType: number;
60
+ secSrcPolarity: number;
61
+ secSrcDirection: number;
62
+ secSrcUsesCC: number;
63
+ secSrcIndex: number;
64
+ secSrcCurveType: number;
65
+ /**
66
+ * Sums transform and creates a NEW modulator
67
+ * @param modulator {Modulator}
68
+ * @returns {Modulator}
69
+ */
70
+ sumTransform(modulator: Modulator): Modulator;
71
+ /**
72
+ * @returns {string}
73
+ */
74
+ debugString(): string;
75
+ }
76
+ export const DEFAULT_ATTENUATION_MOD_AMOUNT: 960;
77
+ export const DEFAULT_ATTENUATION_MOD_CURVE_TYPE: number;
78
+ export const defaultModulators: Modulator[];
79
+ import { generatorTypes } from "./generator.js";
@@ -41,4 +41,4 @@ export class RiffChunk {
41
41
  size: number;
42
42
  chunkData: IndexedByteArray;
43
43
  }
44
- import { IndexedByteArray } from '../../utils/indexed_array.js';
44
+ import { IndexedByteArray } from "../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getIBAG(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getIGEN(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getIMOD(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getINST(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getPBAG(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getPGEN(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getPHDR(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -3,4 +3,4 @@
3
3
  * @returns {IndexedByteArray}
4
4
  */
5
5
  export function getPMOD(this: BasicSoundFont): IndexedByteArray;
6
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
6
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -8,4 +8,4 @@
8
8
  * @returns {IndexedByteArray}
9
9
  */
10
10
  export function getSDTA(this: BasicSoundFont, smplStartOffsets: number[], smplEndOffsets: number[], compress: boolean, quality: number, vorbisFunc: EncodeVorbisFunction): IndexedByteArray;
11
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
11
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -5,4 +5,4 @@
5
5
  * @returns {IndexedByteArray}
6
6
  */
7
7
  export function getSHDR(this: BasicSoundFont, smplStartOffsets: number[], smplEndOffsets: number[]): IndexedByteArray;
8
- import { IndexedByteArray } from '../../../utils/indexed_array.js';
8
+ import { IndexedByteArray } from "../../../utils/indexed_array.js";
@@ -7,4 +7,4 @@
7
7
  * @returns {Modulator|undefined}
8
8
  */
9
9
  export function getSF2ModulatorFromArticulator(source: number, control: number, destination: number, transform: number, value: number): Modulator | undefined;
10
- import { Modulator } from '../read_sf2/modulators.js';
10
+ import { Modulator } from "../basic_soundfont/modulator.js";
@@ -8,6 +8,6 @@ export class DLSPreset extends BasicPreset {
8
8
  DLSInstrument: BasicInstrument;
9
9
  presetZones: BasicPresetZone[];
10
10
  }
11
- import { BasicPreset } from '../basic_soundfont/basic_preset.js';
12
- import { BasicInstrument } from '../basic_soundfont/basic_instrument.js';
13
- import { BasicPresetZone } from '../basic_soundfont/basic_zones.js';
11
+ import { BasicPreset } from "../basic_soundfont/basic_preset.js";
12
+ import { BasicInstrument } from "../basic_soundfont/basic_instrument.js";
13
+ import { BasicPresetZone } from "../basic_soundfont/basic_zones.js";
@@ -10,15 +10,15 @@ export class DLSSample extends BasicSample {
10
10
  * @param sampleDbAttenuation {number} in db
11
11
  */
12
12
  constructor(name: string, rate: number, pitch: number, pitchCorrection: number, loopStart: number, loopEnd: number, data: Float32Array, sampleDbAttenuation: number);
13
- /**
14
- * @type {Float32Array}
15
- */
16
- sampleData: Float32Array;
17
13
  /**
18
14
  * in decibels of attenuation, WITHOUT EMU CORRECTION
19
15
  * @type {number}
20
16
  */
21
17
  sampleDbAttenuation: number;
18
+ /**
19
+ * @type {Float32Array}
20
+ */
21
+ sampleData: Float32Array;
22
22
  getRawData(): Uint8Array;
23
23
  }
24
- import { BasicSample } from '../basic_soundfont/basic_sample.js';
24
+ import { BasicSample } from "../basic_soundfont/basic_sample.js";