spessasynth_lib 3.16.2 → 3.16.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.
Files changed (89) hide show
  1. package/@types/index.d.ts +2 -2
  2. package/@types/midi_parser/used_keys_loaded.d.ts +2 -2
  3. package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +29 -0
  4. package/@types/soundfont/basic_soundfont/basic_preset.d.ts +76 -0
  5. package/@types/soundfont/basic_soundfont/basic_sample.d.ts +82 -0
  6. package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +80 -0
  7. package/@types/soundfont/basic_soundfont/basic_zone.d.ts +42 -0
  8. package/@types/soundfont/basic_soundfont/basic_zones.d.ts +18 -0
  9. package/@types/soundfont/{read → basic_soundfont}/riff_chunk.d.ts +2 -1
  10. package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +6 -0
  11. package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +6 -0
  12. package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +6 -0
  13. package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +6 -0
  14. package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +6 -0
  15. package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +6 -0
  16. package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +6 -0
  17. package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +6 -0
  18. package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +11 -0
  19. package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +8 -0
  20. package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +6 -0
  21. package/@types/soundfont/{write → basic_soundfont/write_sf2}/write.d.ts +2 -2
  22. package/@types/soundfont/{read → read_sf2}/generators.d.ts +2 -1
  23. package/@types/soundfont/{read → read_sf2}/instruments.d.ts +3 -24
  24. package/@types/soundfont/read_sf2/presets.d.ts +28 -0
  25. package/@types/soundfont/read_sf2/samples.d.ts +56 -0
  26. package/@types/soundfont/{read → read_sf2}/zones.d.ts +11 -53
  27. package/@types/soundfont/soundfont.d.ts +6 -67
  28. package/index.js +2 -2
  29. package/midi_parser/midi_loader.js +1 -1
  30. package/midi_parser/rmidi_writer.js +11 -11
  31. package/midi_parser/used_keys_loaded.js +1 -1
  32. package/package.json +1 -1
  33. package/soundfont/basic_soundfont/basic_instrument.js +73 -0
  34. package/soundfont/{read/presets.js → basic_soundfont/basic_preset.js} +54 -87
  35. package/soundfont/basic_soundfont/basic_sample.js +132 -0
  36. package/soundfont/basic_soundfont/basic_soundfont.js +193 -0
  37. package/soundfont/basic_soundfont/basic_zone.js +39 -0
  38. package/soundfont/basic_soundfont/basic_zones.js +47 -0
  39. package/soundfont/{read → basic_soundfont}/riff_chunk.js +8 -1
  40. package/soundfont/{write → basic_soundfont/write_sf2}/ibag.js +4 -4
  41. package/soundfont/{write → basic_soundfont/write_sf2}/igen.js +5 -5
  42. package/soundfont/{write → basic_soundfont/write_sf2}/imod.js +4 -4
  43. package/soundfont/{write → basic_soundfont/write_sf2}/inst.js +5 -5
  44. package/soundfont/{write → basic_soundfont/write_sf2}/pbag.js +4 -4
  45. package/soundfont/{write → basic_soundfont/write_sf2}/pgen.js +5 -5
  46. package/soundfont/{write → basic_soundfont/write_sf2}/phdr.js +5 -5
  47. package/soundfont/{write → basic_soundfont/write_sf2}/pmod.js +4 -4
  48. package/soundfont/{write → basic_soundfont/write_sf2}/sdta.js +5 -5
  49. package/soundfont/{write → basic_soundfont/write_sf2}/shdr.js +5 -5
  50. package/soundfont/{write → basic_soundfont/write_sf2}/soundfont_trimmer.js +5 -5
  51. package/soundfont/{write → basic_soundfont/write_sf2}/write.js +8 -9
  52. package/soundfont/{read → read_sf2}/generators.js +2 -1
  53. package/soundfont/{read → read_sf2}/instruments.js +4 -63
  54. package/soundfont/{read → read_sf2}/modulators.js +1 -1
  55. package/soundfont/read_sf2/presets.js +78 -0
  56. package/soundfont/{read → read_sf2}/samples.js +4 -138
  57. package/soundfont/{read → read_sf2}/zones.js +14 -60
  58. package/soundfont/soundfont.js +21 -188
  59. package/synthetizer/worklet_processor.min.js +6 -6
  60. package/synthetizer/worklet_system/message_protocol/message_sending.js +1 -1
  61. package/synthetizer/worklet_system/worklet_methods/data_entry.js +1 -1
  62. package/synthetizer/worklet_system/worklet_methods/note_off.js +1 -1
  63. package/synthetizer/worklet_system/worklet_methods/note_on.js +1 -1
  64. package/synthetizer/worklet_system/worklet_methods/program_control.js +1 -1
  65. package/synthetizer/worklet_system/worklet_methods/reset_controllers.js +1 -1
  66. package/synthetizer/worklet_system/worklet_methods/tuning_control.js +1 -1
  67. package/synthetizer/worklet_system/worklet_methods/voice_control.js +1 -1
  68. package/synthetizer/worklet_system/worklet_utilities/lowpass_filter.js +1 -1
  69. package/synthetizer/worklet_system/worklet_utilities/modulation_envelope.js +2 -2
  70. package/synthetizer/worklet_system/worklet_utilities/modulator_curves.js +1 -1
  71. package/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +4 -4
  72. package/synthetizer/worklet_system/worklet_utilities/worklet_modulator.js +2 -2
  73. package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +1 -1
  74. package/synthetizer/worklet_system/worklet_utilities/worklet_voice.js +1 -1
  75. package/utils/buffer_to_wav.js +6 -6
  76. package/@types/soundfont/read/presets.d.ts +0 -88
  77. package/@types/soundfont/read/samples.d.ts +0 -138
  78. package/@types/soundfont/write/ibag.d.ts +0 -6
  79. package/@types/soundfont/write/igen.d.ts +0 -6
  80. package/@types/soundfont/write/imod.d.ts +0 -6
  81. package/@types/soundfont/write/inst.d.ts +0 -6
  82. package/@types/soundfont/write/pbag.d.ts +0 -6
  83. package/@types/soundfont/write/pgen.d.ts +0 -6
  84. package/@types/soundfont/write/phdr.d.ts +0 -6
  85. package/@types/soundfont/write/pmod.d.ts +0 -6
  86. package/@types/soundfont/write/sdta.d.ts +0 -11
  87. package/@types/soundfont/write/shdr.d.ts +0 -8
  88. package/@types/soundfont/write/soundfont_trimmer.d.ts +0 -6
  89. /package/@types/soundfont/{read → read_sf2}/modulators.d.ts +0 -0
@@ -1,14 +1,15 @@
1
- import {RiffChunk} from "./riff_chunk.js";
1
+ import {RiffChunk} from "../basic_soundfont/riff_chunk.js";
2
2
  import {InstrumentZone} from "./zones.js";
3
3
  import {readBytesAsUintLittleEndian} from "../../utils/byte_functions/little_endian.js";
4
4
  import { readBytesAsString } from '../../utils/byte_functions/string.js'
5
+ import { BasicInstrument } from '../basic_soundfont/basic_instrument.js'
5
6
 
6
7
  /**
7
8
  * instrument.js
8
9
  * purpose: parses soundfont instrument and stores them as a class
9
10
  */
10
11
 
11
- export class Instrument
12
+ export class Instrument extends BasicInstrument
12
13
  {
13
14
  /**
14
15
  * Creates an instrument
@@ -16,70 +17,10 @@ export class Instrument
16
17
  */
17
18
  constructor(instrumentChunk)
18
19
  {
20
+ super();
19
21
  this.instrumentName = readBytesAsString(instrumentChunk.chunkData, 20).trim();
20
22
  this.instrumentZoneIndex = readBytesAsUintLittleEndian(instrumentChunk.chunkData, 2);
21
23
  this.instrumentZonesAmount = 0;
22
- /**
23
- * @type {InstrumentZone[]}
24
- */
25
- this.instrumentZones = [];
26
- this._useCount = 0;
27
- }
28
-
29
- addUseCount()
30
- {
31
- this._useCount++;
32
- this.instrumentZones.forEach(z => z.useCount++);
33
- }
34
-
35
- removeUseCount()
36
- {
37
- this._useCount--;
38
- for(let i = 0; i < this.instrumentZones.length; i++)
39
- {
40
- if(this.safeDeleteZone(i))
41
- {
42
- i--;
43
- }
44
- }
45
- }
46
-
47
- /**
48
- * @returns {number}
49
- */
50
- get useCount()
51
- {
52
- return this._useCount;
53
- }
54
-
55
- deleteInstrument()
56
- {
57
- this.instrumentZones.forEach(z => z.deleteZone());
58
- this.instrumentZones.length = 0;
59
- }
60
-
61
- /**
62
- * @param index {number}
63
- * @returns {boolean} is the zone has been deleted
64
- */
65
- safeDeleteZone(index)
66
- {
67
- this.instrumentZones[index].useCount--;
68
- if(this.instrumentZones[index].useCount < 1)
69
- {
70
- this.deleteZone(index);
71
- return true;
72
- }
73
- return false;
74
- }
75
-
76
- /**
77
- * @param index {number}
78
- */
79
- deleteZone(index)
80
- {
81
- this.instrumentZones[index].deleteZone();
82
- this.instrumentZones.splice(index, 1);
83
24
  }
84
25
 
85
26
  /**
@@ -63,7 +63,7 @@ export class Modulator{
63
63
 
64
64
  if(this.modulatorDestination > 58)
65
65
  {
66
- this.modulatorDestination = -1; // flag as invalid (for linked ones)
66
+ this.modulatorDestination = generatorTypes.INVALID; // flag as invalid (for linked ones)
67
67
  }
68
68
 
69
69
  // decode the source
@@ -0,0 +1,78 @@
1
+ import {RiffChunk} from "../basic_soundfont/riff_chunk.js";
2
+ import {PresetZone} from "./zones.js";
3
+ import {readBytesAsUintLittleEndian} from "../../utils/byte_functions/little_endian.js";
4
+ import { readBytesAsString } from '../../utils/byte_functions/string.js'
5
+ import { BasicPreset } from '../basic_soundfont/basic_preset.js'
6
+
7
+ /**
8
+ * parses soundfont presets, also includes function for getting the generators and samples from midi note and velocity
9
+ */
10
+
11
+ export class Preset extends BasicPreset
12
+ {
13
+ /**
14
+ * Creates a preset
15
+ * @param presetChunk {RiffChunk}
16
+ */
17
+ constructor(presetChunk)
18
+ {
19
+ super();
20
+ this.presetName = readBytesAsString(presetChunk.chunkData, 20)
21
+ .trim()
22
+ .replace(/\d{3}:\d{3}/, ""); // remove those pesky "000:001"
23
+
24
+ this.program = readBytesAsUintLittleEndian(presetChunk.chunkData, 2);
25
+ this.bank = readBytesAsUintLittleEndian(presetChunk.chunkData, 2);
26
+ this.presetZoneStartIndex = readBytesAsUintLittleEndian(presetChunk.chunkData, 2);
27
+
28
+ // read the dwords
29
+ this.library = readBytesAsUintLittleEndian(presetChunk.chunkData, 4);
30
+ this.genre = readBytesAsUintLittleEndian(presetChunk.chunkData, 4);
31
+ this.morphology = readBytesAsUintLittleEndian(presetChunk.chunkData, 4);
32
+ this.presetZonesAmount = 0;
33
+ }
34
+
35
+ /**
36
+ * Loads all the preset zones, given the amount
37
+ * @param amount {number}
38
+ * @param zones {PresetZone[]}
39
+ */
40
+ getPresetZones(amount, zones)
41
+ {
42
+ this.presetZonesAmount = amount;
43
+ for (let i = this.presetZoneStartIndex; i < this.presetZonesAmount + this.presetZoneStartIndex; i++)
44
+ {
45
+ this.presetZones.push(zones[i]);
46
+ }
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Reads the presets
52
+ * @param presetChunk {RiffChunk}
53
+ * @param presetZones {PresetZone[]}
54
+ * @returns {Preset[]}
55
+ */
56
+ export function readPresets(presetChunk, presetZones)
57
+ {
58
+ /**
59
+ * @type {Preset[]}
60
+ */
61
+ let presets = [];
62
+ while(presetChunk.chunkData.length > presetChunk.chunkData.currentIndex)
63
+ {
64
+ let preset = new Preset(presetChunk);
65
+ if(presets.length > 0)
66
+ {
67
+ let presetZonesAmount = preset.presetZoneStartIndex - presets[presets.length - 1].presetZoneStartIndex;
68
+ presets[presets.length - 1].getPresetZones(presetZonesAmount, presetZones);
69
+ }
70
+ presets.push(preset);
71
+ }
72
+ // remove EOP
73
+ if (presets.length > 1)
74
+ {
75
+ presets.pop();
76
+ }
77
+ return presets;
78
+ }
@@ -1,143 +1,10 @@
1
- import {RiffChunk} from "./riff_chunk.js";
2
- import {IndexedByteArray} from "../../utils/indexed_array.js";
3
- import { readBytesAsUintLittleEndian, signedInt8} from "../../utils/byte_functions/little_endian.js";
1
+ import { RiffChunk } from '../basic_soundfont/riff_chunk.js'
2
+ import { IndexedByteArray } from '../../utils/indexed_array.js'
3
+ import { readBytesAsUintLittleEndian, signedInt8 } from '../../utils/byte_functions/little_endian.js'
4
4
  import { stbvorbis } from '../../externals/stbvorbis_sync/stbvorbis_sync.min.js'
5
5
  import { SpessaSynthWarn } from '../../utils/loggin.js'
6
6
  import { readBytesAsString } from '../../utils/byte_functions/string.js'
7
-
8
- /**
9
- * samples.js
10
- * purpose: parses soundfont samples, resamples if needed.
11
- * loads sample data, handles async loading of sf3 compressed samples
12
- */
13
-
14
- export class BasicSample
15
- {
16
- /**
17
- * The basic representation of a soundfont sample
18
- * @param sampleName {string}
19
- * @param sampleRate {number}
20
- * @param samplePitch {number}
21
- * @param samplePitchCorrection {number}
22
- * @param sampleLink {number}
23
- * @param sampleType {number}
24
- * @param loopStart {number} relative to sample start
25
- * @param loopEnd {number} relative to sample start
26
- */
27
- constructor(
28
- sampleName,
29
- sampleRate,
30
- samplePitch,
31
- samplePitchCorrection,
32
- sampleLink,
33
- sampleType,
34
- loopStart,
35
- loopEnd
36
- )
37
- {
38
- /**
39
- * Sample's name
40
- * @type {string}
41
- */
42
- this.sampleName = sampleName;
43
- /**
44
- * Sample rate in Hz
45
- * @type {number}
46
- */
47
- this.sampleRate = sampleRate;
48
- /**
49
- * Original pitch of the sample as a MIDI note number
50
- * @type {number}
51
- */
52
- this.samplePitch = samplePitch;
53
- /**
54
- * Pitch correction, in cents. Can be negative
55
- * @type {number}
56
- */
57
- this.samplePitchCorrection = samplePitchCorrection;
58
- /**
59
- * Sample link, currently unused.
60
- * @type {number}
61
- */
62
- this.sampleLink = sampleLink;
63
- /**
64
- * Type of the sample, an enum
65
- * @type {number}
66
- */
67
- this.sampleType = sampleType;
68
- /**
69
- * Relative to start of the sample, bytes
70
- * @type {number}
71
- */
72
- this.sampleLoopStartIndex = loopStart;
73
- /**
74
- * Relative to start of the sample, in bytes
75
- * @type {number}
76
- */
77
- this.sampleLoopEndIndex = loopEnd;
78
-
79
- /**
80
- * Indicates if the sample is compressed
81
- * @type {boolean}
82
- */
83
- this.isCompressed = (sampleType & 0x10) > 0;
84
-
85
- /**
86
- * The compressed sample data if it was compressed by spessasynth
87
- * @type {Uint8Array}
88
- */
89
- this.compressedData = undefined;
90
- }
91
-
92
- /**
93
- * @returns {Uint8Array|IndexedByteArray}
94
- */
95
- getRawData()
96
- {
97
- const e = new Error("Not implemented");
98
- e.name = "NotImplementedError";
99
- throw e;
100
- }
101
-
102
- /**
103
- * @param quality {number}
104
- * @param encodeVorbis {EncodeVorbisFunction}
105
- */
106
- compressSample(quality, encodeVorbis)
107
- {
108
- // no need to compress
109
- if(this.isCompressed)
110
- {
111
- return;
112
- }
113
- // compress, always mono!
114
- try
115
- {
116
- this.compressedData = encodeVorbis([this.getAudioData()], 1, this.sampleRate, quality);
117
- // flag as compressed
118
- this.sampleType |= 0x10;
119
- this.isCompressed = true;
120
- }
121
- catch (e)
122
- {
123
- SpessaSynthWarn(`Failed to compress ${this.sampleName}. Leaving as uncompressed!`);
124
- this.isCompressed = false;
125
- this.compressedData = undefined;
126
- this.sampleType &= -17;
127
- }
128
-
129
- }
130
-
131
- /**
132
- * @returns {Float32Array}
133
- */
134
- getAudioData()
135
- {
136
- const e = new Error("Not implemented");
137
- e.name = "NotImplementedError";
138
- throw e;
139
- }
140
- }
7
+ import { BasicSample } from '../basic_soundfont/basic_sample.js'
141
8
 
142
9
  export class LoadedSample extends BasicSample
143
10
  {
@@ -189,7 +56,6 @@ export class LoadedSample extends BasicSample
189
56
  this.sampleEndIndex = sampleEndIndex;
190
57
  this.isSampleLoaded = false;
191
58
  this.sampleID = sampleIndex;
192
- this.useCount = 0;
193
59
  // in bytes
194
60
  this.sampleLength = this.sampleEndIndex - this.sampleStartIndex;
195
61
  this.sampleDataArray = smplArr;
@@ -1,52 +1,30 @@
1
1
  import {readBytesAsUintLittleEndian} from "../../utils/byte_functions/little_endian.js";
2
2
  import {IndexedByteArray} from "../../utils/indexed_array.js";
3
- import {RiffChunk} from "./riff_chunk.js";
3
+ import {RiffChunk} from "../basic_soundfont/riff_chunk.js";
4
4
  import {Generator, generatorTypes} from "./generators.js";
5
- import {LoadedSample} from "./samples.js";
6
5
  import {Instrument} from "./instruments.js";
7
6
  import {Modulator} from "./modulators.js";
7
+ import { BasicInstrumentZone, BasicPresetZone } from '../basic_soundfont/basic_zones.js'
8
8
 
9
9
  /**
10
10
  * zones.js
11
11
  * purpose: reads instrumend and preset zones from soundfont and gets their respective samples and generators and modulators
12
12
  */
13
13
 
14
- export class InstrumentZone {
14
+ export class InstrumentZone extends BasicInstrumentZone
15
+ {
15
16
  /**
16
17
  * Creates a zone (instrument)
17
18
  * @param dataArray {IndexedByteArray}
18
- * @param index {number}
19
19
  */
20
- constructor(dataArray, index)
20
+ constructor(dataArray)
21
21
  {
22
+ super();
22
23
  this.generatorZoneStartIndex = readBytesAsUintLittleEndian(dataArray, 2);
23
24
  this.modulatorZoneStartIndex = readBytesAsUintLittleEndian(dataArray, 2);
24
25
  this.modulatorZoneSize = 0;
25
26
  this.generatorZoneSize = 0;
26
- this.zoneID = index;
27
- this.keyRange = {min: 0, max: 127};
28
- this.velRange = {min: 0, max: 127}
29
27
  this.isGlobal = true;
30
- this.useCount = 0;
31
-
32
- /**
33
- * @type {Generator[]}
34
- */
35
- this.generators = [];
36
- /**
37
- * @type {Modulator[]}
38
- */
39
- this.modulators = [];
40
- }
41
-
42
- deleteZone()
43
- {
44
- this.useCount--;
45
- if(this.isGlobal)
46
- {
47
- return;
48
- }
49
- this.sample.useCount--;
50
28
  }
51
29
 
52
30
  setZoneSize(modulatorZoneSize, generatorZoneSize)
@@ -81,7 +59,7 @@ export class InstrumentZone {
81
59
 
82
60
  /**
83
61
  * Loads the zone's sample
84
- * @param samples {LoadedSample[]}
62
+ * @param samples {BasicSample[]}
85
63
  */
86
64
  getSample(samples)
87
65
  {
@@ -126,7 +104,7 @@ export class InstrumentZone {
126
104
  * @param zonesChunk {RiffChunk}
127
105
  * @param instrumentGenerators {Generator[]}
128
106
  * @param instrumentModulators {Modulator[]}
129
- * @param instrumentSamples {LoadedSample[]}
107
+ * @param instrumentSamples {BasicSample[]}
130
108
  * @returns {InstrumentZone[]}
131
109
  */
132
110
  export function readInstrumentZones(zonesChunk, instrumentGenerators, instrumentModulators, instrumentSamples)
@@ -135,10 +113,9 @@ export function readInstrumentZones(zonesChunk, instrumentGenerators, instrument
135
113
  * @type {InstrumentZone[]}
136
114
  */
137
115
  let zones = [];
138
- let index = 0;
139
116
  while(zonesChunk.chunkData.length > zonesChunk.chunkData.currentIndex)
140
117
  {
141
- let zone = new InstrumentZone(zonesChunk.chunkData, index);
118
+ let zone = new InstrumentZone(zonesChunk.chunkData);
142
119
  if(zones.length > 0)
143
120
  {
144
121
  let modulatorZoneSize = zone.modulatorZoneStartIndex - zones[zones.length - 1].modulatorZoneStartIndex;
@@ -151,7 +128,6 @@ export function readInstrumentZones(zonesChunk, instrumentGenerators, instrument
151
128
  zones[zones.length - 1].getVelRange();
152
129
  }
153
130
  zones.push(zone);
154
- index++;
155
131
  }
156
132
  if(zones.length > 1)
157
133
  {
@@ -161,31 +137,20 @@ export function readInstrumentZones(zonesChunk, instrumentGenerators, instrument
161
137
  return zones;
162
138
  }
163
139
 
164
- export class
165
- PresetZone
140
+ export class PresetZone extends BasicPresetZone
166
141
  {
167
142
  /**
168
143
  * Creates a zone (preset)
169
144
  * @param dataArray {IndexedByteArray}
170
- * @param index {number}
171
145
  */
172
- constructor(dataArray, index) {
146
+ constructor(dataArray)
147
+ {
148
+ super();
173
149
  this.generatorZoneStartIndex = readBytesAsUintLittleEndian(dataArray, 2);
174
150
  this.modulatorZoneStartIndex = readBytesAsUintLittleEndian(dataArray, 2);
175
151
  this.modulatorZoneSize = 0;
176
152
  this.generatorZoneSize = 0;
177
- this.zoneID = index;
178
- this.keyRange = {min: 0, max: 127};
179
- this.velRange = {min: 0, max: 127}
180
153
  this.isGlobal = true;
181
- /**
182
- * @type {Generator[]}
183
- */
184
- this.generators = [];
185
- /**
186
- * @type {Modulator[]}
187
- */
188
- this.modulators = [];
189
154
  }
190
155
 
191
156
  setZoneSize(modulatorZoneSize, generatorZoneSize)
@@ -194,15 +159,6 @@ PresetZone
194
159
  this.generatorZoneSize = generatorZoneSize;
195
160
  }
196
161
 
197
- deleteZone()
198
- {
199
- if(this.isGlobal)
200
- {
201
- return;
202
- }
203
- this.instrument.removeUseCount();
204
- }
205
-
206
162
  /**
207
163
  * grab the generators
208
164
  * @param generators {Generator[]}
@@ -283,10 +239,9 @@ export function readPresetZones(zonesChunk, presetGenerators, presetModulators,
283
239
  * @type {PresetZone[]}
284
240
  */
285
241
  let zones = [];
286
- let index = 0;
287
242
  while(zonesChunk.chunkData.length > zonesChunk.chunkData.currentIndex)
288
243
  {
289
- let zone = new PresetZone(zonesChunk.chunkData, index);
244
+ let zone = new PresetZone(zonesChunk.chunkData);
290
245
  if(zones.length > 0)
291
246
  {
292
247
  let modulatorZoneSize = zone.modulatorZoneStartIndex - zones[zones.length - 1].modulatorZoneStartIndex;
@@ -299,7 +254,6 @@ export function readPresetZones(zonesChunk, presetGenerators, presetModulators,
299
254
  zones[zones.length - 1].getVelRange();
300
255
  }
301
256
  zones.push(zone);
302
- index++;
303
257
  }
304
258
  if(zones.length > 1)
305
259
  {