spessasynth_lib 3.16.4 → 3.17.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.
- package/@types/index.d.ts +5 -4
- package/@types/midi_parser/basic_midi.d.ts +125 -0
- package/@types/midi_parser/midi_builder.d.ts +69 -0
- package/@types/midi_parser/midi_data.d.ts +2 -2
- package/@types/midi_parser/midi_editor.d.ts +4 -4
- package/@types/midi_parser/midi_loader.d.ts +3 -100
- package/@types/midi_parser/midi_writer.d.ts +2 -2
- package/@types/midi_parser/rmidi_writer.d.ts +4 -3
- package/@types/midi_parser/used_keys_loaded.d.ts +2 -2
- package/@types/sequencer/sequencer.d.ts +1 -1
- package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +5 -4
- package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +2 -2
- package/@types/soundfont/dls/dls_preset.d.ts +11 -0
- package/@types/soundfont/dls/dls_soundfont.d.ts +24 -0
- package/@types/soundfont/dls/read_instrument.d.ts +5 -0
- package/@types/soundfont/dls/read_instrument_list.d.ts +5 -0
- package/@types/soundfont/load_soundfont.d.ts +6 -0
- package/@types/soundfont/soundfont.d.ts +2 -1
- package/@types/synthetizer/synthetizer.d.ts +2 -2
- package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +2 -2
- package/@types/utils/byte_functions/little_endian.d.ts +1 -1
- package/README.md +17 -15
- package/index.js +6 -4
- package/midi_parser/basic_midi.js +146 -0
- package/midi_parser/midi_builder.js +281 -0
- package/midi_parser/midi_data.js +1 -1
- package/midi_parser/midi_editor.js +2 -2
- package/midi_parser/midi_loader.js +17 -53
- package/midi_parser/midi_writer.js +1 -1
- package/midi_parser/rmidi_writer.js +227 -246
- package/midi_parser/used_keys_loaded.js +1 -1
- package/package.json +1 -1
- package/sequencer/sequencer.js +1 -1
- package/sequencer/worklet_sequencer/song_control.js +3 -3
- package/sequencer/worklet_sequencer/worklet_sequencer.js +1 -1
- package/soundfont/basic_soundfont/basic_soundfont.js +25 -10
- package/soundfont/basic_soundfont/riff_chunk.js +2 -2
- package/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js +1 -1
- package/soundfont/dls/dls_preset.js +25 -0
- package/soundfont/dls/dls_soundfont.js +93 -0
- package/soundfont/dls/read_instrument.js +22 -0
- package/soundfont/dls/read_instrument_list.js +17 -0
- package/soundfont/load_soundfont.js +21 -0
- package/soundfont/read_sf2/instruments.js +2 -2
- package/soundfont/read_sf2/modulators.js +5 -5
- package/soundfont/read_sf2/presets.js +7 -7
- package/soundfont/read_sf2/samples.js +8 -8
- package/soundfont/read_sf2/zones.js +5 -5
- package/soundfont/soundfont.js +8 -3
- package/synthetizer/synthetizer.js +1 -1
- package/synthetizer/worklet_processor.min.js +7 -6
- package/synthetizer/worklet_system/main_processor.js +1 -2
- package/synthetizer/worklet_system/worklet_methods/program_control.js +12 -20
- package/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/worklet_soundfont_manager.js +5 -5
- package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +1 -1
- package/utils/byte_functions/little_endian.js +1 -1
- /package/@types/{midi_handler → external_midi}/midi_handler.d.ts +0 -0
- /package/@types/{midi_handler → external_midi}/web_midi_link.d.ts +0 -0
- /package/{midi_handler → external_midi}/README.md +0 -0
- /package/{midi_handler → external_midi}/midi_handler.js +0 -0
- /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 {
|
|
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
|
|
26
|
-
import { WebMidiLinkHandler } from
|
|
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,
|
|
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';
|
|
@@ -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 {
|
|
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:
|
|
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 {
|
|
41
|
+
* @param midi {BasicMIDI}
|
|
42
42
|
* @param snapshot {SynthesizerSnapshot}
|
|
43
43
|
*/
|
|
44
|
-
export function applySnapshotToMIDI(midi:
|
|
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 {
|
|
3
|
+
* @param midi {BasicMIDI}
|
|
4
4
|
* @returns {Uint8Array} the binary .mid file data
|
|
5
5
|
*/
|
|
6
|
-
export function writeMIDIFile(midi:
|
|
6
|
+
export function writeMIDIFile(midi: BasicMIDI): Uint8Array;
|
|
@@ -14,14 +14,15 @@
|
|
|
14
14
|
/**
|
|
15
15
|
* Writes an RMIDI file
|
|
16
16
|
* @param soundfontBinary {Uint8Array}
|
|
17
|
-
* @param mid {
|
|
18
|
-
* @param soundfont {
|
|
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
|
+
* @param correctBankOffset {boolean}
|
|
22
23
|
* @returns {IndexedByteArray}
|
|
23
24
|
*/
|
|
24
|
-
export function writeRMIDI(soundfontBinary: Uint8Array, mid:
|
|
25
|
+
export function writeRMIDI(soundfontBinary: Uint8Array, mid: BasicMIDI, soundfont: BasicSoundFont, bankOffset?: number, encoding?: string, metadata?: RMIDMetadata, correctBankOffset?: boolean): IndexedByteArray;
|
|
25
26
|
export type RMIDINFOChunks = string;
|
|
26
27
|
export namespace RMIDINFOChunks {
|
|
27
28
|
let name: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param mid {
|
|
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:
|
|
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 =
|
|
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
|
|
@@ -53,10 +53,11 @@ export class BasicSoundFont {
|
|
|
53
53
|
/**
|
|
54
54
|
* Get the appropriate preset, undefined if not foun d
|
|
55
55
|
* @param bankNr {number}
|
|
56
|
-
* @param
|
|
56
|
+
* @param programNr {number}
|
|
57
|
+
* @param fallbackToProgram {boolean} if true, if no exact match is found, will use any bank with the given preset
|
|
57
58
|
* @return {BasicPreset}
|
|
58
59
|
*/
|
|
59
|
-
getPresetNoFallback(bankNr: number,
|
|
60
|
+
getPresetNoFallback(bankNr: number, programNr: number, fallbackToProgram?: boolean): BasicPreset;
|
|
60
61
|
/**
|
|
61
62
|
* To avoid overlapping on multiple desfonts
|
|
62
63
|
* @param offset {number}
|
|
@@ -65,10 +66,10 @@ export class BasicSoundFont {
|
|
|
65
66
|
/**
|
|
66
67
|
* Get the appropriate preset
|
|
67
68
|
* @param bankNr {number}
|
|
68
|
-
* @param
|
|
69
|
+
* @param programNr {number}
|
|
69
70
|
* @returns {BasicPreset}
|
|
70
71
|
*/
|
|
71
|
-
getPreset(bankNr: number,
|
|
72
|
+
getPreset(bankNr: number, programNr: number): BasicPreset;
|
|
72
73
|
/**
|
|
73
74
|
* gets preset by name
|
|
74
75
|
* @param presetName {string}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param soundfont {BasicSoundFont}
|
|
3
|
-
* @param mid {
|
|
3
|
+
* @param mid {BasicMIDI}
|
|
4
4
|
* @returns {Uint8Array}
|
|
5
5
|
*/
|
|
6
|
-
export function trimSoundfont(soundfont: BasicSoundFont, mid:
|
|
6
|
+
export function trimSoundfont(soundfont: BasicSoundFont, mid: BasicMIDI): Uint8Array;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export class DLSPreset extends BasicPreset {
|
|
2
|
+
/**
|
|
3
|
+
* Creates a new DLS preset
|
|
4
|
+
* @param ulBank {number} the ULONG value
|
|
5
|
+
* @param ulInstrument {number} the ULONG value
|
|
6
|
+
* @param regionsAmount {number}
|
|
7
|
+
*/
|
|
8
|
+
constructor(ulBank: number, ulInstrument: number, regionsAmount: number);
|
|
9
|
+
regionsAmount: number;
|
|
10
|
+
}
|
|
11
|
+
import { BasicPreset } from '../basic_soundfont/basic_preset.js';
|
|
@@ -0,0 +1,24 @@
|
|
|
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: any;
|
|
8
|
+
instrumentAmount: any;
|
|
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
|
+
}
|
|
22
|
+
import { BasicSoundFont } from '../basic_soundfont/basic_soundfont.js';
|
|
23
|
+
import { readDLSInstrumentList } from './read_instrument_list.js';
|
|
24
|
+
import { readDLSInstrument } from './read_instrument.js';
|
|
@@ -6,8 +6,9 @@ export class SoundFont2 extends BasicSoundFont {
|
|
|
6
6
|
/**
|
|
7
7
|
* Initializes a new SoundFont2 Parser and parses the given data array
|
|
8
8
|
* @param arrayBuffer {ArrayBuffer}
|
|
9
|
+
* @param warnDeprecated {boolean}
|
|
9
10
|
*/
|
|
10
|
-
constructor(arrayBuffer: ArrayBuffer);
|
|
11
|
+
constructor(arrayBuffer: ArrayBuffer, warnDeprecated?: boolean);
|
|
11
12
|
dataArray: IndexedByteArray;
|
|
12
13
|
sampleDataStartIndex: number;
|
|
13
14
|
instruments: import("./read_sf2/instruments.js").Instrument[];
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @typedef {Object} StartRenderingDataConfig
|
|
7
|
-
* @property {
|
|
7
|
+
* @property {BasicMIDI} parsedMIDI - the MIDI to render
|
|
8
8
|
* @property {SynthesizerSnapshot} snapshot - the snapshot to apply
|
|
9
9
|
* @property {boolean|undefined} oneOutput - if synth should use one output with 32 channels (2 audio channels for each midi channel). this disables chorus and reverb.
|
|
10
10
|
*/
|
|
@@ -290,7 +290,7 @@ export type StartRenderingDataConfig = {
|
|
|
290
290
|
/**
|
|
291
291
|
* - the MIDI to render
|
|
292
292
|
*/
|
|
293
|
-
parsedMIDI:
|
|
293
|
+
parsedMIDI: BasicMIDI;
|
|
294
294
|
/**
|
|
295
295
|
* - the snapshot to apply
|
|
296
296
|
*/
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* @property {number} NRPFine - the current fine value of the Non-Registered Parameter
|
|
15
15
|
* @property {number} RPValue - the current value of the Registered Parameter
|
|
16
16
|
*
|
|
17
|
-
* @property {
|
|
17
|
+
* @property {BasicPreset} preset - the channel's preset
|
|
18
18
|
* @property {boolean} lockPreset - indicates whether the program on the channel is locked
|
|
19
19
|
* @property {boolean} presetUsesOverride - indcates if the channel uses a preset from the override soundfont.
|
|
20
20
|
*
|
|
@@ -104,7 +104,7 @@ export type WorkletProcessorChannel = {
|
|
|
104
104
|
/**
|
|
105
105
|
* - the channel's preset
|
|
106
106
|
*/
|
|
107
|
-
preset:
|
|
107
|
+
preset: BasicPreset;
|
|
108
108
|
/**
|
|
109
109
|
* - indicates whether the program on the channel is locked
|
|
110
110
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @param bytesAmount {number}
|
|
5
5
|
* @returns {number}
|
|
6
6
|
*/
|
|
7
|
-
export function
|
|
7
|
+
export function readLittleEndian(dataArray: IndexedByteArray, bytesAmount: number): number;
|
|
8
8
|
/**
|
|
9
9
|
* Writes a number as little endian seems to also work for negative numbers so yay?
|
|
10
10
|
* @param dataArray {IndexedByteArray}
|