spessasynth_lib 3.24.3 → 3.24.6
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/README.md +14 -4
- package/midi_parser/midi_loader.js +51 -28
- package/package.json +1 -2
- package/sequencer/sequencer.js +3 -3
- package/sequencer/worklet_sequencer/worklet_sequencer.js +6 -0
- package/synthetizer/synthetizer.js +8 -6
- package/synthetizer/worklet_processor.min.js +9 -9
- package/synthetizer/worklet_system/main_processor.js +9 -7
- package/synthetizer/worklet_system/worklet_methods/note_on.js +2 -1
- package/@types/external_midi/midi_handler.d.ts +0 -39
- package/@types/external_midi/web_midi_link.d.ts +0 -12
- package/@types/externals/stbvorbis_sync/stbvorbis_sync.min.d.ts +0 -1
- package/@types/index.d.ts +0 -44
- package/@types/midi_parser/basic_midi.d.ts +0 -36
- package/@types/midi_parser/midi_builder.d.ts +0 -68
- package/@types/midi_parser/midi_data.d.ts +0 -46
- package/@types/midi_parser/midi_editor.d.ts +0 -89
- package/@types/midi_parser/midi_loader.d.ts +0 -30
- package/@types/midi_parser/midi_message.d.ts +0 -155
- package/@types/midi_parser/midi_sequence.d.ts +0 -135
- package/@types/midi_parser/midi_writer.d.ts +0 -6
- package/@types/midi_parser/rmidi_writer.d.ts +0 -85
- package/@types/midi_parser/used_keys_loaded.d.ts +0 -10
- package/@types/sequencer/sequencer.d.ts +0 -277
- package/@types/sequencer/worklet_sequencer/sequencer_message.d.ts +0 -31
- package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +0 -29
- package/@types/soundfont/basic_soundfont/basic_preset.d.ts +0 -86
- package/@types/soundfont/basic_soundfont/basic_sample.d.ts +0 -88
- package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +0 -102
- package/@types/soundfont/basic_soundfont/basic_zone.d.ts +0 -58
- package/@types/soundfont/basic_soundfont/basic_zones.d.ts +0 -22
- package/@types/soundfont/basic_soundfont/generator.d.ts +0 -102
- package/@types/soundfont/basic_soundfont/modulator.d.ts +0 -92
- package/@types/soundfont/basic_soundfont/riff_chunk.d.ts +0 -45
- package/@types/soundfont/basic_soundfont/write_dls/art2.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_dls/articulator.d.ts +0 -28
- package/@types/soundfont/basic_soundfont/write_dls/combine_zones.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_dls/ins.d.ts +0 -7
- package/@types/soundfont/basic_soundfont/write_dls/lins.d.ts +0 -5
- package/@types/soundfont/basic_soundfont/write_dls/modulator_converter.d.ts +0 -11
- package/@types/soundfont/basic_soundfont/write_dls/rgn2.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_dls/wave.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_dls/write_dls.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_dls/wsmp.d.ts +0 -12
- package/@types/soundfont/basic_soundfont/write_dls/wvpl.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +0 -11
- package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +0 -8
- package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +0 -6
- package/@types/soundfont/basic_soundfont/write_sf2/write.d.ts +0 -21
- package/@types/soundfont/dls/articulator_converter.d.ts +0 -19
- package/@types/soundfont/dls/dls_destinations.d.ts +0 -29
- package/@types/soundfont/dls/dls_preset.d.ts +0 -13
- package/@types/soundfont/dls/dls_sample.d.ts +0 -19
- package/@types/soundfont/dls/dls_soundfont.d.ts +0 -31
- package/@types/soundfont/dls/dls_sources.d.ts +0 -27
- package/@types/soundfont/dls/dls_zone.d.ts +0 -23
- package/@types/soundfont/dls/read_articulation.d.ts +0 -12
- package/@types/soundfont/dls/read_instrument.d.ts +0 -5
- package/@types/soundfont/dls/read_instrument_list.d.ts +0 -5
- package/@types/soundfont/dls/read_lart.d.ts +0 -7
- package/@types/soundfont/dls/read_region.d.ts +0 -7
- package/@types/soundfont/dls/read_samples.d.ts +0 -5
- package/@types/soundfont/load_soundfont.d.ts +0 -6
- package/@types/soundfont/read_sf2/generators.d.ts +0 -16
- package/@types/soundfont/read_sf2/instruments.d.ts +0 -29
- package/@types/soundfont/read_sf2/modulators.d.ts +0 -15
- package/@types/soundfont/read_sf2/presets.d.ts +0 -30
- package/@types/soundfont/read_sf2/samples.d.ts +0 -55
- package/@types/soundfont/read_sf2/soundfont.d.ts +0 -28
- package/@types/soundfont/read_sf2/zones.d.ts +0 -99
- package/@types/synthetizer/audio_effects/effects_config.d.ts +0 -41
- package/@types/synthetizer/audio_effects/fancy_chorus.d.ts +0 -97
- package/@types/synthetizer/audio_effects/reverb.d.ts +0 -7
- package/@types/synthetizer/key_modifier_manager.d.ts +0 -56
- package/@types/synthetizer/synth_event_handler.d.ts +0 -263
- package/@types/synthetizer/synth_soundfont_manager.d.ts +0 -52
- package/@types/synthetizer/synthetizer.d.ts +0 -358
- package/@types/synthetizer/worklet_system/message_protocol/worklet_message.d.ts +0 -98
- package/@types/synthetizer/worklet_system/worklet_methods/worklet_key_modifier.d.ts +0 -77
- package/@types/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/sfman_message.d.ts +0 -7
- package/@types/synthetizer/worklet_system/worklet_utilities/controller_tables.d.ts +0 -23
- package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +0 -155
- package/@types/synthetizer/worklet_url.d.ts +0 -5
- package/@types/utils/buffer_to_wav.d.ts +0 -31
- package/@types/utils/byte_functions/big_endian.d.ts +0 -13
- package/@types/utils/byte_functions/little_endian.d.ts +0 -35
- package/@types/utils/byte_functions/string.d.ts +0 -27
- package/@types/utils/byte_functions/variable_length_quantity.d.ts +0 -12
- package/@types/utils/indexed_array.d.ts +0 -21
- package/@types/utils/loggin.d.ts +0 -26
- package/@types/utils/other.d.ts +0 -37
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the base type for MIDI files. It contains all the "metadata" and information.
|
|
3
|
-
* It extends to:
|
|
4
|
-
* - BasicMIDI, which contains the actual track data of the MIDI file. Essentially the MIDI file itself.
|
|
5
|
-
* - MidiData, which contains all properties that MIDI does, except for tracks and the embedded soundfont.
|
|
6
|
-
* MidiData is the "shell" of the file which is available on the main thread at all times, containing the metadata.
|
|
7
|
-
*/
|
|
8
|
-
export class MIDISequenceData {
|
|
9
|
-
/**
|
|
10
|
-
* The time division of the sequence, representing the number of ticks per beat.
|
|
11
|
-
* @type {number}
|
|
12
|
-
*/
|
|
13
|
-
timeDivision: number;
|
|
14
|
-
/**
|
|
15
|
-
* The duration of the sequence, in seconds.
|
|
16
|
-
* @type {number}
|
|
17
|
-
*/
|
|
18
|
-
duration: number;
|
|
19
|
-
/**
|
|
20
|
-
* The tempo changes in the sequence, ordered from the last change to the first.
|
|
21
|
-
* Each change is represented by an object with a tick position and a tempo value in beats per minute.
|
|
22
|
-
* @type {{ticks: number, tempo: number}[]}
|
|
23
|
-
*/
|
|
24
|
-
tempoChanges: {
|
|
25
|
-
ticks: number;
|
|
26
|
-
tempo: number;
|
|
27
|
-
}[];
|
|
28
|
-
/**
|
|
29
|
-
* A string containing the copyright information for the MIDI sequence if detected.
|
|
30
|
-
* @type {string}
|
|
31
|
-
*/
|
|
32
|
-
copyright: string;
|
|
33
|
-
/**
|
|
34
|
-
* The number of tracks in the MIDI sequence.
|
|
35
|
-
* @type {number}
|
|
36
|
-
*/
|
|
37
|
-
tracksAmount: number;
|
|
38
|
-
/**
|
|
39
|
-
* An array containing the lyrics of the sequence, stored as binary chunks (Uint8Array).
|
|
40
|
-
* @type {Uint8Array[]}
|
|
41
|
-
*/
|
|
42
|
-
lyrics: Uint8Array[];
|
|
43
|
-
/**
|
|
44
|
-
* An array of tick positions where lyrics events occur in the sequence.
|
|
45
|
-
* @type {number[]}
|
|
46
|
-
*/
|
|
47
|
-
lyricsTicks: number[];
|
|
48
|
-
/**
|
|
49
|
-
* The tick position of the first note-on event in the MIDI sequence.
|
|
50
|
-
* @type {number}
|
|
51
|
-
*/
|
|
52
|
-
firstNoteOn: number;
|
|
53
|
-
/**
|
|
54
|
-
* The MIDI key range used in the sequence, represented by a minimum and maximum note value.
|
|
55
|
-
* @type {{min: number, max: number}}
|
|
56
|
-
*/
|
|
57
|
-
keyRange: {
|
|
58
|
-
min: number;
|
|
59
|
-
max: number;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* The tick position of the last voice event (such as note-on, note-off, or control change) in the sequence.
|
|
63
|
-
* @type {number}
|
|
64
|
-
*/
|
|
65
|
-
lastVoiceEventTick: number;
|
|
66
|
-
/**
|
|
67
|
-
* An array of MIDI port numbers used by each track in the sequence.
|
|
68
|
-
* @type {number[]}
|
|
69
|
-
*/
|
|
70
|
-
midiPorts: number[];
|
|
71
|
-
/**
|
|
72
|
-
* An array of channel offsets for each MIDI port, using the SpessaSynth method.
|
|
73
|
-
* @type {number[]}
|
|
74
|
-
*/
|
|
75
|
-
midiPortChannelOffsets: number[];
|
|
76
|
-
/**
|
|
77
|
-
* A list of sets, where each set contains the MIDI channels used by each track in the sequence.
|
|
78
|
-
* @type {Set<number>[]}
|
|
79
|
-
*/
|
|
80
|
-
usedChannelsOnTrack: Set<number>[];
|
|
81
|
-
/**
|
|
82
|
-
* The loop points (in ticks) of the sequence, including both start and end points.
|
|
83
|
-
* @type {{start: number, end: number}}
|
|
84
|
-
*/
|
|
85
|
-
loop: {
|
|
86
|
-
start: number;
|
|
87
|
-
end: number;
|
|
88
|
-
};
|
|
89
|
-
/**
|
|
90
|
-
* The name of the MIDI sequence.
|
|
91
|
-
* @type {string}
|
|
92
|
-
*/
|
|
93
|
-
midiName: string;
|
|
94
|
-
/**
|
|
95
|
-
* A boolean indicating if the sequence's name is the same as the file name.
|
|
96
|
-
* @type {boolean}
|
|
97
|
-
*/
|
|
98
|
-
midiNameUsesFileName: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* The file name of the MIDI sequence, if provided during parsing.
|
|
101
|
-
* @type {string}
|
|
102
|
-
*/
|
|
103
|
-
fileName: string;
|
|
104
|
-
/**
|
|
105
|
-
* The raw, encoded MIDI name, represented as a Uint8Array.
|
|
106
|
-
* Useful when the MIDI file uses a different code page.
|
|
107
|
-
* @type {Uint8Array}
|
|
108
|
-
*/
|
|
109
|
-
rawMidiName: Uint8Array;
|
|
110
|
-
/**
|
|
111
|
-
* The format of the MIDI file, which can be 0, 1, or 2, indicating the type of the MIDI file.
|
|
112
|
-
* @type {number}
|
|
113
|
-
*/
|
|
114
|
-
format: number;
|
|
115
|
-
/**
|
|
116
|
-
* The RMID (Resource Interchangeable MIDI) info data, if the file is RMID formatted.
|
|
117
|
-
* Otherwise, this field is undefined.
|
|
118
|
-
* Chunk type (e.g. "INAM"): Chunk data as binary array.
|
|
119
|
-
* @type {Object<string, IndexedByteArray>}
|
|
120
|
-
*/
|
|
121
|
-
RMIDInfo: {
|
|
122
|
-
[x: string]: IndexedByteArray;
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* The bank offset used for RMID files.
|
|
126
|
-
* @type {number}
|
|
127
|
-
*/
|
|
128
|
-
bankOffset: number;
|
|
129
|
-
/**
|
|
130
|
-
* If the MIDI file is a Soft Karaoke file (.kar), this flag is set to true.
|
|
131
|
-
* https://www.mixagesoftware.com/en/midikit/help/HTML/karaoke_formats.html
|
|
132
|
-
* @type {boolean}
|
|
133
|
-
*/
|
|
134
|
-
isKaraokeFile: boolean;
|
|
135
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} RMIDMetadata
|
|
3
|
-
* @property {string|undefined} name - the name of the file
|
|
4
|
-
* @property {string|undefined} engineer - the engineer who worked on the file
|
|
5
|
-
* @property {string|undefined} artist - the artist
|
|
6
|
-
* @property {string|undefined} album - the album
|
|
7
|
-
* @property {string|undefined} genre - the genre of the song
|
|
8
|
-
* @property {ArrayBuffer|undefined} picture - the image for the file (album cover)
|
|
9
|
-
* @property {string|undefined} comment - the coment of the file
|
|
10
|
-
* @property {string|undefined} creationDate - the creation date of the file
|
|
11
|
-
* @property {string|undefined} copyright - the copyright of the file
|
|
12
|
-
* @property {string|unescape} midiEncoding - the encoding of the inner MIDI file
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Writes an RMIDI file
|
|
16
|
-
* @param soundfontBinary {Uint8Array}
|
|
17
|
-
* @param mid {BasicMIDI}
|
|
18
|
-
* @param soundfont {BasicSoundFont}
|
|
19
|
-
* @param bankOffset {number} the bank offset for RMIDI
|
|
20
|
-
* @param encoding {string} the encoding of the RMIDI info chunk
|
|
21
|
-
* @param metadata {RMIDMetadata} the metadata of the file. Optional. If provided, the encoding is forced to utf-8/
|
|
22
|
-
* @param correctBankOffset {boolean}
|
|
23
|
-
* @returns {IndexedByteArray}
|
|
24
|
-
*/
|
|
25
|
-
export function writeRMIDI(soundfontBinary: Uint8Array, mid: BasicMIDI, soundfont: BasicSoundFont, bankOffset?: number, encoding?: string, metadata?: RMIDMetadata, correctBankOffset?: boolean): IndexedByteArray;
|
|
26
|
-
export type RMIDINFOChunks = string;
|
|
27
|
-
export namespace RMIDINFOChunks {
|
|
28
|
-
let name: string;
|
|
29
|
-
let album: string;
|
|
30
|
-
let album2: string;
|
|
31
|
-
let artist: string;
|
|
32
|
-
let genre: string;
|
|
33
|
-
let picture: string;
|
|
34
|
-
let copyright: string;
|
|
35
|
-
let creationDate: string;
|
|
36
|
-
let comment: string;
|
|
37
|
-
let engineer: string;
|
|
38
|
-
let software: string;
|
|
39
|
-
let encoding: string;
|
|
40
|
-
let midiEncoding: string;
|
|
41
|
-
let bankOffset: string;
|
|
42
|
-
}
|
|
43
|
-
export type RMIDMetadata = {
|
|
44
|
-
/**
|
|
45
|
-
* - the name of the file
|
|
46
|
-
*/
|
|
47
|
-
name: string | undefined;
|
|
48
|
-
/**
|
|
49
|
-
* - the engineer who worked on the file
|
|
50
|
-
*/
|
|
51
|
-
engineer: string | undefined;
|
|
52
|
-
/**
|
|
53
|
-
* - the artist
|
|
54
|
-
*/
|
|
55
|
-
artist: string | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* - the album
|
|
58
|
-
*/
|
|
59
|
-
album: string | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* - the genre of the song
|
|
62
|
-
*/
|
|
63
|
-
genre: string | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* - the image for the file (album cover)
|
|
66
|
-
*/
|
|
67
|
-
picture: ArrayBuffer | undefined;
|
|
68
|
-
/**
|
|
69
|
-
* - the coment of the file
|
|
70
|
-
*/
|
|
71
|
-
comment: string | undefined;
|
|
72
|
-
/**
|
|
73
|
-
* - the creation date of the file
|
|
74
|
-
*/
|
|
75
|
-
creationDate: string | undefined;
|
|
76
|
-
/**
|
|
77
|
-
* - the copyright of the file
|
|
78
|
-
*/
|
|
79
|
-
copyright: string | undefined;
|
|
80
|
-
/**
|
|
81
|
-
* - the encoding of the inner MIDI file
|
|
82
|
-
*/
|
|
83
|
-
midiEncoding: string | typeof unescape;
|
|
84
|
-
};
|
|
85
|
-
import { IndexedByteArray } from "../utils/indexed_array.js";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @param mid {BasicMIDI}
|
|
3
|
-
* @param soundfont {{getPreset: function(number, number): BasicPreset}}
|
|
4
|
-
* @returns {Object<string, Set<string>>}
|
|
5
|
-
*/
|
|
6
|
-
export function getUsedProgramsAndKeys(mid: BasicMIDI, soundfont: {
|
|
7
|
-
getPreset: (arg0: number, arg1: number) => BasicPreset;
|
|
8
|
-
}): {
|
|
9
|
-
[x: string]: Set<string>;
|
|
10
|
-
};
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
export class Sequencer {
|
|
2
|
-
/**
|
|
3
|
-
* Creates a new Midi sequencer for playing back MIDI files
|
|
4
|
-
* @param midiBinaries {MIDIFile[]} List of the buffers of the MIDI files
|
|
5
|
-
* @param synth {Synthetizer} synth to send events to
|
|
6
|
-
* @param options {SequencerOptions} the sequencer's options
|
|
7
|
-
*/
|
|
8
|
-
constructor(midiBinaries: MIDIFile[], synth: Synthetizer, options?: SequencerOptions);
|
|
9
|
-
/**
|
|
10
|
-
* Executes when MIDI parsing has an error.
|
|
11
|
-
* @type {function(string)}
|
|
12
|
-
*/
|
|
13
|
-
onError: (arg0: string) => any;
|
|
14
|
-
/**
|
|
15
|
-
* The sequence's data, except for the track data.
|
|
16
|
-
* @type {MidiData}
|
|
17
|
-
*/
|
|
18
|
-
midiData: MidiData;
|
|
19
|
-
/**
|
|
20
|
-
* @type {Object<string, function(MidiData)>}
|
|
21
|
-
* @private
|
|
22
|
-
*/
|
|
23
|
-
private onSongChange;
|
|
24
|
-
/**
|
|
25
|
-
* Fires on text event
|
|
26
|
-
* @type {function}
|
|
27
|
-
* @param data {Uint8Array} the data text
|
|
28
|
-
* @param type {number} the status byte of the message (the meta-status byte)
|
|
29
|
-
* @param lyricsIndex {number} if the text is a lyric, the index of the lyric in midiData.lyrics, otherwise -1
|
|
30
|
-
*/
|
|
31
|
-
onTextEvent: Function;
|
|
32
|
-
/**
|
|
33
|
-
* Fires when CurrentTime changes
|
|
34
|
-
* @type {Object<string, function(number)>} the time that was changed to
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
private onTimeChange;
|
|
38
|
-
/**
|
|
39
|
-
* @type {Object<string, function>}
|
|
40
|
-
* @private
|
|
41
|
-
*/
|
|
42
|
-
private onSongEnded;
|
|
43
|
-
/**
|
|
44
|
-
* Fires on tempo change
|
|
45
|
-
* @type {Object<string, function(number)>}
|
|
46
|
-
*/
|
|
47
|
-
onTempoChange: {
|
|
48
|
-
[x: string]: (arg0: number) => any;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Current song's tempo in BPM
|
|
52
|
-
* @type {number}
|
|
53
|
-
*/
|
|
54
|
-
currentTempo: number;
|
|
55
|
-
/**
|
|
56
|
-
* Current song index
|
|
57
|
-
* @type {number}
|
|
58
|
-
*/
|
|
59
|
-
songIndex: number;
|
|
60
|
-
/**
|
|
61
|
-
* @type {function(BasicMIDI)}
|
|
62
|
-
* @private
|
|
63
|
-
*/
|
|
64
|
-
private _getMIDIResolve;
|
|
65
|
-
/**
|
|
66
|
-
* Indicates if the current midiData property has fake data in it (not yet loaded)
|
|
67
|
-
* @type {boolean}
|
|
68
|
-
*/
|
|
69
|
-
hasDummyData: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Indicates whether the sequencer has finished playing a sequence
|
|
72
|
-
* @type {boolean}
|
|
73
|
-
*/
|
|
74
|
-
isFinished: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* The current sequence's length, in seconds
|
|
77
|
-
* @type {number}
|
|
78
|
-
*/
|
|
79
|
-
duration: number;
|
|
80
|
-
/**
|
|
81
|
-
* Indicates if the sequencer is paused.
|
|
82
|
-
* Paused if a number, undefined if playing
|
|
83
|
-
* @type {undefined|number}
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
|
-
private pausedTime;
|
|
87
|
-
ignoreEvents: boolean;
|
|
88
|
-
synth: Synthetizer;
|
|
89
|
-
highResTimeOffset: number;
|
|
90
|
-
/**
|
|
91
|
-
* Absolute playback startTime, bases on the synth's time
|
|
92
|
-
* @type {number}
|
|
93
|
-
*/
|
|
94
|
-
absoluteStartTime: number;
|
|
95
|
-
/**
|
|
96
|
-
* @type {boolean}
|
|
97
|
-
* @private
|
|
98
|
-
*/
|
|
99
|
-
private _skipToFirstNoteOn;
|
|
100
|
-
/**
|
|
101
|
-
* @type {boolean}
|
|
102
|
-
* @private
|
|
103
|
-
*/
|
|
104
|
-
private _preservePlaybackState;
|
|
105
|
-
/**
|
|
106
|
-
* Internal loop marker
|
|
107
|
-
* @type {boolean}
|
|
108
|
-
* @private
|
|
109
|
-
*/
|
|
110
|
-
private _loop;
|
|
111
|
-
set loop(value: boolean);
|
|
112
|
-
get loop(): boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Controls the playback's rate
|
|
115
|
-
* @type {number}
|
|
116
|
-
* @private
|
|
117
|
-
*/
|
|
118
|
-
private _playbackRate;
|
|
119
|
-
/**
|
|
120
|
-
* @param value {number}
|
|
121
|
-
*/
|
|
122
|
-
set playbackRate(value: number);
|
|
123
|
-
/**
|
|
124
|
-
* @returns {number}
|
|
125
|
-
*/
|
|
126
|
-
get playbackRate(): number;
|
|
127
|
-
/**
|
|
128
|
-
* Indicates if the sequencer should skip to first note on
|
|
129
|
-
* @param val {boolean}
|
|
130
|
-
*/
|
|
131
|
-
set skipToFirstNoteOn(val: boolean);
|
|
132
|
-
/**
|
|
133
|
-
* Indicates if the sequencer should skip to first note on
|
|
134
|
-
* @return {boolean}
|
|
135
|
-
*/
|
|
136
|
-
get skipToFirstNoteOn(): boolean;
|
|
137
|
-
/**
|
|
138
|
-
* if true,
|
|
139
|
-
* the sequencer will stay paused when seeking or changing the playback rate
|
|
140
|
-
* @param val {boolean}
|
|
141
|
-
*/
|
|
142
|
-
set preservePlaybackState(val: boolean);
|
|
143
|
-
/**
|
|
144
|
-
* if true,
|
|
145
|
-
* the sequencer will stay paused when seeking or changing the playback rate
|
|
146
|
-
* @returns {boolean}
|
|
147
|
-
*/
|
|
148
|
-
get preservePlaybackState(): boolean;
|
|
149
|
-
set currentTime(time: number);
|
|
150
|
-
/**
|
|
151
|
-
* @returns {number} Current playback time, in seconds
|
|
152
|
-
*/
|
|
153
|
-
get currentTime(): number;
|
|
154
|
-
/**
|
|
155
|
-
* Use for visualization as it's not affected by the audioContext stutter
|
|
156
|
-
* @returns {number}
|
|
157
|
-
*/
|
|
158
|
-
get currentHighResolutionTime(): number;
|
|
159
|
-
/**
|
|
160
|
-
* true if paused, false if playing or stopped
|
|
161
|
-
* @returns {boolean}
|
|
162
|
-
*/
|
|
163
|
-
get paused(): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Adds a new event that gets called when the song changes
|
|
166
|
-
* @param callback {function(MidiData)}
|
|
167
|
-
* @param id {string} must be unique
|
|
168
|
-
*/
|
|
169
|
-
addOnSongChangeEvent(callback: (arg0: MidiData) => any, id: string): void;
|
|
170
|
-
/**
|
|
171
|
-
* Adds a new event that gets called when the song ends
|
|
172
|
-
* @param callback {function}
|
|
173
|
-
* @param id {string} must be unique
|
|
174
|
-
*/
|
|
175
|
-
addOnSongEndedEvent(callback: Function, id: string): void;
|
|
176
|
-
/**
|
|
177
|
-
* Adds a new event that gets called when the time changes
|
|
178
|
-
* @param callback {function(number)} the new time, in seconds
|
|
179
|
-
* @param id {string} must be unique
|
|
180
|
-
*/
|
|
181
|
-
addOnTimeChangeEvent(callback: (arg0: number) => any, id: string): void;
|
|
182
|
-
/**
|
|
183
|
-
* Adds a new event that gets called when the tempo changes
|
|
184
|
-
* @param callback {function(number)} the new tempo, in BPM
|
|
185
|
-
* @param id {string} must be unique
|
|
186
|
-
*/
|
|
187
|
-
addOnTempoChangeEvent(callback: (arg0: number) => any, id: string): void;
|
|
188
|
-
resetMIDIOut(): void;
|
|
189
|
-
/**
|
|
190
|
-
* @param messageType {WorkletSequencerMessageType}
|
|
191
|
-
* @param messageData {any}
|
|
192
|
-
* @private
|
|
193
|
-
*/
|
|
194
|
-
private _sendMessage;
|
|
195
|
-
nextSong(): void;
|
|
196
|
-
previousSong(): void;
|
|
197
|
-
/**
|
|
198
|
-
* @param type {Object<string, function>}
|
|
199
|
-
* @param params {any}
|
|
200
|
-
* @private
|
|
201
|
-
*/
|
|
202
|
-
private _callEvents;
|
|
203
|
-
/**
|
|
204
|
-
* @param {WorkletSequencerReturnMessageType} messageType
|
|
205
|
-
* @param {any} messageData
|
|
206
|
-
* @private
|
|
207
|
-
*/
|
|
208
|
-
private _handleMessage;
|
|
209
|
-
/**
|
|
210
|
-
* @param time
|
|
211
|
-
* @private
|
|
212
|
-
*/
|
|
213
|
-
private _recalculateStartTime;
|
|
214
|
-
/**
|
|
215
|
-
* @returns {Promise<MIDI>}
|
|
216
|
-
*/
|
|
217
|
-
getMIDI(): Promise<MIDI>;
|
|
218
|
-
/**
|
|
219
|
-
* Loads a new song list
|
|
220
|
-
* @param midiBuffers {MIDIFile[]} - the MIDI files to play
|
|
221
|
-
* @param autoPlay {boolean} - if true, the first sequence will automatically start playing
|
|
222
|
-
*/
|
|
223
|
-
loadNewSongList(midiBuffers: MIDIFile[], autoPlay?: boolean): void;
|
|
224
|
-
songsAmount: number;
|
|
225
|
-
/**
|
|
226
|
-
* @param output {MIDIOutput}
|
|
227
|
-
*/
|
|
228
|
-
connectMidiOutput(output: MIDIOutput): void;
|
|
229
|
-
MIDIout: MIDIOutput;
|
|
230
|
-
/**
|
|
231
|
-
* Pauses the playback
|
|
232
|
-
*/
|
|
233
|
-
pause(): void;
|
|
234
|
-
unpause(): void;
|
|
235
|
-
/**
|
|
236
|
-
* Starts the playback
|
|
237
|
-
* @param resetTime {boolean} If true, time is set to 0 s
|
|
238
|
-
*/
|
|
239
|
-
play(resetTime?: boolean): void;
|
|
240
|
-
/**
|
|
241
|
-
* Stops the playback
|
|
242
|
-
*/
|
|
243
|
-
stop(): void;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* {Object}
|
|
247
|
-
*/
|
|
248
|
-
export type MidFile = {
|
|
249
|
-
/**
|
|
250
|
-
* - the binary data of the file.
|
|
251
|
-
*/
|
|
252
|
-
binary: ArrayBuffer;
|
|
253
|
-
/**
|
|
254
|
-
* - the alternative name for the file
|
|
255
|
-
*/
|
|
256
|
-
altName: string | undefined;
|
|
257
|
-
};
|
|
258
|
-
export type MIDIFile = BasicMIDI | MidFile;
|
|
259
|
-
export type SequencerOptions = {
|
|
260
|
-
/**
|
|
261
|
-
* - if true, the sequencer will skip to the first note
|
|
262
|
-
*/
|
|
263
|
-
skipToFirstNoteOn: boolean | undefined;
|
|
264
|
-
/**
|
|
265
|
-
* - if true, the sequencer will automatically start playing the MIDI
|
|
266
|
-
*/
|
|
267
|
-
autoPlay: boolean | undefined;
|
|
268
|
-
/**
|
|
269
|
-
* - if true,
|
|
270
|
-
* the sequencer will stay paused when seeking or changing the playback rate
|
|
271
|
-
*/
|
|
272
|
-
preservePlaybackState: boolean | typeof unescape;
|
|
273
|
-
};
|
|
274
|
-
import { MidiData } from "../midi_parser/midi_data.js";
|
|
275
|
-
import { Synthetizer } from "../synthetizer/synthetizer.js";
|
|
276
|
-
import { MIDI } from "../midi_parser/midi_loader.js";
|
|
277
|
-
import { BasicMIDI } from "../midi_parser/basic_midi.js";
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* *
|
|
3
|
-
*/
|
|
4
|
-
export type WorkletSequencerMessageType = number;
|
|
5
|
-
export namespace WorkletSequencerMessageType {
|
|
6
|
-
let loadNewSongList: number;
|
|
7
|
-
let pause: number;
|
|
8
|
-
let stop: number;
|
|
9
|
-
let play: number;
|
|
10
|
-
let setTime: number;
|
|
11
|
-
let changeMIDIMessageSending: number;
|
|
12
|
-
let setPlaybackRate: number;
|
|
13
|
-
let setLoop: number;
|
|
14
|
-
let changeSong: number;
|
|
15
|
-
let getMIDI: number;
|
|
16
|
-
let setSkipToFirstNote: number;
|
|
17
|
-
let setPreservePlaybackState: number;
|
|
18
|
-
}
|
|
19
|
-
export type WorkletSequencerReturnMessageType = number;
|
|
20
|
-
export namespace WorkletSequencerReturnMessageType {
|
|
21
|
-
export let midiEvent: number;
|
|
22
|
-
export let songChange: number;
|
|
23
|
-
export let textEvent: number;
|
|
24
|
-
export let timeChange: number;
|
|
25
|
-
let pause_1: number;
|
|
26
|
-
export { pause_1 as pause };
|
|
27
|
-
let getMIDI_1: number;
|
|
28
|
-
export { getMIDI_1 as getMIDI };
|
|
29
|
-
export let midiError: number;
|
|
30
|
-
export let tempoChange: number;
|
|
31
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export class BasicInstrument {
|
|
2
|
-
/**
|
|
3
|
-
* The instrument's name
|
|
4
|
-
* @type {string}
|
|
5
|
-
*/
|
|
6
|
-
instrumentName: string;
|
|
7
|
-
/**
|
|
8
|
-
* The instrument's zones
|
|
9
|
-
* @type {BasicInstrumentZone[]}
|
|
10
|
-
*/
|
|
11
|
-
instrumentZones: BasicInstrumentZone[];
|
|
12
|
-
_useCount: number;
|
|
13
|
-
/**
|
|
14
|
-
* @returns {number}
|
|
15
|
-
*/
|
|
16
|
-
get useCount(): number;
|
|
17
|
-
addUseCount(): void;
|
|
18
|
-
removeUseCount(): void;
|
|
19
|
-
deleteInstrument(): void;
|
|
20
|
-
/**
|
|
21
|
-
* @param index {number}
|
|
22
|
-
* @returns {boolean} is the zone has been deleted
|
|
23
|
-
*/
|
|
24
|
-
safeDeleteZone(index: number): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* @param index {number}
|
|
27
|
-
*/
|
|
28
|
-
deleteZone(index: number): void;
|
|
29
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export class BasicPreset {
|
|
2
|
-
/**
|
|
3
|
-
* @param modulators {Modulator[]}
|
|
4
|
-
*/
|
|
5
|
-
constructor(modulators: Modulator[]);
|
|
6
|
-
/**
|
|
7
|
-
* The preset's name
|
|
8
|
-
* @type {string}
|
|
9
|
-
*/
|
|
10
|
-
presetName: string;
|
|
11
|
-
/**
|
|
12
|
-
* The preset's MIDI program number
|
|
13
|
-
* @type {number}
|
|
14
|
-
*/
|
|
15
|
-
program: number;
|
|
16
|
-
/**
|
|
17
|
-
* The preset's MIDI bank number
|
|
18
|
-
* @type {number}
|
|
19
|
-
*/
|
|
20
|
-
bank: number;
|
|
21
|
-
/**
|
|
22
|
-
* The preset's zones
|
|
23
|
-
* @type {BasicPresetZone[]}
|
|
24
|
-
*/
|
|
25
|
-
presetZones: BasicPresetZone[];
|
|
26
|
-
/**
|
|
27
|
-
* SampleID offset for this preset
|
|
28
|
-
* @type {number}
|
|
29
|
-
*/
|
|
30
|
-
sampleIDOffset: number;
|
|
31
|
-
/**
|
|
32
|
-
* Stores already found getSamplesAndGenerators for reuse
|
|
33
|
-
* @type {SampleAndGenerators[][][]}
|
|
34
|
-
*/
|
|
35
|
-
foundSamplesAndGenerators: SampleAndGenerators[][][];
|
|
36
|
-
/**
|
|
37
|
-
* unused metadata
|
|
38
|
-
* @type {number}
|
|
39
|
-
*/
|
|
40
|
-
library: number;
|
|
41
|
-
/**
|
|
42
|
-
* unused metadata
|
|
43
|
-
* @type {number}
|
|
44
|
-
*/
|
|
45
|
-
genre: number;
|
|
46
|
-
/**
|
|
47
|
-
* unused metadata
|
|
48
|
-
* @type {number}
|
|
49
|
-
*/
|
|
50
|
-
morphology: number;
|
|
51
|
-
/**
|
|
52
|
-
* Default modulators
|
|
53
|
-
* @type {Modulator[]}
|
|
54
|
-
*/
|
|
55
|
-
defaultModulators: Modulator[];
|
|
56
|
-
deletePreset(): void;
|
|
57
|
-
/**
|
|
58
|
-
* @param index {number}
|
|
59
|
-
*/
|
|
60
|
-
deleteZone(index: number): void;
|
|
61
|
-
/**
|
|
62
|
-
* Preloads all samples (async)
|
|
63
|
-
*/
|
|
64
|
-
preload(keyMin: any, keyMax: any): void;
|
|
65
|
-
/**
|
|
66
|
-
* Preloads a specific key/velocity combo
|
|
67
|
-
* @param key {number}
|
|
68
|
-
* @param velocity {number}
|
|
69
|
-
*/
|
|
70
|
-
preloadSpecific(key: number, velocity: number): void;
|
|
71
|
-
/**
|
|
72
|
-
* Returns generatorTranslator and generators for given note
|
|
73
|
-
* @param midiNote {number}
|
|
74
|
-
* @param velocity {number}
|
|
75
|
-
* @returns {SampleAndGenerators[]}
|
|
76
|
-
*/
|
|
77
|
-
getSamplesAndGenerators(midiNote: number, velocity: number): SampleAndGenerators[];
|
|
78
|
-
}
|
|
79
|
-
export type SampleAndGenerators = {
|
|
80
|
-
instrumentGenerators: Generator[];
|
|
81
|
-
presetGenerators: Generator[];
|
|
82
|
-
modulators: Modulator[];
|
|
83
|
-
sample: BasicSample;
|
|
84
|
-
sampleID: number;
|
|
85
|
-
};
|
|
86
|
-
import { Modulator } from "./modulator.js";
|