spessasynth_lib 3.25.23 → 3.26.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 (168) hide show
  1. package/README.md +29 -114
  2. package/index.js +33 -33
  3. package/package.json +16 -6
  4. package/external_midi/README.md +0 -4
  5. package/external_midi/midi_handler.js +0 -130
  6. package/external_midi/web_midi_link.js +0 -43
  7. package/externals/fflate/LICENSE +0 -21
  8. package/externals/fflate/fflate.min.js +0 -1
  9. package/externals/stbvorbis_sync/@types/stbvorbis_sync.d.ts +0 -12
  10. package/externals/stbvorbis_sync/LICENSE +0 -202
  11. package/externals/stbvorbis_sync/NOTICE +0 -6
  12. package/externals/stbvorbis_sync/stbvorbis_sync.min.js +0 -1
  13. package/midi/README.md +0 -32
  14. package/midi/basic_midi.js +0 -565
  15. package/midi/midi_builder.js +0 -202
  16. package/midi/midi_data.js +0 -63
  17. package/midi/midi_loader.js +0 -324
  18. package/midi/midi_message.js +0 -254
  19. package/midi/midi_sequence.js +0 -225
  20. package/midi/midi_tools/get_note_times.js +0 -154
  21. package/midi/midi_tools/midi_editor.js +0 -611
  22. package/midi/midi_tools/midi_writer.js +0 -99
  23. package/midi/midi_tools/rmidi_writer.js +0 -567
  24. package/midi/midi_tools/used_keys_loaded.js +0 -238
  25. package/midi/xmf_loader.js +0 -454
  26. package/sequencer/README.md +0 -32
  27. package/sequencer/sequencer_engine/events.js +0 -104
  28. package/sequencer/sequencer_engine/play.js +0 -353
  29. package/sequencer/sequencer_engine/process_event.js +0 -169
  30. package/sequencer/sequencer_engine/process_tick.js +0 -106
  31. package/sequencer/sequencer_engine/sequencer_engine.js +0 -335
  32. package/sequencer/sequencer_engine/song_control.js +0 -229
  33. package/sequencer/worklet_wrapper/default_sequencer_options.js +0 -8
  34. package/sequencer/worklet_wrapper/sequencer.js +0 -807
  35. package/sequencer/worklet_wrapper/sequencer_message.js +0 -53
  36. package/soundfont/README.md +0 -13
  37. package/soundfont/basic_soundfont/basic_instrument.js +0 -77
  38. package/soundfont/basic_soundfont/basic_preset.js +0 -336
  39. package/soundfont/basic_soundfont/basic_sample.js +0 -197
  40. package/soundfont/basic_soundfont/basic_soundfont.js +0 -565
  41. package/soundfont/basic_soundfont/basic_zone.js +0 -64
  42. package/soundfont/basic_soundfont/basic_zones.js +0 -43
  43. package/soundfont/basic_soundfont/generator.js +0 -220
  44. package/soundfont/basic_soundfont/modulator.js +0 -378
  45. package/soundfont/basic_soundfont/riff_chunk.js +0 -149
  46. package/soundfont/basic_soundfont/write_dls/art2.js +0 -173
  47. package/soundfont/basic_soundfont/write_dls/articulator.js +0 -49
  48. package/soundfont/basic_soundfont/write_dls/combine_zones.js +0 -400
  49. package/soundfont/basic_soundfont/write_dls/ins.js +0 -103
  50. package/soundfont/basic_soundfont/write_dls/lins.js +0 -18
  51. package/soundfont/basic_soundfont/write_dls/modulator_converter.js +0 -330
  52. package/soundfont/basic_soundfont/write_dls/rgn2.js +0 -121
  53. package/soundfont/basic_soundfont/write_dls/wave.js +0 -94
  54. package/soundfont/basic_soundfont/write_dls/write_dls.js +0 -119
  55. package/soundfont/basic_soundfont/write_dls/wsmp.js +0 -78
  56. package/soundfont/basic_soundfont/write_dls/wvpl.js +0 -32
  57. package/soundfont/basic_soundfont/write_sf2/ibag.js +0 -39
  58. package/soundfont/basic_soundfont/write_sf2/igen.js +0 -80
  59. package/soundfont/basic_soundfont/write_sf2/imod.js +0 -46
  60. package/soundfont/basic_soundfont/write_sf2/inst.js +0 -34
  61. package/soundfont/basic_soundfont/write_sf2/pbag.js +0 -39
  62. package/soundfont/basic_soundfont/write_sf2/pgen.js +0 -82
  63. package/soundfont/basic_soundfont/write_sf2/phdr.js +0 -42
  64. package/soundfont/basic_soundfont/write_sf2/pmod.js +0 -46
  65. package/soundfont/basic_soundfont/write_sf2/sdta.js +0 -80
  66. package/soundfont/basic_soundfont/write_sf2/shdr.js +0 -55
  67. package/soundfont/basic_soundfont/write_sf2/write.js +0 -222
  68. package/soundfont/dls/articulator_converter.js +0 -396
  69. package/soundfont/dls/dls_destinations.js +0 -38
  70. package/soundfont/dls/dls_preset.js +0 -44
  71. package/soundfont/dls/dls_sample.js +0 -75
  72. package/soundfont/dls/dls_soundfont.js +0 -186
  73. package/soundfont/dls/dls_sources.js +0 -62
  74. package/soundfont/dls/dls_zone.js +0 -95
  75. package/soundfont/dls/read_articulation.js +0 -299
  76. package/soundfont/dls/read_instrument.js +0 -121
  77. package/soundfont/dls/read_instrument_list.js +0 -17
  78. package/soundfont/dls/read_lart.js +0 -35
  79. package/soundfont/dls/read_region.js +0 -152
  80. package/soundfont/dls/read_samples.js +0 -270
  81. package/soundfont/load_soundfont.js +0 -21
  82. package/soundfont/read_sf2/generators.js +0 -46
  83. package/soundfont/read_sf2/instruments.js +0 -66
  84. package/soundfont/read_sf2/modulators.js +0 -36
  85. package/soundfont/read_sf2/presets.js +0 -80
  86. package/soundfont/read_sf2/samples.js +0 -304
  87. package/soundfont/read_sf2/soundfont.js +0 -305
  88. package/soundfont/read_sf2/zones.js +0 -263
  89. package/synthetizer/README.md +0 -10
  90. package/synthetizer/audio_effects/effects_config.js +0 -25
  91. package/synthetizer/audio_effects/fancy_chorus.js +0 -162
  92. package/synthetizer/audio_effects/rb_compressed.min.js +0 -1
  93. package/synthetizer/audio_effects/reverb.js +0 -35
  94. package/synthetizer/audio_effects/reverb_as_binary.js +0 -18
  95. package/synthetizer/audio_engine/README.md +0 -25
  96. package/synthetizer/audio_engine/engine_components/compute_modulator.js +0 -266
  97. package/synthetizer/audio_engine/engine_components/controller_tables.js +0 -88
  98. package/synthetizer/audio_engine/engine_components/key_modifier_manager.js +0 -149
  99. package/synthetizer/audio_engine/engine_components/lfo.js +0 -26
  100. package/synthetizer/audio_engine/engine_components/lowpass_filter.js +0 -282
  101. package/synthetizer/audio_engine/engine_components/midi_audio_channel.js +0 -471
  102. package/synthetizer/audio_engine/engine_components/modulation_envelope.js +0 -181
  103. package/synthetizer/audio_engine/engine_components/modulator_curves.js +0 -89
  104. package/synthetizer/audio_engine/engine_components/soundfont_manager.js +0 -228
  105. package/synthetizer/audio_engine/engine_components/stereo_panner.js +0 -120
  106. package/synthetizer/audio_engine/engine_components/unit_converter.js +0 -73
  107. package/synthetizer/audio_engine/engine_components/voice.js +0 -519
  108. package/synthetizer/audio_engine/engine_components/volume_envelope.js +0 -401
  109. package/synthetizer/audio_engine/engine_components/wavetable_oscillator.js +0 -263
  110. package/synthetizer/audio_engine/engine_methods/controller_control/controller_change.js +0 -132
  111. package/synthetizer/audio_engine/engine_methods/controller_control/master_parameters.js +0 -48
  112. package/synthetizer/audio_engine/engine_methods/controller_control/reset_controllers.js +0 -241
  113. package/synthetizer/audio_engine/engine_methods/create_midi_channel.js +0 -27
  114. package/synthetizer/audio_engine/engine_methods/data_entry/data_entry_coarse.js +0 -253
  115. package/synthetizer/audio_engine/engine_methods/data_entry/data_entry_fine.js +0 -66
  116. package/synthetizer/audio_engine/engine_methods/mute_channel.js +0 -17
  117. package/synthetizer/audio_engine/engine_methods/note_on.js +0 -175
  118. package/synthetizer/audio_engine/engine_methods/portamento_time.js +0 -92
  119. package/synthetizer/audio_engine/engine_methods/program_change.js +0 -61
  120. package/synthetizer/audio_engine/engine_methods/render_voice.js +0 -196
  121. package/synthetizer/audio_engine/engine_methods/soundfont_management/clear_sound_font.js +0 -30
  122. package/synthetizer/audio_engine/engine_methods/soundfont_management/get_preset.js +0 -22
  123. package/synthetizer/audio_engine/engine_methods/soundfont_management/reload_sound_font.js +0 -40
  124. package/synthetizer/audio_engine/engine_methods/soundfont_management/send_preset_list.js +0 -34
  125. package/synthetizer/audio_engine/engine_methods/soundfont_management/set_embedded_sound_font.js +0 -21
  126. package/synthetizer/audio_engine/engine_methods/stopping_notes/kill_note.js +0 -20
  127. package/synthetizer/audio_engine/engine_methods/stopping_notes/note_off.js +0 -55
  128. package/synthetizer/audio_engine/engine_methods/stopping_notes/stop_all_channels.js +0 -16
  129. package/synthetizer/audio_engine/engine_methods/stopping_notes/stop_all_notes.js +0 -30
  130. package/synthetizer/audio_engine/engine_methods/stopping_notes/voice_killing.js +0 -63
  131. package/synthetizer/audio_engine/engine_methods/system_exclusive.js +0 -776
  132. package/synthetizer/audio_engine/engine_methods/tuning_control/channel_pressure.js +0 -24
  133. package/synthetizer/audio_engine/engine_methods/tuning_control/pitch_wheel.js +0 -33
  134. package/synthetizer/audio_engine/engine_methods/tuning_control/poly_pressure.js +0 -31
  135. package/synthetizer/audio_engine/engine_methods/tuning_control/set_master_tuning.js +0 -15
  136. package/synthetizer/audio_engine/engine_methods/tuning_control/set_modulation_depth.js +0 -27
  137. package/synthetizer/audio_engine/engine_methods/tuning_control/set_octave_tuning.js +0 -19
  138. package/synthetizer/audio_engine/engine_methods/tuning_control/set_tuning.js +0 -27
  139. package/synthetizer/audio_engine/engine_methods/tuning_control/transpose_all_channels.js +0 -15
  140. package/synthetizer/audio_engine/engine_methods/tuning_control/transpose_channel.js +0 -34
  141. package/synthetizer/audio_engine/main_processor.js +0 -765
  142. package/synthetizer/audio_engine/message_protocol/README.md +0 -13
  143. package/synthetizer/audio_engine/message_protocol/message_sending.js +0 -22
  144. package/synthetizer/audio_engine/message_protocol/worklet_message.js +0 -107
  145. package/synthetizer/audio_engine/snapshot/apply_synthesizer_snapshot.js +0 -14
  146. package/synthetizer/audio_engine/snapshot/channel_snapshot.js +0 -175
  147. package/synthetizer/audio_engine/snapshot/synthesizer_snapshot.js +0 -122
  148. package/synthetizer/synth_constants.js +0 -20
  149. package/synthetizer/worklet_processor.min.js +0 -21
  150. package/synthetizer/worklet_wrapper/key_modifier_manager.js +0 -104
  151. package/synthetizer/worklet_wrapper/sfman_message.js +0 -9
  152. package/synthetizer/worklet_wrapper/synth_event_handler.js +0 -214
  153. package/synthetizer/worklet_wrapper/synth_soundfont_manager.js +0 -109
  154. package/synthetizer/worklet_wrapper/synthetizer.js +0 -1027
  155. package/synthetizer/worklet_wrapper/worklet_processor.js +0 -454
  156. package/synthetizer/worklet_wrapper/worklet_url.js +0 -16
  157. package/utils/README.md +0 -5
  158. package/utils/buffer_to_wav.js +0 -186
  159. package/utils/byte_functions/big_endian.js +0 -32
  160. package/utils/byte_functions/little_endian.js +0 -77
  161. package/utils/byte_functions/string.js +0 -107
  162. package/utils/byte_functions/variable_length_quantity.js +0 -42
  163. package/utils/fill_with_defaults.js +0 -21
  164. package/utils/indexed_array.js +0 -52
  165. package/utils/loggin.js +0 -79
  166. package/utils/other.js +0 -92
  167. package/utils/sysex_detector.js +0 -58
  168. package/utils/xg_hacks.js +0 -193
@@ -1,77 +0,0 @@
1
- /**
2
- * Reads as little endian
3
- * @param dataArray {IndexedByteArray}
4
- * @param bytesAmount {number}
5
- * @returns {number}
6
- */
7
- export function readLittleEndian(dataArray, bytesAmount)
8
- {
9
- let out = 0;
10
- for (let i = 0; i < bytesAmount; i++)
11
- {
12
- out |= (dataArray[dataArray.currentIndex++] << i * 8);
13
- }
14
- // make sure it stays unsigned
15
- return out >>> 0;
16
- }
17
-
18
- /**
19
- * Writes a number as little endian seems to also work for negative numbers so yay?
20
- * @param dataArray {IndexedByteArray}
21
- * @param number {number}
22
- * @param byteTarget {number}
23
- */
24
- export function writeLittleEndian(dataArray, number, byteTarget)
25
- {
26
- for (let i = 0; i < byteTarget; i++)
27
- {
28
- dataArray[dataArray.currentIndex++] = (number >> (i * 8)) & 0xFF;
29
- }
30
- }
31
-
32
- /**
33
- * @param dataArray {IndexedByteArray}
34
- * @param word {number}
35
- */
36
- export function writeWord(dataArray, word)
37
- {
38
- dataArray[dataArray.currentIndex++] = word & 0xFF;
39
- dataArray[dataArray.currentIndex++] = word >> 8;
40
- }
41
-
42
- /**
43
- * @param dataArray {IndexedByteArray}
44
- * @param dword {number}
45
- */
46
- export function writeDword(dataArray, dword)
47
- {
48
- writeLittleEndian(dataArray, dword, 4);
49
- }
50
-
51
- /**
52
- * @param byte1 {number}
53
- * @param byte2 {number}
54
- * @returns {number}
55
- */
56
- export function signedInt16(byte1, byte2)
57
- {
58
- let val = (byte2 << 8) | byte1;
59
- if (val > 32767)
60
- {
61
- return val - 65536;
62
- }
63
- return val;
64
- }
65
-
66
- /**
67
- * @param byte {number}
68
- * @returns {number}
69
- */
70
- export function signedInt8(byte)
71
- {
72
- if (byte > 127)
73
- {
74
- return byte - 256;
75
- }
76
- return byte;
77
- }
@@ -1,107 +0,0 @@
1
- import { IndexedByteArray } from "../indexed_array.js";
2
-
3
- /**
4
- * @param dataArray {IndexedByteArray}
5
- * @param bytes {number}
6
- * @param encoding {string} the textElement encoding
7
- * @param trimEnd {boolean} if we should trim once we reach an invalid byte
8
- * @returns {string}
9
- */
10
- export function readBytesAsString(dataArray, bytes, encoding = undefined, trimEnd = true)
11
- {
12
- if (!encoding)
13
- {
14
- let finished = false;
15
- let string = "";
16
- for (let i = 0; i < bytes; i++)
17
- {
18
- let byte = dataArray[dataArray.currentIndex++];
19
- if (finished)
20
- {
21
- continue;
22
- }
23
- if ((byte < 32 || byte > 127) && byte !== 10) // 10 is "\n"
24
- {
25
- if (trimEnd)
26
- {
27
- finished = true;
28
- continue;
29
- }
30
- else
31
- {
32
- if (byte === 0)
33
- {
34
- finished = true;
35
- continue;
36
- }
37
- }
38
- }
39
- string += String.fromCharCode(byte);
40
- }
41
- return string;
42
- }
43
- else
44
- {
45
- let byteBuffer = dataArray.slice(dataArray.currentIndex, dataArray.currentIndex + bytes);
46
- dataArray.currentIndex += bytes;
47
- let decoder = new TextDecoder(encoding.replace(/[^\x20-\x7E]/g, ""));
48
- return decoder.decode(byteBuffer.buffer);
49
- }
50
- }
51
-
52
- /**
53
- * @param string {string}
54
- * @param padLength {number}
55
- * @returns {IndexedByteArray}
56
- */
57
- export function getStringBytes(string, padLength = 0)
58
- {
59
- let len = string.length;
60
- if (padLength > 0)
61
- {
62
- len = padLength;
63
- }
64
- const arr = new IndexedByteArray(len);
65
- writeStringAsBytes(arr, string, padLength);
66
- return arr;
67
- }
68
-
69
- /**
70
- * @param string {string}
71
- * @returns {IndexedByteArray}
72
- */
73
- export function getStringBytesZero(string)
74
- {
75
- return getStringBytes(string, string.length + 1);
76
- }
77
-
78
- /**
79
- * @param string {string}
80
- * @param outArray {IndexedByteArray}
81
- * @param padLength {number}
82
- * @returns {IndexedByteArray} modified IN PLACE
83
- */
84
- export function writeStringAsBytes(outArray, string, padLength = 0)
85
- {
86
- if (padLength > 0)
87
- {
88
- if (string.length > padLength)
89
- {
90
- string = string.slice(0, padLength);
91
- }
92
- }
93
- for (let i = 0; i < string.length; i++)
94
- {
95
- outArray[outArray.currentIndex++] = string.charCodeAt(i);
96
- }
97
-
98
- // pad with zeros if needed
99
- if (padLength > string.length)
100
- {
101
- for (let i = 0; i < padLength - string.length; i++)
102
- {
103
- outArray[outArray.currentIndex++] = 0;
104
- }
105
- }
106
- return outArray;
107
- }
@@ -1,42 +0,0 @@
1
- /**
2
- * Reads VLQ From a MIDI byte array
3
- * @param MIDIbyteArray {IndexedByteArray}
4
- * @returns {number}
5
- */
6
- export function readVariableLengthQuantity(MIDIbyteArray)
7
- {
8
- let out = 0;
9
- while (MIDIbyteArray)
10
- {
11
- const byte = MIDIbyteArray[MIDIbyteArray.currentIndex++];
12
- // extract the first 7 bytes
13
- out = (out << 7) | (byte & 127);
14
-
15
- // if the last byte isn't 1, stop reading
16
- if ((byte >> 7) !== 1)
17
- {
18
- break;
19
- }
20
- }
21
- return out;
22
- }
23
-
24
- /**
25
- * Write a VLQ from a number to a byte array
26
- * @param number {number}
27
- * @returns {number[]}
28
- */
29
- export function writeVariableLengthQuantity(number)
30
- {
31
- // Add the first byte
32
- let bytes = [number & 127];
33
- number >>= 7;
34
-
35
- // Continue processing the remaining bytes
36
- while (number > 0)
37
- {
38
- bytes.unshift((number & 127) | 128);
39
- number >>= 7;
40
- }
41
- return bytes;
42
- }
@@ -1,21 +0,0 @@
1
- /**
2
- * Fills the object with default values
3
- * @param obj {Object}
4
- * @param defObj {Object}
5
- * @returns {Object}
6
- */
7
- export function fillWithDefaults(obj, defObj)
8
- {
9
- if (obj === undefined)
10
- {
11
- obj = {};
12
- }
13
- for (const key in defObj)
14
- {
15
- if (defObj.hasOwnProperty(key) && !(key in obj))
16
- {
17
- obj[key] = defObj[key];
18
- }
19
- }
20
- return obj;
21
- }
@@ -1,52 +0,0 @@
1
- /**
2
- * indexed_array.js
3
- * purpose: exteds Uint8Array with a currentIndex property
4
- */
5
-
6
- export class IndexedByteArray extends Uint8Array
7
- {
8
- /**
9
- * The current index of the array
10
- * @type {number}
11
- */
12
- currentIndex = 0;
13
-
14
- /**
15
- * Creates a new instance of an Uint8Array with a currentIndex property
16
- * @param args {any} same as for Uint8Array
17
- */
18
- constructor(args)
19
- {
20
- super(args);
21
- }
22
-
23
- /**
24
- * @param start {number?}
25
- * @param end {number?}
26
- * @returns {IndexedByteArray}
27
- */
28
- slice(start, end)
29
- {
30
- const a = super.slice(start, end);
31
- a.currentIndex = 0;
32
- return a;
33
- }
34
- }
35
-
36
-
37
- /**
38
- * @param arrs {(IndexedByteArray|Uint8Array)[]}
39
- * @returns {IndexedByteArray|Uint8Array}
40
- */
41
- export function combineArrays(arrs)
42
- {
43
- const length = arrs.reduce((sum, current) => sum + current.length, 0);
44
- const newArr = new IndexedByteArray(length);
45
- let offset = 0;
46
- for (const arr of arrs)
47
- {
48
- newArr.set(arr, offset);
49
- offset += arr.length;
50
- }
51
- return newArr;
52
- }
package/utils/loggin.js DELETED
@@ -1,79 +0,0 @@
1
- let ENABLE_INFO = false;
2
- let ENABLE_WARN = true;
3
- let ENABLE_GROUP = false;
4
- let ENABLE_TABLE = true;
5
-
6
- /**
7
- * Enables or disables looging
8
- * @param enableInfo {boolean} - enables info
9
- * @param enableWarn {boolean} - enables warning
10
- * @param enableGroup {boolean} - enables groups
11
- * @param enableTable {boolean} - enables tables
12
- */
13
- export function SpessaSynthLogging(enableInfo, enableWarn, enableGroup, enableTable)
14
- {
15
- ENABLE_INFO = enableInfo;
16
- ENABLE_WARN = enableWarn;
17
- ENABLE_GROUP = enableGroup;
18
- ENABLE_TABLE = enableTable;
19
- }
20
-
21
- /**
22
- * @param message {...any}
23
- */
24
- export function SpessaSynthInfo(...message)
25
- {
26
- if (ENABLE_INFO)
27
- {
28
- console.info(...message);
29
- }
30
- }
31
-
32
- /**
33
- * @param message {...any}
34
- */
35
- export function SpessaSynthWarn(...message)
36
- {
37
- if (ENABLE_WARN)
38
- {
39
- console.warn(...message);
40
- }
41
- }
42
-
43
- export function SpessaSynthTable(...args)
44
- {
45
- if (ENABLE_TABLE)
46
- {
47
- console.table(...args);
48
- }
49
- }
50
-
51
- /**
52
- * @param message {...any} the message
53
- */
54
- export function SpessaSynthGroup(...message)
55
- {
56
- if (ENABLE_GROUP)
57
- {
58
- console.group(...message);
59
- }
60
- }
61
-
62
- /**
63
- * @param message {...any} the message
64
- */
65
- export function SpessaSynthGroupCollapsed(...message)
66
- {
67
- if (ENABLE_GROUP)
68
- {
69
- console.groupCollapsed(...message);
70
- }
71
- }
72
-
73
- export function SpessaSynthGroupEnd()
74
- {
75
- if (ENABLE_GROUP)
76
- {
77
- console.groupEnd();
78
- }
79
- }
package/utils/other.js DELETED
@@ -1,92 +0,0 @@
1
- /**
2
- * other.js
3
- * purpose: contains some useful functions that don't belong in any specific category
4
- */
5
-
6
- /**
7
- * Formats the given seconds to nice readable time
8
- * @param totalSeconds {number} time in seconds
9
- * @return {{seconds: number, minutes: number, time: string}}
10
- */
11
- export function formatTime(totalSeconds)
12
- {
13
- totalSeconds = Math.floor(totalSeconds);
14
- let minutes = Math.floor(totalSeconds / 60);
15
- let seconds = Math.round(totalSeconds - (minutes * 60));
16
- return {
17
- "minutes": minutes,
18
- "seconds": seconds,
19
- "time": `${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`
20
- };
21
- }
22
-
23
- /**
24
- * @param fileName {string}
25
- * @returns {string}
26
- */
27
- export function formatTitle(fileName)
28
- {
29
- return fileName
30
- .trim()
31
- .replaceAll(".mid", "")
32
- .replaceAll(".kar", "")
33
- .replaceAll(".rmi", "")
34
- .replaceAll(".xmf", "")
35
- .replaceAll(".mxmf", "")
36
- .replaceAll("_", " ")
37
- .trim();
38
- }
39
-
40
- /**
41
- * Does what it says
42
- * @param arr {number[]|Uint8Array}
43
- * @returns {string}
44
- */
45
- export function arrayToHexString(arr)
46
- {
47
- let hexString = "";
48
-
49
- for (let i = 0; i < arr.length; i++)
50
- {
51
- const hex = arr[i].toString(16).padStart(2, "0").toUpperCase();
52
- hexString += hex;
53
- hexString += " ";
54
- }
55
-
56
- return hexString;
57
- }
58
-
59
- /**
60
- * @param eventData {Uint8Array}
61
- * @returns {Uint8Array}
62
- */
63
- export function sanitizeKarLyrics(eventData)
64
- {
65
- // for KAR files:
66
- // https://www.mixagesoftware.com/en/midikit/help/HTML/karaoke_formats.html
67
- // "/" is the newline character
68
- // "\" is also the newline character
69
- // "\" ASCII code is 92
70
- // "/" ASCII code is 47
71
- // newline ASCII code is 10
72
- const sanitized = [];
73
- for (let byte of eventData)
74
- {
75
- if (byte === 47 || byte === 92)
76
- {
77
- byte = 10;
78
- }
79
- sanitized.push(byte);
80
- }
81
- return new Uint8Array(sanitized);
82
- }
83
-
84
- export const consoleColors = {
85
- warn: "color: orange;",
86
- unrecognized: "color: red;",
87
- info: "color: aqua;",
88
- recognized: "color: lime",
89
- value: "color: yellow; background-color: black;"
90
- };
91
-
92
-
@@ -1,58 +0,0 @@
1
- /**
2
- * @param e {MIDIMessage}
3
- * @returns boolean
4
- */
5
- export function isXGOn(e)
6
- {
7
- return e.messageData[0] === 0x43 && // Yamaha
8
- e.messageData[2] === 0x4C && // XG ON
9
- e.messageData[5] === 0x7E &&
10
- e.messageData[6] === 0x00;
11
- }
12
-
13
- /**
14
- * @param e {MIDIMessage}
15
- * @returns boolean
16
- */
17
- export function isGSDrumsOn(e)
18
- {
19
- return e.messageData[0] === 0x41 && // roland
20
- e.messageData[2] === 0x42 && // GS
21
- e.messageData[3] === 0x12 && // GS
22
- e.messageData[4] === 0x40 && // system parameter
23
- (e.messageData[5] & 0x10) !== 0 && // part parameter
24
- e.messageData[6] === 0x15; // drum pars
25
- }
26
-
27
- /**
28
- * @param e {MIDIMessage}
29
- * @returns boolean
30
- */
31
- export function isGSOn(e)
32
- {
33
- return e.messageData[0] === 0x41 // roland
34
- && e.messageData[2] === 0x42 // GS
35
- && e.messageData[6] === 0x7F; // Mode set
36
- }
37
-
38
- /**
39
- * @param e {MIDIMessage}
40
- * @returns boolean
41
- */
42
- export function isGMOn(e)
43
- {
44
- return e.messageData[0] === 0x7E // non realtime
45
- && e.messageData[2] === 0x09 // gm system
46
- && e.messageData[3] === 0x01; // gm1
47
- }
48
-
49
- /**
50
- * @param e {MIDIMessage}
51
- * @returns boolean
52
- */
53
- export function isGM2On(e)
54
- {
55
- return e.messageData[0] === 0x7E // non realtime
56
- && e.messageData[2] === 0x09 // gm system
57
- && e.messageData[3] === 0x03; // gm2
58
- }