spessasynth_lib 3.16.5 → 3.20.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 (87) hide show
  1. package/@types/index.d.ts +5 -4
  2. package/@types/midi_parser/basic_midi.d.ts +125 -0
  3. package/@types/midi_parser/midi_builder.d.ts +69 -0
  4. package/@types/midi_parser/midi_data.d.ts +2 -2
  5. package/@types/midi_parser/midi_editor.d.ts +4 -4
  6. package/@types/midi_parser/midi_loader.d.ts +3 -100
  7. package/@types/midi_parser/midi_writer.d.ts +2 -2
  8. package/@types/midi_parser/rmidi_writer.d.ts +3 -3
  9. package/@types/midi_parser/used_keys_loaded.d.ts +2 -2
  10. package/@types/sequencer/sequencer.d.ts +1 -1
  11. package/@types/soundfont/basic_soundfont/basic_sample.d.ts +2 -2
  12. package/@types/soundfont/basic_soundfont/basic_zone.d.ts +12 -12
  13. package/@types/soundfont/basic_soundfont/basic_zones.d.ts +4 -0
  14. package/@types/soundfont/basic_soundfont/riff_chunk.d.ts +6 -0
  15. package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +2 -2
  16. package/@types/soundfont/dls/articulator_converter.d.ts +10 -0
  17. package/@types/soundfont/dls/dls_destinations.d.ts +29 -0
  18. package/@types/soundfont/dls/dls_preset.d.ts +13 -0
  19. package/@types/soundfont/dls/dls_sample.d.ts +18 -0
  20. package/@types/soundfont/dls/dls_soundfont.d.ts +31 -0
  21. package/@types/soundfont/dls/dls_sources.d.ts +22 -0
  22. package/@types/soundfont/dls/dls_zone.d.ts +22 -0
  23. package/@types/soundfont/dls/read_articulation.d.ts +12 -0
  24. package/@types/soundfont/dls/read_instrument.d.ts +5 -0
  25. package/@types/soundfont/dls/read_instrument_list.d.ts +5 -0
  26. package/@types/soundfont/dls/read_lart.d.ts +7 -0
  27. package/@types/soundfont/dls/read_region.d.ts +7 -0
  28. package/@types/soundfont/dls/read_samples.d.ts +5 -0
  29. package/@types/soundfont/load_soundfont.d.ts +6 -0
  30. package/@types/soundfont/read_sf2/generators.d.ts +18 -5
  31. package/@types/soundfont/read_sf2/modulators.d.ts +1 -0
  32. package/@types/soundfont/soundfont.d.ts +2 -1
  33. package/@types/synthetizer/synthetizer.d.ts +2 -2
  34. package/@types/utils/byte_functions/little_endian.d.ts +1 -1
  35. package/README.md +27 -15
  36. package/index.js +6 -4
  37. package/midi_parser/basic_midi.js +146 -0
  38. package/midi_parser/midi_builder.js +281 -0
  39. package/midi_parser/midi_data.js +1 -1
  40. package/midi_parser/midi_editor.js +2 -2
  41. package/midi_parser/midi_loader.js +38 -56
  42. package/midi_parser/midi_writer.js +1 -1
  43. package/midi_parser/rmidi_writer.js +2 -2
  44. package/midi_parser/used_keys_loaded.js +1 -1
  45. package/package.json +1 -1
  46. package/sequencer/sequencer.js +1 -1
  47. package/sequencer/worklet_sequencer/song_control.js +3 -3
  48. package/sequencer/worklet_sequencer/worklet_sequencer.js +1 -1
  49. package/soundfont/README.md +6 -2
  50. package/soundfont/basic_soundfont/basic_sample.js +3 -3
  51. package/soundfont/basic_soundfont/basic_zone.js +28 -28
  52. package/soundfont/basic_soundfont/basic_zones.js +15 -19
  53. package/soundfont/basic_soundfont/riff_chunk.js +20 -4
  54. package/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js +1 -1
  55. package/soundfont/dls/articulator_converter.js +311 -0
  56. package/soundfont/dls/dls_destinations.js +38 -0
  57. package/soundfont/dls/dls_preset.js +32 -0
  58. package/soundfont/dls/dls_sample.js +58 -0
  59. package/soundfont/dls/dls_soundfont.js +150 -0
  60. package/soundfont/dls/dls_sources.js +26 -0
  61. package/soundfont/dls/dls_zone.js +75 -0
  62. package/soundfont/dls/read_articulation.js +327 -0
  63. package/soundfont/dls/read_instrument.js +100 -0
  64. package/soundfont/dls/read_instrument_list.js +17 -0
  65. package/soundfont/dls/read_lart.js +35 -0
  66. package/soundfont/dls/read_region.js +129 -0
  67. package/soundfont/dls/read_samples.js +174 -0
  68. package/soundfont/load_soundfont.js +21 -0
  69. package/soundfont/read_sf2/generators.js +41 -6
  70. package/soundfont/read_sf2/instruments.js +2 -2
  71. package/soundfont/read_sf2/modulators.js +8 -8
  72. package/soundfont/read_sf2/presets.js +7 -7
  73. package/soundfont/read_sf2/samples.js +8 -8
  74. package/soundfont/read_sf2/zones.js +5 -5
  75. package/soundfont/soundfont.js +8 -3
  76. package/synthetizer/synthetizer.js +1 -1
  77. package/synthetizer/worklet_processor.min.js +10 -7
  78. package/synthetizer/worklet_system/main_processor.js +1 -2
  79. package/synthetizer/worklet_system/worklet_methods/program_control.js +6 -3
  80. package/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/worklet_soundfont_manager.js +5 -5
  81. package/utils/buffer_to_wav.js +5 -26
  82. package/utils/byte_functions/little_endian.js +1 -1
  83. /package/@types/{midi_handler → external_midi}/midi_handler.d.ts +0 -0
  84. /package/@types/{midi_handler → external_midi}/web_midi_link.d.ts +0 -0
  85. /package/{midi_handler → external_midi}/README.md +0 -0
  86. /package/{midi_handler → external_midi}/midi_handler.js +0 -0
  87. /package/{midi_handler → external_midi}/web_midi_link.js +0 -0
package/@types/index.d.ts CHANGED
@@ -2,11 +2,12 @@ import { Sequencer } from './sequencer/sequencer.js';
2
2
  import { Synthetizer } from './synthetizer/synthetizer.js';
3
3
  import { DEFAULT_PERCUSSION } from './synthetizer/synthetizer.js';
4
4
  import { VOICE_CAP } from './synthetizer/synthetizer.js';
5
- import { SoundFont2 } from './soundfont/soundfont.js';
5
+ import { loadSoundFont } from "./soundfont/load_soundfont.js";
6
6
  import { trimSoundfont } from "./soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js";
7
7
  import { modulatorSources } from "./soundfont/read_sf2/modulators.js";
8
8
  import { encodeVorbis } from "./utils/encode_vorbis.js";
9
9
  import { MIDI } from './midi_parser/midi_loader.js';
10
+ import { MIDIBuilder } from "./midi_parser/midi_builder.js";
10
11
  import { IndexedByteArray } from './utils/indexed_array.js';
11
12
  import { writeMIDIFile } from './midi_parser/midi_writer.js';
12
13
  import { writeRMIDI } from './midi_parser/rmidi_writer.js';
@@ -22,8 +23,8 @@ import { SpessaSynthWarn } from './utils/loggin.js';
22
23
  import { SpessaSynthGroupCollapsed } from './utils/loggin.js';
23
24
  import { midiControllers } from './midi_parser/midi_message.js';
24
25
  import { messageTypes } from './midi_parser/midi_message.js';
25
- import { MIDIDeviceHandler } from './midi_handler/midi_handler.js';
26
- import { WebMidiLinkHandler } from './midi_handler/web_midi_link.js';
26
+ import { MIDIDeviceHandler } from "./external_midi/midi_handler.js";
27
+ import { WebMidiLinkHandler } from "./external_midi/web_midi_link.js";
27
28
  import { arrayToHexString } from './utils/other.js';
28
29
  import { consoleColors } from './utils/other.js';
29
30
  import { formatTitle } from './utils/other.js';
@@ -32,4 +33,4 @@ import { readBytesAsUintBigEndian } from './utils/byte_functions/big_endian.js';
32
33
  import { NON_CC_INDEX_OFFSET } from './synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js';
33
34
  import { ALL_CHANNELS_OR_DIFFERENT_ACTION } from './synthetizer/worklet_system/message_protocol/worklet_message.js';
34
35
  import { WORKLET_URL_ABSOLUTE } from './synthetizer/worklet_url.js';
35
- export { Sequencer, Synthetizer, DEFAULT_PERCUSSION, VOICE_CAP, SoundFont2, trimSoundfont, modulatorSources, encodeVorbis, MIDI, IndexedByteArray, writeMIDIFile, writeRMIDI, applySnapshotToMIDI, modifyMIDI, 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 };
36
+ export { Sequencer, Synthetizer, DEFAULT_PERCUSSION, VOICE_CAP, loadSoundFont, trimSoundfont, modulatorSources, encodeVorbis, MIDI, MIDIBuilder, IndexedByteArray, writeMIDIFile, writeRMIDI, applySnapshotToMIDI, modifyMIDI, 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 };
@@ -0,0 +1,125 @@
1
+ export class BasicMIDI {
2
+ /**
3
+ * The time division of the sequence
4
+ * @type {number}
5
+ */
6
+ timeDivision: number;
7
+ /**
8
+ * The duration of the sequence, in seconds
9
+ * @type {number}
10
+ */
11
+ duration: number;
12
+ /**
13
+ * The tempo changes in the sequence, ordered from last to first
14
+ * @type {{ticks: number, tempo: number}[]}
15
+ */
16
+ tempoChanges: {
17
+ ticks: number;
18
+ tempo: number;
19
+ }[];
20
+ /**
21
+ * Contains the copyright strings
22
+ * @type {string}
23
+ */
24
+ copyright: string;
25
+ /**
26
+ * The amount of tracks in the sequence
27
+ * @type {number}
28
+ */
29
+ tracksAmount: number;
30
+ /**
31
+ * The lyrics of the sequence as binary chunks
32
+ * @type {Uint8Array[]}
33
+ */
34
+ lyrics: Uint8Array[];
35
+ /**
36
+ * First note on of the MIDI file
37
+ * @type {number}
38
+ */
39
+ firstNoteOn: number;
40
+ /**
41
+ * The MIDI's key range
42
+ * @type {{min: number, max: number}}
43
+ */
44
+ keyRange: {
45
+ min: number;
46
+ max: number;
47
+ };
48
+ /**
49
+ * The last voice (note on, off, cc change etc.) event tick
50
+ * @type {number}
51
+ */
52
+ lastVoiceEventTick: number;
53
+ /**
54
+ * Midi port numbers for each track
55
+ * @type {number[]}
56
+ */
57
+ midiPorts: number[];
58
+ /**
59
+ * Channel offsets for each port, using the SpessaSynth method
60
+ * @type {number[]}
61
+ */
62
+ midiPortChannelOffsets: number[];
63
+ /**
64
+ * All channels that each track uses
65
+ * @type {Set<number>[]}
66
+ */
67
+ usedChannelsOnTrack: Set<number>[];
68
+ /**
69
+ * The loop points (in ticks) of the sequence
70
+ * @type {{start: number, end: number}}
71
+ */
72
+ loop: {
73
+ start: number;
74
+ end: number;
75
+ };
76
+ /**
77
+ * The sequence's name
78
+ * @type {string}
79
+ */
80
+ midiName: string;
81
+ /**
82
+ * The file name of the sequence, if provided in the MIDI class
83
+ * @type {string}
84
+ */
85
+ fileName: string;
86
+ /**
87
+ * The raw, encoded MIDI name.
88
+ * @type {Uint8Array}
89
+ */
90
+ rawMidiName: Uint8Array;
91
+ /**
92
+ * The MIDI's embedded soundfont
93
+ * @type {ArrayBuffer|undefined}
94
+ */
95
+ embeddedSoundFont: ArrayBuffer | undefined;
96
+ /**
97
+ * The MIDI file's format
98
+ * @type {number}
99
+ */
100
+ format: number;
101
+ /**
102
+ * The RMID Info data if RMID, otherwise undefined
103
+ * @type {Object<string, IndexedByteArray>}
104
+ */
105
+ RMIDInfo: {
106
+ [x: string]: IndexedByteArray;
107
+ };
108
+ /**
109
+ * The bank offset for RMIDI
110
+ * @type {number}
111
+ */
112
+ bankOffset: number;
113
+ /**
114
+ * The actual track data of the MIDI file
115
+ * @type {MidiMessage[][]}
116
+ */
117
+ tracks: MidiMessage[][];
118
+ /**
119
+ * Coverts ticks to time in seconds
120
+ * @param ticks {number}
121
+ * @returns {number}
122
+ * @protected
123
+ */
124
+ protected _ticksToSeconds(ticks: number): number;
125
+ }
@@ -0,0 +1,69 @@
1
+ export class MIDIBuilder extends BasicMIDI {
2
+ /**
3
+ * @param name {string} The MIDI's name
4
+ * @param timeDivision {number} the file's time division
5
+ * @param initialTempo {number} the file's initial tempo
6
+ */
7
+ constructor(name: string, timeDivision?: number, initialTempo?: number);
8
+ encoder: TextEncoder;
9
+ /**
10
+ * Updates all internal values
11
+ */
12
+ flush(): void;
13
+ /**
14
+ * Adds a new "set tempo" message
15
+ * @param ticks {number} the tick number of the event
16
+ * @param tempo {number} the tempo in beats per minute (BPM)
17
+ */
18
+ addSetTempo(ticks: number, tempo: number): void;
19
+ /**
20
+ * Adds a new MIDI track
21
+ * @param name {string} the new track's name
22
+ * @param port {number} the new track's port
23
+ */
24
+ addNewTrack(name: string, port?: number): void;
25
+ /**
26
+ * Adds a new MIDI Event
27
+ * @param ticks {number} the tick time of the event
28
+ * @param track {number} the track number to use
29
+ * @param event {number} the MIDI event number
30
+ * @param eventData {Uint8Array|Iterable<number>} the raw event data
31
+ */
32
+ addEvent(ticks: number, track: number, event: number, eventData: Uint8Array | Iterable<number>): void;
33
+ /**
34
+ * Adds a new Note On event
35
+ * @param ticks {number} the tick time of the event
36
+ * @param track {number} the track number to use
37
+ * @param channel {number} the channel to use
38
+ * @param midiNote {number} the midi note of the keypress
39
+ * @param velocity {number} the velocity of the keypress
40
+ */
41
+ addNoteOn(ticks: number, track: number, channel: number, midiNote: number, velocity: number): void;
42
+ /**
43
+ * Adds a new Note Off event
44
+ * @param ticks {number} the tick time of the event
45
+ * @param track {number} the track number to use
46
+ * @param channel {number} the channel to use
47
+ * @param midiNote {number} the midi note of the key release
48
+ */
49
+ addNoteOff(ticks: number, track: number, channel: number, midiNote: number): void;
50
+ /**
51
+ * Adds a new Controller Change event
52
+ * @param ticks {number} the tick time of the event
53
+ * @param track {number} the track number to use
54
+ * @param channel {number} the channel to use
55
+ * @param controllerNumber {number} the MIDI CC to use
56
+ * @param controllerValue {number} the new CC value
57
+ */
58
+ addControllerChange(ticks: number, track: number, channel: number, controllerNumber: number, controllerValue: number): void;
59
+ /**
60
+ * Adds a new Pitch Wheel event
61
+ * @param ticks {number} the tick time of the event
62
+ * @param track {number} the track to use
63
+ * @param channel {number} the channel to use
64
+ * @param MSB {number} SECOND byte of the MIDI pitchWheel message
65
+ * @param LSB {number} FIRST byte of the MIDI pitchWheel message
66
+ */
67
+ addPitchWheel(ticks: number, track: number, channel: number, MSB: number, LSB: number): void;
68
+ }
69
+ import { BasicMIDI } from './basic_midi.js';
@@ -4,9 +4,9 @@
4
4
  */
5
5
  export class MidiData {
6
6
  /**
7
- * @param midi {MIDI}
7
+ * @param midi {BasicMIDI}
8
8
  */
9
- constructor(midi: MIDI);
9
+ constructor(midi: BasicMIDI);
10
10
  /**
11
11
  * The time division of the sequence
12
12
  * @type {number}
@@ -5,7 +5,7 @@
5
5
  export function getGsOn(ticks: number): MidiMessage;
6
6
  /**
7
7
  * Allows easy editing of the file
8
- * @param midi {MIDI}
8
+ * @param midi {BasicMIDI}
9
9
  * @param desiredProgramChanges {{
10
10
  * channel: number,
11
11
  * program: number,
@@ -23,7 +23,7 @@ export function getGsOn(ticks: number): MidiMessage;
23
23
  * keyShift: number
24
24
  * }[]} the channels to transpose. if keyShift is float, rpn fine tuning will be applied as well. Note that the channel may be more than 16, function will adjust midi ports automatically
25
25
  */
26
- export function modifyMIDI(midi: MIDI, desiredProgramChanges?: {
26
+ export function modifyMIDI(midi: BasicMIDI, desiredProgramChanges?: {
27
27
  channel: number;
28
28
  program: number;
29
29
  bank: number;
@@ -38,8 +38,8 @@ export function modifyMIDI(midi: MIDI, desiredProgramChanges?: {
38
38
  }[]): void;
39
39
  /**
40
40
  * Modifies the sequence according to the locked presets and controllers in the given snapshot
41
- * @param midi {MIDI}
41
+ * @param midi {BasicMIDI}
42
42
  * @param snapshot {SynthesizerSnapshot}
43
43
  */
44
- export function applySnapshotToMIDI(midi: MIDI, snapshot: SynthesizerSnapshot): void;
44
+ export function applySnapshotToMIDI(midi: BasicMIDI, snapshot: SynthesizerSnapshot): void;
45
45
  import { MidiMessage } from './midi_message.js';
@@ -2,104 +2,14 @@
2
2
  * midi_loader.js
3
3
  * purpose: parses a midi file for the seqyencer, including things like marker or CC 2/4 loop detection, copyright detection etc.
4
4
  */
5
- export class MIDI {
5
+ export class MIDI extends BasicMIDI {
6
6
  /**
7
7
  * Parses a given midi file
8
8
  * @param arrayBuffer {ArrayBuffer}
9
9
  * @param fileName {string} optional, replaces the decoded title if empty
10
10
  */
11
11
  constructor(arrayBuffer: ArrayBuffer, fileName?: string);
12
- /**
13
- * If the RMI file has an embedded sf2 in it, it will appeear here, otherwise undefined
14
- * @type {ArrayBuffer}
15
- */
16
- embeddedSoundFont: ArrayBuffer;
17
- /**
18
- * The RMID Info data if RMID, otherwise undefined
19
- * @type {Object<string, IndexedByteArray>}
20
- */
21
- RMIDInfo: {
22
- [x: string]: IndexedByteArray;
23
- };
24
- /**
25
- * The bank offset for RMIDI
26
- * @type {number}
27
- */
28
- bankOffset: number;
29
- /**
30
- * Contains the copyright strings
31
- * @type {string}
32
- */
33
- copyright: string;
34
- /**
35
- * The MIDI name
36
- * @type {string}
37
- */
38
- midiName: string;
39
- rawMidiName: Uint8Array;
40
- format: number;
41
- tracksAmount: number;
42
- timeDivision: number;
43
- /**
44
- * The MIDI's key range
45
- * @type {{min: number, max: number}}
46
- */
47
- keyRange: {
48
- min: number;
49
- max: number;
50
- };
51
- /**
52
- * Contains the lyrics as binary chunks
53
- * @type {Uint8Array[]}
54
- */
55
- lyrics: Uint8Array[];
56
- /**
57
- * Contains all the tempo changes in the file. (Ordered from last to first)
58
- * @type {{
59
- * ticks: number,
60
- * tempo: number
61
- * }[]}
62
- */
63
- tempoChanges: {
64
- ticks: number;
65
- tempo: number;
66
- }[];
67
- lastVoiceEventTick: number;
68
- /**
69
- * Midi port numbers for each tracks
70
- * @type {number[]}
71
- */
72
- midiPorts: number[];
73
- /**
74
- * Channel offsets for each port, using the SpessaSynth method
75
- * @type {number[]}
76
- */
77
- midiPortChannelOffsets: number[];
78
- /**
79
- * All channels that each track uses. Note: these channels range from 0 to 15, excluding the port offsets!
80
- * @type {Set<number>[]}
81
- */
82
- usedChannelsOnTrack: Set<number>[];
83
- /**
84
- * Read all the tracks
85
- * @type {MidiMessage[][]}
86
- */
87
- tracks: MidiMessage[][];
88
- firstNoteOn: number;
89
- /**
90
- *
91
- * @type {{start: number, end: number}}
92
- */
93
- loop: {
94
- start: number;
95
- end: number;
96
- };
97
- fileName: string;
98
- /**
99
- * The total playback time, in seconds
100
- * @type {number}
101
- */
102
- duration: number;
12
+ rawMidiName: any;
103
13
  /**
104
14
  * @param fileByteArray {IndexedByteArray}
105
15
  * @returns {{type: string, size: number, data: IndexedByteArray}}
@@ -109,13 +19,6 @@ export class MIDI {
109
19
  size: number;
110
20
  data: IndexedByteArray;
111
21
  };
112
- /**
113
- * Coverts ticks to time in seconds
114
- * @param ticks {number}
115
- * @returns {number}
116
- * @private
117
- */
118
- private _ticksToSeconds;
119
22
  }
23
+ import { BasicMIDI } from './basic_midi.js';
120
24
  import { IndexedByteArray } from '../utils/indexed_array.js';
121
- import { MidiMessage } from './midi_message.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Exports the midi as a .mid file
3
- * @param midi {MIDI}
3
+ * @param midi {BasicMIDI}
4
4
  * @returns {Uint8Array} the binary .mid file data
5
5
  */
6
- export function writeMIDIFile(midi: MIDI): Uint8Array;
6
+ export function writeMIDIFile(midi: BasicMIDI): Uint8Array;
@@ -14,15 +14,15 @@
14
14
  /**
15
15
  * Writes an RMIDI file
16
16
  * @param soundfontBinary {Uint8Array}
17
- * @param mid {MIDI}
18
- * @param soundfont {SoundFont2}
17
+ * @param mid {BasicMIDI}
18
+ * @param soundfont {BasicSoundFont}
19
19
  * @param bankOffset {number} the bank offset for RMIDI
20
20
  * @param encoding {string} the encoding of the RMIDI info chunk
21
21
  * @param metadata {RMIDMetadata} the metadata of the file. Optional. If provided, the encoding is forced to utf-8/
22
22
  * @param correctBankOffset {boolean}
23
23
  * @returns {IndexedByteArray}
24
24
  */
25
- export function writeRMIDI(soundfontBinary: Uint8Array, mid: MIDI, soundfont: SoundFont2, bankOffset?: number, encoding?: string, metadata?: RMIDMetadata, correctBankOffset?: boolean): IndexedByteArray;
25
+ export function writeRMIDI(soundfontBinary: Uint8Array, mid: BasicMIDI, soundfont: BasicSoundFont, bankOffset?: number, encoding?: string, metadata?: RMIDMetadata, correctBankOffset?: boolean): IndexedByteArray;
26
26
  export type RMIDINFOChunks = string;
27
27
  export namespace RMIDINFOChunks {
28
28
  let name: string;
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @param mid {MIDI}
2
+ * @param mid {BasicMIDI}
3
3
  * @param soundfont {{getPreset: function(number, number): BasicPreset}}
4
4
  * @returns {Object<string, Set<string>>}
5
5
  */
6
- export function getUsedProgramsAndKeys(mid: MIDI, soundfont: {
6
+ export function getUsedProgramsAndKeys(mid: BasicMIDI, soundfont: {
7
7
  getPreset: (arg0: number, arg1: number) => BasicPreset;
8
8
  }): {
9
9
  [x: string]: Set<string>;
@@ -194,7 +194,7 @@ export type MidFile = {
194
194
  */
195
195
  altName: string | undefined;
196
196
  };
197
- export type MIDIFile = MIDI | MidFile;
197
+ export type MIDIFile = BasicMIDI | MidFile;
198
198
  export type SequencerOptions = {
199
199
  /**
200
200
  * - if true, the sequencer will skip to the first note
@@ -42,12 +42,12 @@ export class BasicSample {
42
42
  */
43
43
  sampleType: number;
44
44
  /**
45
- * Relative to start of the sample, bytes
45
+ * Relative to start of the sample, bytes assuming 16 bit
46
46
  * @type {number}
47
47
  */
48
48
  sampleLoopStartIndex: number;
49
49
  /**
50
- * Relative to start of the sample, in bytes
50
+ * Relative to start of the sample, in bytes assuming 16 bit
51
51
  * @type {number}
52
52
  */
53
53
  sampleLoopEndIndex: number;
@@ -5,30 +5,30 @@
5
5
  */
6
6
  export class BasicZone {
7
7
  /**
8
- * The zone's generators
9
- * @type {Generator[]}
8
+ * The zone's velocity range
9
+ * @type {SoundFontRange}
10
10
  */
11
- generators: Generator[];
11
+ velRange: SoundFontRange;
12
12
  /**
13
- * The zone's modulators
14
- * @type {Modulator[]}
13
+ * The zone's key range
14
+ * @type {SoundFontRange}
15
15
  */
16
- modulators: Modulator[];
16
+ keyRange: SoundFontRange;
17
17
  /**
18
18
  * Indicates if the zone is global
19
19
  * @type {boolean}
20
20
  */
21
21
  isGlobal: boolean;
22
22
  /**
23
- * The zone's key range
24
- * @type {SoundFontRange}
23
+ * The zone's generators
24
+ * @type {Generator[]}
25
25
  */
26
- keyRange: SoundFontRange;
26
+ generators: Generator[];
27
27
  /**
28
- * The zone's velocity range
29
- * @type {SoundFontRange}
28
+ * The zone's modulators
29
+ * @type {Modulator[]}
30
30
  */
31
- velRange: SoundFontRange;
31
+ modulators: Modulator[];
32
32
  }
33
33
  export type SoundFontRange = {
34
34
  /**
@@ -4,6 +4,10 @@ export class BasicInstrumentZone extends BasicZone {
4
4
  * @type {BasicSample|undefined}
5
5
  */
6
6
  sample: BasicSample | undefined;
7
+ /**
8
+ * The zone's use count
9
+ * @type {number}
10
+ */
7
11
  useCount: number;
8
12
  deleteZone(): void;
9
13
  }
@@ -18,6 +18,12 @@ export function writeRIFFChunk(chunk: RiffChunk, prepend?: IndexedByteArray): In
18
18
  * @returns {IndexedByteArray}
19
19
  */
20
20
  export function writeRIFFOddSize(header: string, data: Uint8Array, addZeroByte?: boolean): IndexedByteArray;
21
+ /**
22
+ * @param collection {RiffChunk[]}
23
+ * @param type {string}
24
+ * @returns {RiffChunk|undefined}
25
+ */
26
+ export function findRIFFListType(collection: RiffChunk[], type: string): RiffChunk | undefined;
21
27
  /**
22
28
  * riff_chunk.js
23
29
  * reads a riff read and stores it as a class
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @param soundfont {BasicSoundFont}
3
- * @param mid {MIDI}
3
+ * @param mid {BasicMIDI}
4
4
  * @returns {Uint8Array}
5
5
  */
6
- export function trimSoundfont(soundfont: BasicSoundFont, mid: MIDI): Uint8Array;
6
+ export function trimSoundfont(soundfont: BasicSoundFont, mid: BasicMIDI): Uint8Array;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @param source {number}
3
+ * @param control {number}
4
+ * @param destination {number}
5
+ * @param transform {number}
6
+ * @param value {number}
7
+ * @returns {Modulator|undefined}
8
+ */
9
+ export function getSF2ModulatorFromArticulator(source: number, control: number, destination: number, transform: number, value: number): Modulator | undefined;
10
+ import { Modulator } from '../read_sf2/modulators.js';
@@ -0,0 +1,29 @@
1
+ export type DLSDestinations = number;
2
+ export namespace DLSDestinations {
3
+ let none: number;
4
+ let gain: number;
5
+ let reserved: number;
6
+ let pitch: number;
7
+ let pan: number;
8
+ let keyNum: number;
9
+ let chorusSend: number;
10
+ let reverbSend: number;
11
+ let modLfoFreq: number;
12
+ let modLfoDelay: number;
13
+ let vibLfoFreq: number;
14
+ let vibLfoDelay: number;
15
+ let volEnvAttack: number;
16
+ let volEnvDecay: number;
17
+ let volEnvRelease: number;
18
+ let volEnvSustain: number;
19
+ let volEnvDelay: number;
20
+ let volEnvHold: number;
21
+ let modEnvAttack: number;
22
+ let modEnvDecay: number;
23
+ let modEnvRelease: number;
24
+ let modEnvSustain: number;
25
+ let modEnvDelay: number;
26
+ let modEnvHold: number;
27
+ let filterCutoff: number;
28
+ let filterQ: number;
29
+ }
@@ -0,0 +1,13 @@
1
+ export class DLSPreset extends BasicPreset {
2
+ /**
3
+ * Creates a new DLS preset
4
+ * @param ulBank {number}
5
+ * @param ulInstrument {number}
6
+ */
7
+ constructor(ulBank: number, ulInstrument: number);
8
+ DLSInstrument: BasicInstrument;
9
+ presetZones: BasicPresetZone[];
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';
@@ -0,0 +1,18 @@
1
+ export class DLSSample extends BasicSample {
2
+ /**
3
+ * @param name {string}
4
+ * @param rate {number}
5
+ * @param pitch {number}
6
+ * @param pitchCorrection {number}
7
+ * @param loopStart {number} sample data points
8
+ * @param loopEnd {number} sample data points
9
+ * @param data {Float32Array}
10
+ */
11
+ constructor(name: string, rate: number, pitch: number, pitchCorrection: number, loopStart: number, loopEnd: number, data: Float32Array);
12
+ /**
13
+ * @type {Float32Array}
14
+ */
15
+ sampleData: Float32Array;
16
+ getRawData(): Uint8Array;
17
+ }
18
+ import { BasicSample } from '../basic_soundfont/basic_sample.js';
@@ -0,0 +1,31 @@
1
+ export class DLSSoundFont extends BasicSoundFont {
2
+ /**
3
+ * Loads a new DLS (Downloadable sounds) soundfont
4
+ * @param buffer {ArrayBuffer}
5
+ */
6
+ constructor(buffer: ArrayBuffer);
7
+ dataArray: IndexedByteArray;
8
+ instrumentAmount: number;
9
+ /**
10
+ * @param chunk {RiffChunk}
11
+ * @param expected {string}
12
+ */
13
+ verifyHeader(chunk: RiffChunk, expected: string): void;
14
+ /**
15
+ * @param text {string}
16
+ * @param expected {string}
17
+ */
18
+ verifyText(text: string, expected: string): void;
19
+ readDLSInstrumentList: typeof readDLSInstrumentList;
20
+ readDLSInstrument: typeof readDLSInstrument;
21
+ readRegion: typeof readRegion;
22
+ readLart: typeof readLart;
23
+ readDLSSamples: typeof readDLSSamples;
24
+ }
25
+ import { BasicSoundFont } from '../basic_soundfont/basic_soundfont.js';
26
+ import { IndexedByteArray } from '../../utils/indexed_array.js';
27
+ import { readDLSInstrumentList } from './read_instrument_list.js';
28
+ import { readDLSInstrument } from './read_instrument.js';
29
+ import { readRegion } from './read_region.js';
30
+ import { readLart } from './read_lart.js';
31
+ import { readDLSSamples } from './read_samples.js';
@@ -0,0 +1,22 @@
1
+ export type DLSSources = number;
2
+ export namespace DLSSources {
3
+ let none: number;
4
+ let modLfo: number;
5
+ let velocity: number;
6
+ let keyNum: number;
7
+ let volEnv: number;
8
+ let modEnv: number;
9
+ let pitchWheel: number;
10
+ let polyPressure: number;
11
+ let channelPressure: number;
12
+ let vibratoLfo: number;
13
+ let modulationWheel: number;
14
+ let volume: number;
15
+ let pan: number;
16
+ let expression: number;
17
+ let chorus: number;
18
+ let reverb: number;
19
+ let pitchWheelRange: number;
20
+ let fineTune: number;
21
+ let coarseTune: number;
22
+ }