spessasynth_core 3.27.7 → 4.0.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 (157) hide show
  1. package/README.md +188 -116
  2. package/dist/index.d.ts +4057 -0
  3. package/dist/index.js +17188 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +23 -6
  6. package/index.js +0 -132
  7. package/src/externals/README.md +0 -6
  8. package/src/externals/fflate/LICENSE +0 -21
  9. package/src/externals/fflate/fflate.min.js +0 -1
  10. package/src/externals/stbvorbis_sync/@types/stbvorbis_sync.d.ts +0 -12
  11. package/src/externals/stbvorbis_sync/LICENSE +0 -202
  12. package/src/externals/stbvorbis_sync/NOTICE +0 -6
  13. package/src/externals/stbvorbis_sync/stbvorbis_sync.min.js +0 -1
  14. package/src/midi/README.md +0 -32
  15. package/src/midi/basic_midi.js +0 -587
  16. package/src/midi/midi_builder.js +0 -203
  17. package/src/midi/midi_loader.js +0 -321
  18. package/src/midi/midi_message.js +0 -254
  19. package/src/midi/midi_sequence.js +0 -230
  20. package/src/midi/midi_tools/get_note_times.js +0 -154
  21. package/src/midi/midi_tools/midi_editor.js +0 -611
  22. package/src/midi/midi_tools/midi_writer.js +0 -105
  23. package/src/midi/midi_tools/rmidi_writer.js +0 -566
  24. package/src/midi/midi_tools/used_keys_loaded.js +0 -256
  25. package/src/midi/xmf_loader.js +0 -454
  26. package/src/sequencer/README.md +0 -9
  27. package/src/sequencer/events.js +0 -81
  28. package/src/sequencer/play.js +0 -362
  29. package/src/sequencer/process_event.js +0 -165
  30. package/src/sequencer/process_tick.js +0 -104
  31. package/src/sequencer/sequencer_engine.js +0 -372
  32. package/src/sequencer/song_control.js +0 -196
  33. package/src/soundfont/README.md +0 -11
  34. package/src/soundfont/basic_soundfont/basic_global_zone.js +0 -6
  35. package/src/soundfont/basic_soundfont/basic_instrument.js +0 -115
  36. package/src/soundfont/basic_soundfont/basic_instrument_zone.js +0 -45
  37. package/src/soundfont/basic_soundfont/basic_preset.js +0 -313
  38. package/src/soundfont/basic_soundfont/basic_preset_zone.js +0 -39
  39. package/src/soundfont/basic_soundfont/basic_sample.js +0 -477
  40. package/src/soundfont/basic_soundfont/basic_soundbank.js +0 -740
  41. package/src/soundfont/basic_soundfont/basic_zone.js +0 -145
  42. package/src/soundfont/basic_soundfont/generator.js +0 -76
  43. package/src/soundfont/basic_soundfont/generator_types.js +0 -151
  44. package/src/soundfont/basic_soundfont/modulator.js +0 -581
  45. package/src/soundfont/basic_soundfont/riff_chunk.js +0 -195
  46. package/src/soundfont/basic_soundfont/write_dls/art2.js +0 -174
  47. package/src/soundfont/basic_soundfont/write_dls/articulator.js +0 -49
  48. package/src/soundfont/basic_soundfont/write_dls/combine_zones.js +0 -374
  49. package/src/soundfont/basic_soundfont/write_dls/ins.js +0 -85
  50. package/src/soundfont/basic_soundfont/write_dls/lins.js +0 -15
  51. package/src/soundfont/basic_soundfont/write_dls/modulator_converter.js +0 -330
  52. package/src/soundfont/basic_soundfont/write_dls/rgn2.js +0 -120
  53. package/src/soundfont/basic_soundfont/write_dls/wave.js +0 -71
  54. package/src/soundfont/basic_soundfont/write_dls/write_dls.js +0 -124
  55. package/src/soundfont/basic_soundfont/write_dls/wsmp.js +0 -78
  56. package/src/soundfont/basic_soundfont/write_dls/wvpl.js +0 -35
  57. package/src/soundfont/basic_soundfont/write_sf2/ibag.js +0 -60
  58. package/src/soundfont/basic_soundfont/write_sf2/igen.js +0 -91
  59. package/src/soundfont/basic_soundfont/write_sf2/imod.js +0 -62
  60. package/src/soundfont/basic_soundfont/write_sf2/inst.js +0 -42
  61. package/src/soundfont/basic_soundfont/write_sf2/pbag.js +0 -57
  62. package/src/soundfont/basic_soundfont/write_sf2/pgen.js +0 -92
  63. package/src/soundfont/basic_soundfont/write_sf2/phdr.js +0 -61
  64. package/src/soundfont/basic_soundfont/write_sf2/pmod.js +0 -62
  65. package/src/soundfont/basic_soundfont/write_sf2/sdta.js +0 -131
  66. package/src/soundfont/basic_soundfont/write_sf2/shdr.js +0 -77
  67. package/src/soundfont/basic_soundfont/write_sf2/write.js +0 -287
  68. package/src/soundfont/dls/articulator_converter.js +0 -402
  69. package/src/soundfont/dls/dls_destinations.js +0 -38
  70. package/src/soundfont/dls/dls_instrument.js +0 -20
  71. package/src/soundfont/dls/dls_preset.js +0 -43
  72. package/src/soundfont/dls/dls_sample.js +0 -238
  73. package/src/soundfont/dls/dls_soundfont.js +0 -183
  74. package/src/soundfont/dls/dls_sources.js +0 -63
  75. package/src/soundfont/dls/dls_zone.js +0 -89
  76. package/src/soundfont/dls/read_articulation.js +0 -300
  77. package/src/soundfont/dls/read_instrument.js +0 -118
  78. package/src/soundfont/dls/read_instrument_list.js +0 -17
  79. package/src/soundfont/dls/read_lart.js +0 -35
  80. package/src/soundfont/dls/read_region.js +0 -157
  81. package/src/soundfont/dls/read_samples.js +0 -154
  82. package/src/soundfont/load_soundfont.js +0 -21
  83. package/src/soundfont/read_sf2/generators.js +0 -43
  84. package/src/soundfont/read_sf2/instrument_zones.js +0 -75
  85. package/src/soundfont/read_sf2/instruments.js +0 -71
  86. package/src/soundfont/read_sf2/modulators.js +0 -25
  87. package/src/soundfont/read_sf2/preset_zones.js +0 -79
  88. package/src/soundfont/read_sf2/presets.js +0 -80
  89. package/src/soundfont/read_sf2/samples.js +0 -317
  90. package/src/soundfont/read_sf2/soundfont.js +0 -452
  91. package/src/soundfont/read_sf2/zones.js +0 -28
  92. package/src/synthetizer/README.md +0 -7
  93. package/src/synthetizer/audio_engine/README.md +0 -9
  94. package/src/synthetizer/audio_engine/engine_components/compute_modulator.js +0 -289
  95. package/src/synthetizer/audio_engine/engine_components/controller_tables.js +0 -90
  96. package/src/synthetizer/audio_engine/engine_components/dynamic_modulator_system.js +0 -95
  97. package/src/synthetizer/audio_engine/engine_components/enums.js +0 -18
  98. package/src/synthetizer/audio_engine/engine_components/key_modifier_manager.js +0 -151
  99. package/src/synthetizer/audio_engine/engine_components/lfo.js +0 -26
  100. package/src/synthetizer/audio_engine/engine_components/lowpass_filter.js +0 -282
  101. package/src/synthetizer/audio_engine/engine_components/midi_audio_channel.js +0 -551
  102. package/src/synthetizer/audio_engine/engine_components/modulation_envelope.js +0 -181
  103. package/src/synthetizer/audio_engine/engine_components/modulator_curves.js +0 -89
  104. package/src/synthetizer/audio_engine/engine_components/soundfont_manager.js +0 -265
  105. package/src/synthetizer/audio_engine/engine_components/stereo_panner.js +0 -124
  106. package/src/synthetizer/audio_engine/engine_components/unit_converter.js +0 -73
  107. package/src/synthetizer/audio_engine/engine_components/voice.js +0 -525
  108. package/src/synthetizer/audio_engine/engine_components/volume_envelope.js +0 -402
  109. package/src/synthetizer/audio_engine/engine_components/wavetable_oscillator.js +0 -274
  110. package/src/synthetizer/audio_engine/engine_methods/controller_control/controller_change.js +0 -159
  111. package/src/synthetizer/audio_engine/engine_methods/controller_control/master_parameters.js +0 -48
  112. package/src/synthetizer/audio_engine/engine_methods/controller_control/reset_controllers.js +0 -254
  113. package/src/synthetizer/audio_engine/engine_methods/create_midi_channel.js +0 -20
  114. package/src/synthetizer/audio_engine/engine_methods/data_entry/awe32.js +0 -198
  115. package/src/synthetizer/audio_engine/engine_methods/data_entry/data_entry_coarse.js +0 -281
  116. package/src/synthetizer/audio_engine/engine_methods/data_entry/data_entry_fine.js +0 -109
  117. package/src/synthetizer/audio_engine/engine_methods/mute_channel.js +0 -17
  118. package/src/synthetizer/audio_engine/engine_methods/note_on.js +0 -214
  119. package/src/synthetizer/audio_engine/engine_methods/portamento_time.js +0 -92
  120. package/src/synthetizer/audio_engine/engine_methods/program_change.js +0 -35
  121. package/src/synthetizer/audio_engine/engine_methods/render_voice.js +0 -214
  122. package/src/synthetizer/audio_engine/engine_methods/soundfont_management/embedded_sound_bank.js +0 -42
  123. package/src/synthetizer/audio_engine/engine_methods/soundfont_management/get_preset.js +0 -0
  124. package/src/synthetizer/audio_engine/engine_methods/soundfont_management/update_preset_list.js +0 -19
  125. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/kill_note.js +0 -23
  126. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/note_off.js +0 -56
  127. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/stop_all_channels.js +0 -16
  128. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/stop_all_notes.js +0 -30
  129. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/voice_killing.js +0 -63
  130. package/src/synthetizer/audio_engine/engine_methods/system_exclusive.js +0 -1058
  131. package/src/synthetizer/audio_engine/engine_methods/tuning_control/channel_pressure.js +0 -23
  132. package/src/synthetizer/audio_engine/engine_methods/tuning_control/pitch_wheel.js +0 -31
  133. package/src/synthetizer/audio_engine/engine_methods/tuning_control/poly_pressure.js +0 -29
  134. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_master_tuning.js +0 -15
  135. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_modulation_depth.js +0 -27
  136. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_octave_tuning.js +0 -19
  137. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_tuning.js +0 -27
  138. package/src/synthetizer/audio_engine/engine_methods/tuning_control/transpose_all_channels.js +0 -15
  139. package/src/synthetizer/audio_engine/engine_methods/tuning_control/transpose_channel.js +0 -34
  140. package/src/synthetizer/audio_engine/main_processor.js +0 -813
  141. package/src/synthetizer/audio_engine/snapshot/apply_synthesizer_snapshot.js +0 -16
  142. package/src/synthetizer/audio_engine/snapshot/channel_snapshot.js +0 -175
  143. package/src/synthetizer/audio_engine/snapshot/synthesizer_snapshot.js +0 -116
  144. package/src/synthetizer/audio_engine/synth_processor_options.js +0 -18
  145. package/src/synthetizer/synth_constants.js +0 -26
  146. package/src/utils/README.md +0 -8
  147. package/src/utils/buffer_to_wav.js +0 -197
  148. package/src/utils/byte_functions/big_endian.js +0 -32
  149. package/src/utils/byte_functions/little_endian.js +0 -77
  150. package/src/utils/byte_functions/string.js +0 -92
  151. package/src/utils/byte_functions/variable_length_quantity.js +0 -42
  152. package/src/utils/fill_with_defaults.js +0 -21
  153. package/src/utils/indexed_array.js +0 -34
  154. package/src/utils/loggin.js +0 -71
  155. package/src/utils/other.js +0 -92
  156. package/src/utils/sysex_detector.js +0 -58
  157. package/src/utils/xg_hacks.js +0 -193
@@ -1,195 +0,0 @@
1
- import { IndexedByteArray } from "../../utils/indexed_array.js";
2
- import { readLittleEndian, writeDword } from "../../utils/byte_functions/little_endian.js";
3
- import { readBytesAsString, writeStringAsBytes } from "../../utils/byte_functions/string.js";
4
-
5
- /**
6
- * riff_chunk.js
7
- * reads a riff chunk and stores it as a class
8
- */
9
-
10
- export class RiffChunk
11
- {
12
- /**
13
- * The chunks FourCC code
14
- * @type {string}
15
- */
16
- header;
17
-
18
- /**
19
- * Chunk's size, in bytes
20
- * @type {number}
21
- */
22
- size;
23
-
24
- /**
25
- * Chunk's binary data
26
- * @type {IndexedByteArray}
27
- */
28
- chunkData;
29
-
30
- /**
31
- * Creates a new RIFF chunk
32
- * @constructor
33
- * @param header {string}
34
- * @param size {number}
35
- * @param data {IndexedByteArray}
36
- */
37
- constructor(header, size, data)
38
- {
39
- this.header = header;
40
- this.size = size;
41
- this.chunkData = data;
42
- }
43
-
44
- }
45
-
46
- /**
47
- * @param dataArray {IndexedByteArray}
48
- * @param readData {boolean}
49
- * @param forceShift {boolean}
50
- * @returns {RiffChunk}
51
- */
52
- export function readRIFFChunk(dataArray, readData = true, forceShift = false)
53
- {
54
- let header = readBytesAsString(dataArray, 4);
55
-
56
- let size = readLittleEndian(dataArray, 4);
57
- if (header === "")
58
- {
59
- // safeguard against evil DLS files
60
- // The test case: CrysDLS v1.23.dls
61
- // https://github.com/spessasus/spessasynth_core/issues/5
62
- size = 0;
63
- }
64
- /**
65
- * @type {IndexedByteArray}
66
- */
67
- let chunkData = undefined;
68
- if (readData)
69
- {
70
- chunkData = dataArray.slice(dataArray.currentIndex, dataArray.currentIndex + size);
71
- }
72
- if (readData || forceShift)
73
- {
74
- dataArray.currentIndex += size;
75
- }
76
-
77
- if (size % 2 !== 0)
78
- {
79
- if (dataArray[dataArray.currentIndex] === 0)
80
- {
81
- dataArray.currentIndex++;
82
- }
83
- }
84
-
85
- return new RiffChunk(header, size, chunkData);
86
- }
87
-
88
- /**
89
- * Writes a RIFF chunk correctly
90
- * @param header {string} fourCC
91
- * @param data {Uint8Array} chunk data
92
- * @param addZeroByte {boolean} add a zero byte into the chunk size
93
- * @param isList {boolean} adds "LIST" as the chunk type and writes the actual type at the start of the data
94
- * @returns {IndexedByteArray}
95
- */
96
- export function writeRIFFChunkRaw(header, data, addZeroByte = false, isList = false)
97
- {
98
- let dataStartOffset = 8;
99
- let headerWritten = header;
100
- let dataLength = data.length;
101
- if (addZeroByte)
102
- {
103
- dataLength++;
104
- }
105
- let writtenSize = dataLength;
106
- if (isList)
107
- {
108
- // written header is LIST and the passed header is the first 4 bytes of chunk data
109
- dataStartOffset += 4;
110
- writtenSize += 4;
111
- headerWritten = "LIST";
112
- }
113
- let finalSize = dataStartOffset + dataLength;
114
- if (finalSize % 2 !== 0)
115
- {
116
- // pad byte does not get included in the size
117
- finalSize++;
118
- }
119
-
120
- const outArray = new IndexedByteArray(finalSize);
121
- // FourCC ("RIFF", "LIST", "pdta" etc.)
122
- writeStringAsBytes(outArray, headerWritten);
123
- // chunk size
124
- writeDword(outArray, writtenSize);
125
- if (isList)
126
- {
127
- // list type (e.g. "INFO")
128
- writeStringAsBytes(outArray, header);
129
- }
130
- outArray.set(data, dataStartOffset);
131
- return outArray;
132
- }
133
-
134
- /**
135
- * Writes RIFF chunk given binary blobs
136
- * @param header {string} fourCC
137
- * @param chunks {Uint8Array[]} chunk data parts, it will be combined in order
138
- * @param isList {boolean} adds "LIST" as the chunk type and writes the actual type at the start of the data
139
- * @returns {IndexedByteArray}
140
- */
141
- export function writeRIFFChunkParts(header, chunks, isList = false)
142
- {
143
- let dataOffset = 8;
144
- let headerWritten = header;
145
- let dataLength = chunks.reduce((len, c) => c.length + len, 0);
146
- let writtenSize = dataLength;
147
- if (isList)
148
- {
149
- // written header is LIST and the passed header is the first 4 bytes of chunk data
150
- dataOffset += 4;
151
- writtenSize += 4;
152
- headerWritten = "LIST";
153
- }
154
- let finalSize = dataOffset + dataLength;
155
- if (finalSize % 2 !== 0)
156
- {
157
- // pad byte does not get included in the size
158
- finalSize++;
159
- }
160
-
161
- const outArray = new IndexedByteArray(finalSize);
162
- // fourCC ("RIFF", "LIST", "pdta" etc.)
163
- writeStringAsBytes(outArray, headerWritten);
164
- // chunk size
165
- writeDword(outArray, writtenSize);
166
- if (isList)
167
- {
168
- // list type (e.g. "INFO")
169
- writeStringAsBytes(outArray, header);
170
- }
171
- chunks.forEach(c =>
172
- {
173
- outArray.set(c, dataOffset);
174
- dataOffset += c.length;
175
- });
176
- return outArray;
177
- }
178
-
179
- /**
180
- * @param collection {RiffChunk[]}
181
- * @param type {string}
182
- * @returns {RiffChunk|undefined}
183
- */
184
- export function findRIFFListType(collection, type)
185
- {
186
- return collection.find(c =>
187
- {
188
- if (c.header !== "LIST")
189
- {
190
- return false;
191
- }
192
- c.chunkData.currentIndex = 0;
193
- return readBytesAsString(c.chunkData, 4) === type;
194
- });
195
- }
@@ -1,174 +0,0 @@
1
- import { getDLSArticulatorFromSf2Generator, getDLSArticulatorFromSf2Modulator } from "./modulator_converter.js";
2
- import { writeRIFFChunkParts } from "../riff_chunk.js";
3
- import { IndexedByteArray } from "../../../utils/indexed_array.js";
4
- import { Generator } from "../generator.js";
5
- import { writeDword } from "../../../utils/byte_functions/little_endian.js";
6
- import { consoleColors } from "../../../utils/other.js";
7
- import { SpessaSynthInfo, SpessaSynthWarn } from "../../../utils/loggin.js";
8
- import { Modulator } from "../modulator.js";
9
- import {
10
- DEFAULT_DLS_CHORUS,
11
- DEFAULT_DLS_REVERB,
12
- DLS_1_NO_VIBRATO_MOD,
13
- DLS_1_NO_VIBRATO_PRESSURE
14
- } from "../../dls/dls_sources.js";
15
- import { generatorTypes } from "../generator_types.js";
16
-
17
- const invalidGeneratorTypes = new Set([
18
- generatorTypes.sampleModes,
19
- generatorTypes.initialAttenuation,
20
- generatorTypes.keyRange,
21
- generatorTypes.velRange,
22
- generatorTypes.sampleID,
23
- generatorTypes.fineTune,
24
- generatorTypes.coarseTune,
25
- generatorTypes.startAddrsOffset,
26
- generatorTypes.startAddrsCoarseOffset,
27
- generatorTypes.endAddrOffset,
28
- generatorTypes.endAddrsCoarseOffset,
29
- generatorTypes.startloopAddrsOffset,
30
- generatorTypes.startloopAddrsCoarseOffset,
31
- generatorTypes.endloopAddrsOffset,
32
- generatorTypes.endloopAddrsCoarseOffset,
33
- generatorTypes.overridingRootKey,
34
- generatorTypes.exclusiveClass
35
- ]);
36
-
37
- /**
38
- * @param zone {BasicZone}
39
- * @returns {IndexedByteArray}
40
- */
41
- export function writeArticulator(zone)
42
- {
43
-
44
-
45
- // envelope generators are limited to 40 seconds
46
- // in timecents, this is 1200 * log2(10) = 6386
47
-
48
- for (let i = 0; i < zone.generators.length; i++)
49
- {
50
- const g = zone.generators[i];
51
- if (
52
- g.generatorType === generatorTypes.delayVolEnv ||
53
- g.generatorType === generatorTypes.attackVolEnv ||
54
- g.generatorType === generatorTypes.holdVolEnv ||
55
- g.generatorType === generatorTypes.decayVolEnv ||
56
- g.generatorType === generatorTypes.releaseVolEnv ||
57
- g.generatorType === generatorTypes.delayModEnv ||
58
- g.generatorType === generatorTypes.attackModEnv ||
59
- g.generatorType === generatorTypes.holdModEnv ||
60
- g.generatorType === generatorTypes.decayModEnv
61
- )
62
- {
63
- zone.generators[i] = new Generator(g.generatorType, Math.min(g.generatorValue, 6386), false);
64
- }
65
- }
66
-
67
-
68
- // read_articulation.js:
69
- // according to viena and another strange (with modulators) rendition of gm.dls in sf2,
70
- // it shall be divided by -128,
71
- // and a strange correction needs to be applied to the real value:
72
- // real + (60 / 128) * scale
73
- // we invert this here
74
- for (let i = 0; i < zone.generators.length; i++)
75
- {
76
- const relativeGenerator = zone.generators[i];
77
- let absoluteCounterpart = undefined;
78
- switch (relativeGenerator.generatorType)
79
- {
80
- default:
81
- continue;
82
-
83
- case generatorTypes.keyNumToVolEnvDecay:
84
- absoluteCounterpart = generatorTypes.decayVolEnv;
85
- break;
86
- case generatorTypes.keyNumToVolEnvHold:
87
- absoluteCounterpart = generatorTypes.holdVolEnv;
88
- break;
89
- case generatorTypes.keyNumToModEnvDecay:
90
- absoluteCounterpart = generatorTypes.decayModEnv;
91
- break;
92
- case generatorTypes.keyNumToModEnvHold:
93
- absoluteCounterpart = generatorTypes.holdModEnv;
94
- }
95
- let absoluteGenerator = zone.generators.find(g => g.generatorType === absoluteCounterpart);
96
- if (absoluteGenerator === undefined)
97
- {
98
- // there's no absolute generator here.
99
- continue;
100
- }
101
- const dlsRelative = relativeGenerator.generatorValue * -128;
102
- const subtraction = (60 / 128) * dlsRelative;
103
- const newAbsolute = absoluteGenerator.generatorValue - subtraction;
104
-
105
- const iR = zone.generators.indexOf(relativeGenerator);
106
- const iA = zone.generators.indexOf(absoluteGenerator);
107
- zone.generators[iA] =
108
- new Generator(absoluteCounterpart, newAbsolute, false);
109
- zone.generators[iR] =
110
- new Generator(relativeGenerator.generatorType, dlsRelative, false);
111
- }
112
- /**
113
- * @type {Articulator[]}
114
- */
115
- const generators = zone.generators.reduce((arrs, g) =>
116
- {
117
- if (invalidGeneratorTypes.has(g.generatorType))
118
- {
119
- return arrs;
120
- }
121
- const art = getDLSArticulatorFromSf2Generator(g);
122
- if (art !== undefined)
123
- {
124
- arrs.push(art);
125
- SpessaSynthInfo("%cSucceeded converting to DLS Articulator!", consoleColors.recognized);
126
-
127
- }
128
- else
129
- {
130
- SpessaSynthWarn("Failed converting to DLS Articulator!");
131
- }
132
- return arrs;
133
- }, []);
134
- /**
135
- * @type {Articulator[]}
136
- */
137
- const modulators = zone.modulators.reduce((arrs, m) =>
138
- {
139
- // do not write the default DLS modulators
140
- if (
141
- Modulator.isIdentical(m, DEFAULT_DLS_CHORUS, true) ||
142
- Modulator.isIdentical(m, DEFAULT_DLS_REVERB, true) ||
143
- Modulator.isIdentical(m, DLS_1_NO_VIBRATO_MOD, true) ||
144
- Modulator.isIdentical(m, DLS_1_NO_VIBRATO_PRESSURE, true)
145
- )
146
- {
147
- return arrs;
148
- }
149
- const art = getDLSArticulatorFromSf2Modulator(m);
150
- if (art !== undefined)
151
- {
152
- arrs.push(art);
153
- SpessaSynthInfo("%cSucceeded converting to DLS Articulator!", consoleColors.recognized);
154
-
155
- }
156
- else
157
- {
158
- SpessaSynthWarn("Failed converting to DLS Articulator!");
159
- }
160
- return arrs;
161
- }, []);
162
- generators.push(...modulators);
163
-
164
- const art2Data = new IndexedByteArray(8);
165
- writeDword(art2Data, 8); // cbSize
166
- writeDword(art2Data, generators.length); // cbConnectionBlocks
167
-
168
-
169
- const out = generators.map(a => a.writeArticulator());
170
- return writeRIFFChunkParts(
171
- "art2",
172
- [art2Data, ...out]
173
- );
174
- }
@@ -1,49 +0,0 @@
1
- import { IndexedByteArray } from "../../../utils/indexed_array.js";
2
- import { writeDword, writeWord } from "../../../utils/byte_functions/little_endian.js";
3
-
4
- export class Articulator
5
- {
6
- /**
7
- * @type {DLSSources}
8
- */
9
- source;
10
- /**
11
- * @type {DLSSources}
12
- */
13
- control;
14
- /**
15
- * @type {DLSDestinations}
16
- */
17
- destination;
18
- /**
19
- * @type {number}
20
- */
21
- scale;
22
- /**
23
- * @type {number}
24
- */
25
- transform;
26
-
27
- constructor(source, control, destination, scale, transform)
28
- {
29
- this.source = source;
30
- this.control = control;
31
- this.destination = destination;
32
- this.scale = scale;
33
- this.transform = transform;
34
- }
35
-
36
- /**
37
- * @returns {IndexedByteArray}
38
- */
39
- writeArticulator()
40
- {
41
- const out = new IndexedByteArray(12);
42
- writeWord(out, this.source);
43
- writeWord(out, this.control);
44
- writeWord(out, this.destination);
45
- writeWord(out, this.transform);
46
- writeDword(out, this.scale << 16);
47
- return out;
48
- }
49
- }