spessasynth_lib 3.23.12 → 3.23.13
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 +8 -1
- package/@types/sequencer/sequencer.d.ts +3 -1
- package/index.js +17 -3
- package/package.json +1 -1
- package/sequencer/sequencer.js +3 -6
- package/sequencer/worklet_sequencer/process_event.js +12 -1
- package/sequencer/worklet_sequencer/sequencer_message.js +1 -1
- package/sequencer/worklet_sequencer/worklet_sequencer.js +0 -1
- package/synthetizer/worklet_processor.min.js +12 -12
- package/synthetizer/worklet_system/main_processor.js +1 -1
- package/synthetizer/worklet_system/snapshot/snapshot.js +311 -0
- package/synthetizer/worklet_system/worklet_methods/data_entry.js +0 -14
- package/synthetizer/worklet_system/worklet_methods/note_off.js +1 -1
- package/synthetizer/worklet_system/worklet_methods/snapshot.js +0 -145
package/@types/index.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ 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
5
|
import { BasicSoundFont } from "./soundfont/basic_soundfont/basic_soundfont.js";
|
|
6
|
+
import { BasicSample } from "./soundfont/basic_soundfont/basic_sample.js";
|
|
7
|
+
import { BasicInstrumentZone } from "./soundfont/basic_soundfont/basic_zones.js";
|
|
8
|
+
import { BasicInstrument } from "./soundfont/basic_soundfont/basic_instrument.js";
|
|
9
|
+
import { BasicPreset } from "./soundfont/basic_soundfont/basic_preset.js";
|
|
10
|
+
import { BasicPresetZone } from "./soundfont/basic_soundfont/basic_zones.js";
|
|
11
|
+
import { Generator } from "./soundfont/basic_soundfont/generator.js";
|
|
12
|
+
import { Modulator } from "./soundfont/basic_soundfont/modulator.js";
|
|
6
13
|
import { loadSoundFont } from "./soundfont/load_soundfont.js";
|
|
7
14
|
import { trimSoundfont } from "./soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js";
|
|
8
15
|
import { modulatorSources } from "./soundfont/basic_soundfont/modulator.js";
|
|
@@ -34,4 +41,4 @@ import { readBytesAsUintBigEndian } from './utils/byte_functions/big_endian.js';
|
|
|
34
41
|
import { NON_CC_INDEX_OFFSET } from "./synthetizer/worklet_system/worklet_utilities/controller_tables.js";
|
|
35
42
|
import { ALL_CHANNELS_OR_DIFFERENT_ACTION } from './synthetizer/worklet_system/message_protocol/worklet_message.js';
|
|
36
43
|
import { WORKLET_URL_ABSOLUTE } from './synthetizer/worklet_url.js';
|
|
37
|
-
export { Sequencer, Synthetizer, DEFAULT_PERCUSSION, VOICE_CAP, BasicSoundFont, loadSoundFont, trimSoundfont, modulatorSources, MIDI, MIDIBuilder, IndexedByteArray, writeMIDIFile, writeRMIDI, applySnapshotToMIDI, modifyMIDI, MIDIticksToSeconds, 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 };
|
|
44
|
+
export { Sequencer, Synthetizer, DEFAULT_PERCUSSION, VOICE_CAP, BasicSoundFont, BasicSample, BasicInstrumentZone, BasicInstrument, BasicPreset, BasicPresetZone, Generator, Modulator, loadSoundFont, trimSoundfont, modulatorSources, MIDI, MIDIBuilder, IndexedByteArray, writeMIDIFile, writeRMIDI, applySnapshotToMIDI, modifyMIDI, MIDIticksToSeconds, 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 };
|
|
@@ -23,10 +23,12 @@ export class Sequencer {
|
|
|
23
23
|
private onSongChange;
|
|
24
24
|
/**
|
|
25
25
|
* Fires on text event
|
|
26
|
+
* @type {function}
|
|
26
27
|
* @param data {Uint8Array} the data text
|
|
27
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
|
|
28
30
|
*/
|
|
29
|
-
onTextEvent:
|
|
31
|
+
onTextEvent: Function;
|
|
30
32
|
/**
|
|
31
33
|
* Fires when CurrentTime changes
|
|
32
34
|
* @type {Object<string, function(number)>} the time that was changed to
|
package/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// Import modules
|
|
2
2
|
import { loadSoundFont } from "./soundfont/load_soundfont.js";
|
|
3
3
|
import { BasicSoundFont } from "./soundfont/basic_soundfont/basic_soundfont.js";
|
|
4
|
+
import { BasicSample } from "./soundfont/basic_soundfont/basic_sample.js";
|
|
5
|
+
import { BasicInstrumentZone } from "./soundfont/basic_soundfont/basic_zones.js";
|
|
6
|
+
import { BasicInstrument } from "./soundfont/basic_soundfont/basic_instrument.js";
|
|
7
|
+
import { Generator } from "./soundfont/basic_soundfont/generator.js";
|
|
8
|
+
import { Modulator } from "./soundfont/basic_soundfont/modulator.js";
|
|
9
|
+
import { BasicPresetZone } from "./soundfont/basic_soundfont/basic_zones.js";
|
|
10
|
+
import { BasicPreset } from "./soundfont/basic_soundfont/basic_preset.js";
|
|
4
11
|
import { MIDI } from './midi_parser/midi_loader.js';
|
|
5
12
|
import { MIDIticksToSeconds } from './midi_parser/basic_midi.js';
|
|
6
13
|
import { MIDIBuilder } from "./midi_parser/midi_builder.js";
|
|
@@ -38,13 +45,20 @@ export {
|
|
|
38
45
|
Synthetizer,
|
|
39
46
|
DEFAULT_PERCUSSION,
|
|
40
47
|
VOICE_CAP,
|
|
41
|
-
|
|
48
|
+
|
|
42
49
|
// SoundFont
|
|
43
50
|
BasicSoundFont,
|
|
51
|
+
BasicSample,
|
|
52
|
+
BasicInstrumentZone,
|
|
53
|
+
BasicInstrument,
|
|
54
|
+
BasicPreset,
|
|
55
|
+
BasicPresetZone,
|
|
56
|
+
Generator,
|
|
57
|
+
Modulator,
|
|
44
58
|
loadSoundFont,
|
|
45
59
|
trimSoundfont,
|
|
46
60
|
modulatorSources,
|
|
47
|
-
|
|
61
|
+
|
|
48
62
|
// MIDI
|
|
49
63
|
MIDI,
|
|
50
64
|
MIDIBuilder,
|
|
@@ -54,7 +68,7 @@ export {
|
|
|
54
68
|
applySnapshotToMIDI,
|
|
55
69
|
modifyMIDI,
|
|
56
70
|
MIDIticksToSeconds,
|
|
57
|
-
|
|
71
|
+
|
|
58
72
|
// Utilities
|
|
59
73
|
audioBufferToWav,
|
|
60
74
|
SpessaSynthLogging,
|
package/package.json
CHANGED
package/sequencer/sequencer.js
CHANGED
|
@@ -61,8 +61,10 @@ export class Sequencer
|
|
|
61
61
|
onSongChange = {};
|
|
62
62
|
/**
|
|
63
63
|
* Fires on text event
|
|
64
|
+
* @type {function}
|
|
64
65
|
* @param data {Uint8Array} the data text
|
|
65
66
|
* @param type {number} the status byte of the message (the meta status byte)
|
|
67
|
+
* @param lyricsIndex {number} if the text is a lyric, the index of the lyric in midiData.lyrics, otherwise -1
|
|
66
68
|
*/
|
|
67
69
|
onTextEvent;
|
|
68
70
|
/**
|
|
@@ -304,7 +306,6 @@ export class Sequencer
|
|
|
304
306
|
addOnSongChangeEvent(callback, id)
|
|
305
307
|
{
|
|
306
308
|
this.onSongChange[id] = callback;
|
|
307
|
-
callback(this.midiData);
|
|
308
309
|
}
|
|
309
310
|
|
|
310
311
|
/**
|
|
@@ -419,13 +420,9 @@ export class Sequencer
|
|
|
419
420
|
break;
|
|
420
421
|
|
|
421
422
|
case WorkletSequencerReturnMessageType.textEvent:
|
|
422
|
-
/**
|
|
423
|
-
* @type {[Uint8Array, number]}
|
|
424
|
-
*/
|
|
425
|
-
let textEventData = messageData;
|
|
426
423
|
if (this.onTextEvent)
|
|
427
424
|
{
|
|
428
|
-
this.onTextEvent(
|
|
425
|
+
this.onTextEvent(...(messageData));
|
|
429
426
|
}
|
|
430
427
|
break;
|
|
431
428
|
|
|
@@ -117,7 +117,18 @@ export function _processEvent(event, trackIndex)
|
|
|
117
117
|
case messageTypes.cuePoint:
|
|
118
118
|
case messageTypes.instrumentName:
|
|
119
119
|
case messageTypes.programName:
|
|
120
|
-
|
|
120
|
+
let lyricsIndex = -1;
|
|
121
|
+
if (statusByteData.status === messageTypes.lyric)
|
|
122
|
+
{
|
|
123
|
+
lyricsIndex = Math.min(
|
|
124
|
+
this.midiData.lyrics.indexOf(event.messageData) + 1,
|
|
125
|
+
this.midiData.lyrics.length - 1
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
this.post(
|
|
129
|
+
WorkletSequencerReturnMessageType.textEvent,
|
|
130
|
+
[event.messageData, statusByteData.status, lyricsIndex]
|
|
131
|
+
);
|
|
121
132
|
break;
|
|
122
133
|
|
|
123
134
|
case messageTypes.midiPort:
|
|
@@ -35,7 +35,7 @@ export const WorkletSequencerMessageType = {
|
|
|
35
35
|
export const WorkletSequencerReturnMessageType = {
|
|
36
36
|
midiEvent: 0, // [...midiEventBytes<number>]
|
|
37
37
|
songChange: 1, // [midiData<MidiData>, songIndex<number>, isAutoPlayed<boolean>]
|
|
38
|
-
textEvent: 2, // [messageData<number[]>, statusByte<number]
|
|
38
|
+
textEvent: 2, // [messageData<number[]>, statusByte<number>, lyricsIndex<number>]
|
|
39
39
|
timeChange: 3, // newAbsoluteTime<number>
|
|
40
40
|
pause: 4, // no data
|
|
41
41
|
getMIDI: 5, // midiData<MIDI>
|