spessasynth_lib 3.14.1 → 3.14.5
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/midi_parser/rmidi_writer.d.ts +6 -0
- package/README.md +7 -2
- package/midi_parser/midi_loader.js +1 -1
- package/midi_parser/rmidi_writer.js +13 -2
- package/package.json +1 -1
- package/synthetizer/worklet_processor.min.js +6 -6
- package/synthetizer/worklet_system/main_processor.js +10 -0
- package/synthetizer/worklet_system/worklet_methods/note_on.js +8 -3
- package/synthetizer/worklet_system/worklet_methods/program_control.js +10 -0
- package/synthetizer/worklet_system/worklet_methods/reset_controllers.js +7 -0
- package/synthetizer/worklet_system/worklet_methods/system_exclusive.js +35 -27
- package/synthetizer/worklet_system/worklet_methods/voice_control.js +10 -1
- package/utils/byte_functions/string.js +1 -1
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @property {string|undefined} comment - the coment of the file
|
|
10
10
|
* @property {string|undefined} creationDate - the creation date of the file
|
|
11
11
|
* @property {string|undefined} copyright - the copyright of the file
|
|
12
|
+
* @property {string|unescape} midiEncoding - the encoding of the inner MIDI file
|
|
12
13
|
*/
|
|
13
14
|
/**
|
|
14
15
|
* Writes an RMIDI file
|
|
@@ -34,6 +35,7 @@ export namespace RMIDINFOChunks {
|
|
|
34
35
|
let engineer: string;
|
|
35
36
|
let software: string;
|
|
36
37
|
let encoding: string;
|
|
38
|
+
let midiEncoding: string;
|
|
37
39
|
let bankOffset: string;
|
|
38
40
|
}
|
|
39
41
|
export type RMIDMetadata = {
|
|
@@ -73,5 +75,9 @@ export type RMIDMetadata = {
|
|
|
73
75
|
* - the copyright of the file
|
|
74
76
|
*/
|
|
75
77
|
copyright: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* - the encoding of the inner MIDI file
|
|
80
|
+
*/
|
|
81
|
+
midiEncoding: string | typeof unescape;
|
|
76
82
|
};
|
|
77
83
|
import { IndexedByteArray } from '../utils/indexed_array.js';
|
package/README.md
CHANGED
|
@@ -47,10 +47,11 @@ document.getElementById("button").onclick = async () => {
|
|
|
47
47
|
- Runs in a **separate thread** for maximum performance
|
|
48
48
|
- Supported by all modern browsers
|
|
49
49
|
- **Unlimited channel count:** Your CPU is the limit!
|
|
50
|
-
- **
|
|
50
|
+
- **Excellent MIDI Standards Support:**
|
|
51
51
|
- **MIDI Controller Support:** Default supported controllers [here](https://github.com/spessasus/SpessaSynth/wiki/MIDI-Implementation#supported-controllers)
|
|
52
52
|
- **MIDI Tuning Standard Support:** [more info here](https://github.com/spessasus/SpessaSynth/wiki/MIDI-Implementation#midi-tuning-standard)
|
|
53
53
|
- [Full **RPN** and limited **NRPN** support](https://github.com/spessasus/SpessaSynth/wiki/MIDI-Implementation#supported-registered-parameters)
|
|
54
|
+
- **MIDI Tuning Standard Support:** [more info here](https://github.com/spessasus/SpessaSynth/wiki/MIDI-Implementation#midi-tuning-standard)
|
|
54
55
|
- Supports some [**Roland GS** and **Yamaha XG** system exclusives](https://github.com/spessasus/SpessaSynth/wiki/MIDI-Implementation#supported-system-exclusives)
|
|
55
56
|
|
|
56
57
|
- **High-performance mode:** Play Rush E! _note: may kill your browser ;)_
|
|
@@ -75,17 +76,21 @@ document.getElementById("button").onclick = async () => {
|
|
|
75
76
|
- **Loop detection:** Automatically detects loops in MIDIs (e.g., from _Touhou Project_)
|
|
76
77
|
- **First note detection:** Skip unnecessary silence at the start by jumping to the first note!
|
|
77
78
|
- **Easy saving:** Save with just [one function!](https://github.com/spessasus/SpessaSynth/wiki/Writing-MIDI-Files#writemidifile)
|
|
78
|
-
|
|
79
|
+
-
|
|
80
|
+
#### Read and write [RMID files with embedded SF2 soundfonts](https://github.com/spessasus/sf2-rmidi-specification#readme)
|
|
81
|
+
- **[Level 4](https://github.com/spessasus/sf2-rmidi-specification#level-4) compliance:** Reads and writes *everything!*
|
|
79
82
|
- **Compression and trimming support:** Reduce a MIDI file with a 1GB soundfont to **as small as 5MB**!
|
|
80
83
|
- **Automatic bank shifting and validation:** Every soundfont *just works!*
|
|
81
84
|
- **Metadata support:** Add title, artist, album name and cover and more! And of course read them too! *(In any encoding!)*
|
|
82
85
|
- **Compatible with [Falcosoft Midi Player 6!](https://falcosoft.hu/softwares.html#midiplayer)**
|
|
83
86
|
- **Easy saving:** [As simple as saving a MIDI file!](https://github.com/spessasus/SpessaSynth/wiki/Writing-MIDI-Files#writermidi)
|
|
87
|
+
-
|
|
84
88
|
#### Read and write SoundFont2 files
|
|
85
89
|
- **Easy info access:** Just an [object of strings!](https://github.com/spessasus/SpessaSynth/wiki/SoundFont2-Class#soundfontinfo)
|
|
86
90
|
- **Smart trimming:** Trim the SoundFont to only include samples used in the MIDI *(down to key and velocity!)*
|
|
87
91
|
- **sf3 conversion:** Compress SoundFont2 files to SoundFont3 with variable quality!
|
|
88
92
|
- **Easy saving:** Also just [one function!](https://github.com/spessasus/SpessaSynth/wiki/SoundFont2-Class#write)
|
|
93
|
+
-
|
|
89
94
|
#### Read and write SoundFont3 files
|
|
90
95
|
- Same features as SoundFont2 but with now with **Ogg Vorbis compression!**
|
|
91
96
|
- **Variable compression quality:** You choose between file size and quality!
|
|
@@ -62,7 +62,7 @@ class MIDI{
|
|
|
62
62
|
binaryData.currentIndex -= 4;
|
|
63
63
|
if(initialString === "RIFF")
|
|
64
64
|
{
|
|
65
|
-
// possibly an RMID file (https://github.com/spessasus/
|
|
65
|
+
// possibly an RMID file (https://github.com/spessasus/sf2-rmidi-specification#readme)
|
|
66
66
|
// skip size
|
|
67
67
|
binaryData.currentIndex += 8;
|
|
68
68
|
const rmid = readBytesAsString(binaryData, 4, undefined, false);
|
|
@@ -23,6 +23,7 @@ export const RMIDINFOChunks = {
|
|
|
23
23
|
engineer: "IENG",
|
|
24
24
|
software: "ISFT",
|
|
25
25
|
encoding: "IENC",
|
|
26
|
+
midiEncoding: "MENC",
|
|
26
27
|
bankOffset: "DBNK"
|
|
27
28
|
}
|
|
28
29
|
|
|
@@ -40,6 +41,7 @@ const DEFAULT_COPYRIGHT = "Created using SpessaSynth";
|
|
|
40
41
|
* @property {string|undefined} comment - the coment of the file
|
|
41
42
|
* @property {string|undefined} creationDate - the creation date of the file
|
|
42
43
|
* @property {string|undefined} copyright - the copyright of the file
|
|
44
|
+
* @property {string|unescape} midiEncoding - the encoding of the inner MIDI file
|
|
43
45
|
*/
|
|
44
46
|
|
|
45
47
|
/**
|
|
@@ -62,7 +64,7 @@ export function writeRMIDI(soundfontBinary, mid, soundfont, bankOffset = 0, enco
|
|
|
62
64
|
consoleColors.value);
|
|
63
65
|
SpessaSynthInfo("metadata", metadata);
|
|
64
66
|
SpessaSynthInfo("Initial bank offset", mid.bankOffset);
|
|
65
|
-
// add offset to bank. See
|
|
67
|
+
// add offset to bank. See https://github.com/spessasus/sf2-rmidi-specification#readme
|
|
66
68
|
// also fix presets that don't exists since midiplayer6 doesn't seem to default to 0 when nonextistent...
|
|
67
69
|
let system = "gm";
|
|
68
70
|
/**
|
|
@@ -444,10 +446,19 @@ export function writeRMIDI(soundfontBinary, mid, soundfont, bankOffset = 0, enco
|
|
|
444
446
|
const DBNK = new IndexedByteArray(2);
|
|
445
447
|
writeLittleEndian(DBNK, bankOffset, 2);
|
|
446
448
|
infoContent.push(writeRIFFOddSize(RMIDINFOChunks.bankOffset, DBNK));
|
|
449
|
+
// midi encoding
|
|
450
|
+
if(metadata.midiEncoding !== undefined)
|
|
451
|
+
{
|
|
452
|
+
infoContent.push(
|
|
453
|
+
writeRIFFOddSize(RMIDINFOChunks.midiEncoding, encoder.encode(metadata.midiEncoding))
|
|
454
|
+
);
|
|
455
|
+
encoding = FORCED_ENCODING;
|
|
456
|
+
}
|
|
447
457
|
// encoding
|
|
448
458
|
infoContent.push(writeRIFFOddSize(RMIDINFOChunks.encoding, getStringBytes(encoding)));
|
|
449
|
-
const infodata = combineArrays(infoContent);
|
|
450
459
|
|
|
460
|
+
// combine and write out
|
|
461
|
+
const infodata = combineArrays(infoContent);
|
|
451
462
|
const rmiddata = combineArrays([
|
|
452
463
|
getStringBytes("RMID"),
|
|
453
464
|
writeRIFFOddSize(
|