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.
Files changed (99) hide show
  1. package/README.md +14 -4
  2. package/midi_parser/midi_loader.js +51 -28
  3. package/package.json +1 -2
  4. package/sequencer/sequencer.js +3 -3
  5. package/sequencer/worklet_sequencer/worklet_sequencer.js +6 -0
  6. package/synthetizer/synthetizer.js +8 -6
  7. package/synthetizer/worklet_processor.min.js +9 -9
  8. package/synthetizer/worklet_system/main_processor.js +9 -7
  9. package/synthetizer/worklet_system/worklet_methods/note_on.js +2 -1
  10. package/@types/external_midi/midi_handler.d.ts +0 -39
  11. package/@types/external_midi/web_midi_link.d.ts +0 -12
  12. package/@types/externals/stbvorbis_sync/stbvorbis_sync.min.d.ts +0 -1
  13. package/@types/index.d.ts +0 -44
  14. package/@types/midi_parser/basic_midi.d.ts +0 -36
  15. package/@types/midi_parser/midi_builder.d.ts +0 -68
  16. package/@types/midi_parser/midi_data.d.ts +0 -46
  17. package/@types/midi_parser/midi_editor.d.ts +0 -89
  18. package/@types/midi_parser/midi_loader.d.ts +0 -30
  19. package/@types/midi_parser/midi_message.d.ts +0 -155
  20. package/@types/midi_parser/midi_sequence.d.ts +0 -135
  21. package/@types/midi_parser/midi_writer.d.ts +0 -6
  22. package/@types/midi_parser/rmidi_writer.d.ts +0 -85
  23. package/@types/midi_parser/used_keys_loaded.d.ts +0 -10
  24. package/@types/sequencer/sequencer.d.ts +0 -277
  25. package/@types/sequencer/worklet_sequencer/sequencer_message.d.ts +0 -31
  26. package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +0 -29
  27. package/@types/soundfont/basic_soundfont/basic_preset.d.ts +0 -86
  28. package/@types/soundfont/basic_soundfont/basic_sample.d.ts +0 -88
  29. package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +0 -102
  30. package/@types/soundfont/basic_soundfont/basic_zone.d.ts +0 -58
  31. package/@types/soundfont/basic_soundfont/basic_zones.d.ts +0 -22
  32. package/@types/soundfont/basic_soundfont/generator.d.ts +0 -102
  33. package/@types/soundfont/basic_soundfont/modulator.d.ts +0 -92
  34. package/@types/soundfont/basic_soundfont/riff_chunk.d.ts +0 -45
  35. package/@types/soundfont/basic_soundfont/write_dls/art2.d.ts +0 -6
  36. package/@types/soundfont/basic_soundfont/write_dls/articulator.d.ts +0 -28
  37. package/@types/soundfont/basic_soundfont/write_dls/combine_zones.d.ts +0 -8
  38. package/@types/soundfont/basic_soundfont/write_dls/ins.d.ts +0 -7
  39. package/@types/soundfont/basic_soundfont/write_dls/lins.d.ts +0 -5
  40. package/@types/soundfont/basic_soundfont/write_dls/modulator_converter.d.ts +0 -11
  41. package/@types/soundfont/basic_soundfont/write_dls/rgn2.d.ts +0 -8
  42. package/@types/soundfont/basic_soundfont/write_dls/wave.d.ts +0 -6
  43. package/@types/soundfont/basic_soundfont/write_dls/write_dls.d.ts +0 -6
  44. package/@types/soundfont/basic_soundfont/write_dls/wsmp.d.ts +0 -12
  45. package/@types/soundfont/basic_soundfont/write_dls/wvpl.d.ts +0 -8
  46. package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +0 -6
  47. package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +0 -6
  48. package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +0 -6
  49. package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +0 -6
  50. package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +0 -6
  51. package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +0 -6
  52. package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +0 -6
  53. package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +0 -6
  54. package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +0 -11
  55. package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +0 -8
  56. package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +0 -6
  57. package/@types/soundfont/basic_soundfont/write_sf2/write.d.ts +0 -21
  58. package/@types/soundfont/dls/articulator_converter.d.ts +0 -19
  59. package/@types/soundfont/dls/dls_destinations.d.ts +0 -29
  60. package/@types/soundfont/dls/dls_preset.d.ts +0 -13
  61. package/@types/soundfont/dls/dls_sample.d.ts +0 -19
  62. package/@types/soundfont/dls/dls_soundfont.d.ts +0 -31
  63. package/@types/soundfont/dls/dls_sources.d.ts +0 -27
  64. package/@types/soundfont/dls/dls_zone.d.ts +0 -23
  65. package/@types/soundfont/dls/read_articulation.d.ts +0 -12
  66. package/@types/soundfont/dls/read_instrument.d.ts +0 -5
  67. package/@types/soundfont/dls/read_instrument_list.d.ts +0 -5
  68. package/@types/soundfont/dls/read_lart.d.ts +0 -7
  69. package/@types/soundfont/dls/read_region.d.ts +0 -7
  70. package/@types/soundfont/dls/read_samples.d.ts +0 -5
  71. package/@types/soundfont/load_soundfont.d.ts +0 -6
  72. package/@types/soundfont/read_sf2/generators.d.ts +0 -16
  73. package/@types/soundfont/read_sf2/instruments.d.ts +0 -29
  74. package/@types/soundfont/read_sf2/modulators.d.ts +0 -15
  75. package/@types/soundfont/read_sf2/presets.d.ts +0 -30
  76. package/@types/soundfont/read_sf2/samples.d.ts +0 -55
  77. package/@types/soundfont/read_sf2/soundfont.d.ts +0 -28
  78. package/@types/soundfont/read_sf2/zones.d.ts +0 -99
  79. package/@types/synthetizer/audio_effects/effects_config.d.ts +0 -41
  80. package/@types/synthetizer/audio_effects/fancy_chorus.d.ts +0 -97
  81. package/@types/synthetizer/audio_effects/reverb.d.ts +0 -7
  82. package/@types/synthetizer/key_modifier_manager.d.ts +0 -56
  83. package/@types/synthetizer/synth_event_handler.d.ts +0 -263
  84. package/@types/synthetizer/synth_soundfont_manager.d.ts +0 -52
  85. package/@types/synthetizer/synthetizer.d.ts +0 -358
  86. package/@types/synthetizer/worklet_system/message_protocol/worklet_message.d.ts +0 -98
  87. package/@types/synthetizer/worklet_system/worklet_methods/worklet_key_modifier.d.ts +0 -77
  88. package/@types/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/sfman_message.d.ts +0 -7
  89. package/@types/synthetizer/worklet_system/worklet_utilities/controller_tables.d.ts +0 -23
  90. package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +0 -155
  91. package/@types/synthetizer/worklet_url.d.ts +0 -5
  92. package/@types/utils/buffer_to_wav.d.ts +0 -31
  93. package/@types/utils/byte_functions/big_endian.d.ts +0 -13
  94. package/@types/utils/byte_functions/little_endian.d.ts +0 -35
  95. package/@types/utils/byte_functions/string.d.ts +0 -27
  96. package/@types/utils/byte_functions/variable_length_quantity.d.ts +0 -12
  97. package/@types/utils/indexed_array.d.ts +0 -21
  98. package/@types/utils/loggin.d.ts +0 -26
  99. package/@types/utils/other.d.ts +0 -37
@@ -62,7 +62,7 @@ import { panVoice } from "./worklet_utilities/stereo_panner.js";
62
62
  // if the note is released faster than that, it forced to last that long
63
63
  // this is used mostly for drum channels, where a lot of midis like to send instant note off after a note on
64
64
  export const MIN_NOTE_LENGTH = 0.03;
65
- // this sounds way nicer for instant hi-hat cutoff
65
+ // this sounds way nicer for an instant hi-hat cutoff
66
66
  export const MIN_EXCLUSIVE_LENGTH = 0.07;
67
67
 
68
68
  export const SYNTHESIZER_GAIN = 1.0;
@@ -149,7 +149,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
149
149
  this.voiceCap = VOICE_CAP;
150
150
 
151
151
  /**
152
- * -1 to 1
152
+ * (-1 to 1)
153
153
  * @type {number}
154
154
  */
155
155
  this.pan = 0.0;
@@ -168,7 +168,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
168
168
  this.keyModifierManager = new WorkletKeyModifierManager();
169
169
 
170
170
  /**
171
- * Overrides the main soundfont (embedded for example)
171
+ * Overrides the main soundfont (embedded, for example)
172
172
  * @type {BasicSoundFont}
173
173
  */
174
174
  this.overrideSoundfont = undefined;
@@ -214,7 +214,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
214
214
  this.workletProcessorChannels[DEFAULT_PERCUSSION].preset = this.drumPreset;
215
215
  this.workletProcessorChannels[DEFAULT_PERCUSSION].drumChannel = true;
216
216
 
217
- // these smoothing factors were tested on 44100Hz, adjust them here
217
+ // these smoothing factors were tested on 44,100 Hz, adjust them here
218
218
  this.volumeEnvelopeSmoothingFactor = VOLUME_ENVELOPE_SMOOTHING_FACTOR * (44100 / sampleRate);
219
219
  this.panSmoothingFactor = PAN_SMOOTHING_FACTOR * (44100 / sampleRate);
220
220
 
@@ -259,6 +259,8 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
259
259
  {
260
260
  this.sequencer.loop = false;
261
261
  }
262
+ // set voice cap to unlimited
263
+ this.voiceCap = Infinity;
262
264
  this.sequencer.loadNewSongList([options.processorOptions.startRenderingData.parsedMIDI]);
263
265
  }
264
266
  }
@@ -316,7 +318,7 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
316
318
  /**
317
319
  * Syntesizes the voice to buffers
318
320
  * @param inputs {Float32Array[][]} required by WebAudioAPI
319
- * @param outputs {Float32Array[][]} the outputs to write to, only the first 2 channels are populated
321
+ * @param outputs {Float32Array[][]} the outputs to write to, only the first two channels are populated
320
322
  * @returns {boolean} true
321
323
  */
322
324
  process(inputs, outputs)
@@ -348,14 +350,14 @@ class SpessaSynthProcessor extends AudioWorkletProcessor
348
350
  {
349
351
  // first output only
350
352
  const output = outputs[0];
351
- // reverb and chorus are disabled. 32 output channels: two for each midi channels
353
+ // reverb and chorus are disabled. 32 output channels: two for each midi channel
352
354
  outputIndex = (index % 16) * 2;
353
355
  outputLeft = output[outputIndex];
354
356
  outputRight = output[outputIndex + 1];
355
357
  }
356
358
  else
357
359
  {
358
- // 2 first outputs are reverb and chorus, other are for channels
360
+ // 2 first outputs are reverb and chorus, others are for channels
359
361
  outputIndex = (index % this._outputsAmount) + 2;
360
362
  outputLeft = outputs[outputIndex][0];
361
363
  outputRight = outputs[outputIndex][1];
@@ -19,11 +19,12 @@ const EXCLUSIVE_MOD_CUTOFF_TIME = -1130; // less because filter shenanigans
19
19
  */
20
20
  export function noteOn(channel, midiNote, velocity, enableDebugging = false, sendEvent = true, startTime = currentTime)
21
21
  {
22
- if (velocity === 0)
22
+ if (velocity < 1)
23
23
  {
24
24
  this.noteOff(channel, midiNote);
25
25
  return;
26
26
  }
27
+ velocity = Math.min(127, velocity);
27
28
 
28
29
  const channelObject = this.workletProcessorChannels[channel];
29
30
  if (
@@ -1,39 +0,0 @@
1
- export class MIDIDeviceHandler {
2
- /**
3
- * @returns {Promise<boolean>} if succeded
4
- */
5
- createMIDIDeviceHandler(): Promise<boolean>;
6
- /**
7
- * @type {MIDIInput}
8
- */
9
- selectedInput: MIDIInput;
10
- /**
11
- * @type {MIDIOutput}
12
- */
13
- selectedOutput: MIDIOutput;
14
- inputs: any[] | MIDIInputMap;
15
- outputs: any[] | MIDIOutputMap;
16
- /**
17
- * Connects the sequencer to a given MIDI output port
18
- * @param output {MIDIOutput}
19
- * @param seq {Sequencer}
20
- */
21
- connectMIDIOutputToSeq(output: MIDIOutput, seq: Sequencer): void;
22
- /**
23
- * Disconnects a midi output port from the sequencer
24
- * @param seq {Sequencer}
25
- */
26
- disconnectSeqFromMIDI(seq: Sequencer): void;
27
- /**
28
- * Connects a MIDI input to the synthesizer
29
- * @param input {MIDIInput}
30
- * @param synth {Synthetizer}
31
- */
32
- connectDeviceToSynth(input: MIDIInput, synth: Synthetizer): void;
33
- /**
34
- * @param input {MIDIInput}
35
- */
36
- disconnectDeviceFromSynth(input: MIDIInput): void;
37
- disconnectAllDevicesFromSynth(): void;
38
- }
39
- import { Synthetizer } from "../synthetizer/synthetizer.js";
@@ -1,12 +0,0 @@
1
- /**
2
- * web_midi_link.js
3
- * purpose: handles the web midi link connection to the synthesizer
4
- * https://www.g200kg.com/en/docs/webmidilink/
5
- */
6
- export class WebMidiLinkHandler {
7
- /**
8
- * @param synth {Synthetizer} the synth to play to
9
- */
10
- constructor(synth: Synthetizer);
11
- }
12
- import { Synthetizer } from "../synthetizer/synthetizer.js";
@@ -1 +0,0 @@
1
- export const stbvorbis: any;
package/@types/index.d.ts DELETED
@@ -1,44 +0,0 @@
1
- import { Sequencer } from './sequencer/sequencer.js';
2
- import { Synthetizer } from './synthetizer/synthetizer.js';
3
- import { DEFAULT_PERCUSSION } from './synthetizer/synthetizer.js';
4
- import { VOICE_CAP } from './synthetizer/synthetizer.js';
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";
13
- import { loadSoundFont } from "./soundfont/load_soundfont.js";
14
- import { trimSoundfont } from "./soundfont/basic_soundfont/write_sf2/soundfont_trimmer.js";
15
- import { modulatorSources } from "./soundfont/basic_soundfont/modulator.js";
16
- import { MIDI } from './midi_parser/midi_loader.js';
17
- import { MIDIBuilder } from "./midi_parser/midi_builder.js";
18
- import { IndexedByteArray } from './utils/indexed_array.js';
19
- import { writeMIDIFile } from './midi_parser/midi_writer.js';
20
- import { writeRMIDI } from './midi_parser/rmidi_writer.js';
21
- import { applySnapshotToMIDI } from './midi_parser/midi_editor.js';
22
- import { modifyMIDI } from './midi_parser/midi_editor.js';
23
- import { MIDIticksToSeconds } from './midi_parser/basic_midi.js';
24
- import { audioBufferToWav } from './utils/buffer_to_wav.js';
25
- import { SpessaSynthLogging } from './utils/loggin.js';
26
- import { SpessaSynthGroup } from './utils/loggin.js';
27
- import { SpessaSynthTable } from './utils/loggin.js';
28
- import { SpessaSynthGroupEnd } from './utils/loggin.js';
29
- import { SpessaSynthInfo } from './utils/loggin.js';
30
- import { SpessaSynthWarn } from './utils/loggin.js';
31
- import { SpessaSynthGroupCollapsed } from './utils/loggin.js';
32
- import { midiControllers } from './midi_parser/midi_message.js';
33
- import { messageTypes } from './midi_parser/midi_message.js';
34
- import { MIDIDeviceHandler } from "./external_midi/midi_handler.js";
35
- import { WebMidiLinkHandler } from "./external_midi/web_midi_link.js";
36
- import { arrayToHexString } from './utils/other.js';
37
- import { consoleColors } from './utils/other.js';
38
- import { formatTitle } from './utils/other.js';
39
- import { formatTime } from './utils/other.js';
40
- import { readBytesAsUintBigEndian } from './utils/byte_functions/big_endian.js';
41
- import { NON_CC_INDEX_OFFSET } from "./synthetizer/worklet_system/worklet_utilities/controller_tables.js";
42
- import { ALL_CHANNELS_OR_DIFFERENT_ACTION } from './synthetizer/worklet_system/message_protocol/worklet_message.js';
43
- import { WORKLET_URL_ABSOLUTE } from './synthetizer/worklet_url.js';
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 };
@@ -1,36 +0,0 @@
1
- /**
2
- * Converts ticks to time in seconds
3
- * @param ticks {number} time in MIDI ticks
4
- * @param mid {BasicMIDI|MidiData} the MIDI
5
- * @returns {number} time in seconds
6
- */
7
- export function MIDIticksToSeconds(ticks: number, mid: BasicMIDI | MidiData): number;
8
- /**
9
- * BasicMIDI is the base of a complete MIDI file, used by the sequencer internally.
10
- * BasicMIDI is not available on the main thread, as it contains the actual track data which can be large.
11
- * It can be accessed by calling getMIDI() on the Sequencer.
12
- */
13
- export class BasicMIDI extends MIDISequenceData {
14
- /**
15
- * Copies a MIDI
16
- * @param mid {BasicMIDI}
17
- * @returns {BasicMIDI}
18
- */
19
- static copyFrom(mid: BasicMIDI): BasicMIDI;
20
- /**
21
- * The embedded soundfont in the MIDI file, represented as an ArrayBuffer, if available.
22
- * @type {ArrayBuffer|undefined}
23
- */
24
- embeddedSoundFont: ArrayBuffer | undefined;
25
- /**
26
- * The actual track data of the MIDI file, represented as an array of tracks.
27
- * Tracks are arrays of MidiMessage objects.
28
- * @type {MidiMessage[][]}
29
- */
30
- tracks: MidiMessage[][];
31
- /**
32
- * Updates all internal values
33
- */
34
- flush(): void;
35
- }
36
- import { MIDISequenceData } from "./midi_sequence.js";
@@ -1,68 +0,0 @@
1
- /**
2
- * A class that helps to build a MIDI file from scratch.
3
- */
4
- export class MIDIBuilder extends BasicMIDI {
5
- /**
6
- * @param name {string} The MIDI's name
7
- * @param timeDivision {number} the file's time division
8
- * @param initialTempo {number} the file's initial tempo
9
- */
10
- constructor(name: string, timeDivision?: number, initialTempo?: number);
11
- encoder: TextEncoder;
12
- /**
13
- * Adds a new "set tempo" message
14
- * @param ticks {number} the tick number of the event
15
- * @param tempo {number} the tempo in beats per minute (BPM)
16
- */
17
- addSetTempo(ticks: number, tempo: number): void;
18
- /**
19
- * Adds a new MIDI track
20
- * @param name {string} the new track's name
21
- * @param port {number} the new track's port
22
- */
23
- addNewTrack(name: string, port?: number): void;
24
- /**
25
- * Adds a new MIDI Event
26
- * @param ticks {number} the tick time of the event
27
- * @param track {number} the track number to use
28
- * @param event {number} the MIDI event number
29
- * @param eventData {Uint8Array|Iterable<number>} the raw event data
30
- */
31
- addEvent(ticks: number, track: number, event: number, eventData: Uint8Array | Iterable<number>): void;
32
- /**
33
- * Adds a new Note On event
34
- * @param ticks {number} the tick time of the event
35
- * @param track {number} the track number to use
36
- * @param channel {number} the channel to use
37
- * @param midiNote {number} the midi note of the keypress
38
- * @param velocity {number} the velocity of the keypress
39
- */
40
- addNoteOn(ticks: number, track: number, channel: number, midiNote: number, velocity: number): void;
41
- /**
42
- * Adds a new Note Off event
43
- * @param ticks {number} the tick time of the event
44
- * @param track {number} the track number to use
45
- * @param channel {number} the channel to use
46
- * @param midiNote {number} the midi note of the key release
47
- */
48
- addNoteOff(ticks: number, track: number, channel: number, midiNote: number): void;
49
- /**
50
- * Adds a new Controller Change event
51
- * @param ticks {number} the tick time of the event
52
- * @param track {number} the track number to use
53
- * @param channel {number} the channel to use
54
- * @param controllerNumber {number} the MIDI CC to use
55
- * @param controllerValue {number} the new CC value
56
- */
57
- addControllerChange(ticks: number, track: number, channel: number, controllerNumber: number, controllerValue: number): void;
58
- /**
59
- * Adds a new Pitch Wheel event
60
- * @param ticks {number} the tick time of the event
61
- * @param track {number} the track to use
62
- * @param channel {number} the channel to use
63
- * @param MSB {number} SECOND byte of the MIDI pitchWheel message
64
- * @param LSB {number} FIRST byte of the MIDI pitchWheel message
65
- */
66
- addPitchWheel(ticks: number, track: number, channel: number, MSB: number, LSB: number): void;
67
- }
68
- import { BasicMIDI } from "./basic_midi.js";
@@ -1,46 +0,0 @@
1
- /**
2
- * A simplified version of the MIDI, accessible at all times from the Sequencer.
3
- * Use getMIDI() to get the actual sequence.
4
- * This class contains all properties that MIDI does, except for tracks and the embedded soundfont.
5
- */
6
- export class MidiData extends MIDISequenceData {
7
- /**
8
- * Constructor that copies data from a BasicMIDI instance.
9
- * @param {BasicMIDI} midi - The BasicMIDI instance to copy data from.
10
- */
11
- constructor(midi: BasicMIDI);
12
- /**
13
- * A boolean indicating if the MIDI file contains an embedded soundfont.
14
- * If the embedded soundfont is undefined, this will be false.
15
- * @type {boolean}
16
- */
17
- isEmbedded: boolean;
18
- timeDivision: any;
19
- duration: any;
20
- tempoChanges: any;
21
- copyright: any;
22
- tracksAmount: any;
23
- lyrics: any;
24
- lyricsTicks: any;
25
- firstNoteOn: any;
26
- keyRange: any;
27
- lastVoiceEventTick: any;
28
- midiPorts: any;
29
- midiPortChannelOffsets: any;
30
- usedChannelsOnTrack: any;
31
- loop: any;
32
- midiName: any;
33
- midiNameUsesFileName: any;
34
- fileName: any;
35
- rawMidiName: any;
36
- format: any;
37
- RMIDInfo: any;
38
- bankOffset: any;
39
- isKaraokeFile: any;
40
- }
41
- /**
42
- * Temporary MIDI data used when the MIDI is not loaded.
43
- * @type {MidiData}
44
- */
45
- export const DUMMY_MIDI_DATA: MidiData;
46
- import { MIDISequenceData } from "./midi_sequence.js";
@@ -1,89 +0,0 @@
1
- /**
2
- * @param ticks {number}
3
- * @returns {MidiMessage}
4
- */
5
- export function getGsOn(ticks: number): MidiMessage;
6
- /**
7
- * @typedef {Object} DesiredProgramChange
8
- * @property {number} channel - The channel number.
9
- * @property {number} program - The program number.
10
- * @property {number} bank - The bank number.
11
- * @property {boolean} isDrum - Indicates if the channel is a drum channel.
12
- * If it is, then the bank number is ignored.
13
- */
14
- /**
15
- * @typedef {Object} DesiredControllerChange
16
- * @property {number} channel - The channel number.
17
- * @property {number} controllerNumber - The MIDI controller number.
18
- * @property {number} controllerValue - The new controller value.
19
- */
20
- /**
21
- * @typedef {Object} DesiredChanneltranspose
22
- * @property {number} channel - The channel number.
23
- * @property {number} keyShift - The number of semitones to transpose.
24
- * Note that this can use floating point numbers,
25
- * which will be used to fine-tune the pitch in cents using RPN.
26
- */
27
- /**
28
- * Allows easy editing of the file by removing channels, changing programs,
29
- * changing controllers and transposing channels. Note that this modifies the MIDI in-place.
30
- *
31
- * @param {BasicMIDI} midi - The MIDI file to modify.
32
- * @param {DesiredProgramChange[]} desiredProgramChanges - The programs to set on given channels.
33
- * @param {DesiredControllerChange[]} desiredControllerChanges - The controllers to set on given channels.
34
- * @param {number[]} desiredChannelsToClear - The channels to remove from the sequence.
35
- * @param {DesiredChanneltranspose[]} desiredChannelsToTranspose - The channels to transpose.
36
- */
37
- export function modifyMIDI(midi: BasicMIDI, desiredProgramChanges?: DesiredProgramChange[], desiredControllerChanges?: DesiredControllerChange[], desiredChannelsToClear?: number[], desiredChannelsToTranspose?: DesiredChanneltranspose[]): void;
38
- /**
39
- * Modifies the sequence according to the locked presets and controllers in the given snapshot
40
- * @param midi {BasicMIDI}
41
- * @param snapshot {SynthesizerSnapshot}
42
- */
43
- export function applySnapshotToMIDI(midi: BasicMIDI, snapshot: SynthesizerSnapshot): void;
44
- export type DesiredProgramChange = {
45
- /**
46
- * - The channel number.
47
- */
48
- channel: number;
49
- /**
50
- * - The program number.
51
- */
52
- program: number;
53
- /**
54
- * - The bank number.
55
- */
56
- bank: number;
57
- /**
58
- * - Indicates if the channel is a drum channel.
59
- * If it is, then the bank number is ignored.
60
- */
61
- isDrum: boolean;
62
- };
63
- export type DesiredControllerChange = {
64
- /**
65
- * - The channel number.
66
- */
67
- channel: number;
68
- /**
69
- * - The MIDI controller number.
70
- */
71
- controllerNumber: number;
72
- /**
73
- * - The new controller value.
74
- */
75
- controllerValue: number;
76
- };
77
- export type DesiredChanneltranspose = {
78
- /**
79
- * - The channel number.
80
- */
81
- channel: number;
82
- /**
83
- * - The number of semitones to transpose.
84
- * Note that this can use floating point numbers,
85
- * which will be used to fine-tune the pitch in cents using RPN.
86
- */
87
- keyShift: number;
88
- };
89
- import { MidiMessage } from "./midi_message.js";
@@ -1,30 +0,0 @@
1
- /**
2
- * midi_loader.js
3
- * purpose: parses a midi file for the seqyencer, including things like marker or CC 2/4 loop detection, copyright detection etc.
4
- */
5
- /**
6
- * The MIDI class is a MIDI file parser that reads a MIDI file and extracts all the necessary information from it.
7
- * Supported formats are .mid and .rmi files.
8
- */
9
- export class MIDI extends BasicMIDI {
10
- /**
11
- * Parses a given midi file
12
- * @param arrayBuffer {ArrayBuffer}
13
- * @param fileName {string} optional, replaces the decoded title if empty
14
- */
15
- constructor(arrayBuffer: ArrayBuffer, fileName?: string);
16
- copyright: any;
17
- rawMidiName: any;
18
- midiName: any;
19
- /**
20
- * @param fileByteArray {IndexedByteArray}
21
- * @returns {{type: string, size: number, data: IndexedByteArray}}
22
- */
23
- readMIDIChunk(fileByteArray: IndexedByteArray): {
24
- type: string;
25
- size: number;
26
- data: IndexedByteArray;
27
- };
28
- }
29
- import { BasicMIDI } from "./basic_midi.js";
30
- import { IndexedByteArray } from "../utils/indexed_array.js";
@@ -1,155 +0,0 @@
1
- /**
2
- * Gets the status byte's channel
3
- * @param statusByte
4
- * @returns {number} channel is -1 for system messages -2 for meta and -3 for sysex
5
- */
6
- export function getChannel(statusByte: any): number;
7
- /**
8
- * Gets the event's status and channel from the status byte
9
- * @param statusByte {number} the status byte
10
- * @returns {{channel: number, status: number}} channel will be -1 for sysex and meta
11
- */
12
- export function getEvent(statusByte: number): {
13
- channel: number;
14
- status: number;
15
- };
16
- /**
17
- * midi_message.js
18
- * purpose: contains enums for midi events and controllers and functions to parse them
19
- */
20
- export class MidiMessage {
21
- /**
22
- * @param ticks {number}
23
- * @param byte {number} the message status byte
24
- * @param data {IndexedByteArray}
25
- */
26
- constructor(ticks: number, byte: number, data: IndexedByteArray);
27
- ticks: number;
28
- messageStatusByte: number;
29
- /**
30
- * @type {IndexedByteArray}
31
- */
32
- messageData: IndexedByteArray;
33
- }
34
- export namespace messageTypes {
35
- export let noteOff: number;
36
- export let noteOn: number;
37
- export let polyPressure: number;
38
- export let controllerChange: number;
39
- export let programChange: number;
40
- export let channelPressure: number;
41
- export let pitchBend: number;
42
- export let systemExclusive: number;
43
- export let timecode: number;
44
- export let songPosition: number;
45
- export let songSelect: number;
46
- export let tuneRequest: number;
47
- export let clock: number;
48
- export let start: number;
49
- let _continue: number;
50
- export { _continue as continue };
51
- export let stop: number;
52
- export let activeSensing: number;
53
- export let reset: number;
54
- export let sequenceNumber: number;
55
- export let text: number;
56
- export let copyright: number;
57
- export let trackName: number;
58
- export let instrumentName: number;
59
- export let lyric: number;
60
- export let marker: number;
61
- export let cuePoint: number;
62
- export let programName: number;
63
- export let midiChannelPrefix: number;
64
- export let midiPort: number;
65
- export let endOfTrack: number;
66
- export let setTempo: number;
67
- export let smpteOffset: number;
68
- export let timeSignature: number;
69
- export let keySignature: number;
70
- export let sequenceSpecific: number;
71
- }
72
- export type midiControllers = number;
73
- export namespace midiControllers {
74
- let bankSelect: number;
75
- let modulationWheel: number;
76
- let breathController: number;
77
- let footController: number;
78
- let portamentoTime: number;
79
- let dataEntryMsb: number;
80
- let mainVolume: number;
81
- let balance: number;
82
- let pan: number;
83
- let expressionController: number;
84
- let effectControl1: number;
85
- let effectControl2: number;
86
- let generalPurposeController1: number;
87
- let generalPurposeController2: number;
88
- let generalPurposeController3: number;
89
- let generalPurposeController4: number;
90
- let lsbForControl0BankSelect: number;
91
- let lsbForControl1ModulationWheel: number;
92
- let lsbForControl2BreathController: number;
93
- let lsbForControl4FootController: number;
94
- let lsbForControl5PortamentoTime: number;
95
- let lsbForControl6DataEntry: number;
96
- let lsbForControl7MainVolume: number;
97
- let lsbForControl8Balance: number;
98
- let lsbForControl10Pan: number;
99
- let lsbForControl11ExpressionController: number;
100
- let lsbForControl12EffectControl1: number;
101
- let lsbForControl13EffectControl2: number;
102
- let sustainPedal: number;
103
- let portamentoOnOff: number;
104
- let sostenutoPedal: number;
105
- let softPedal: number;
106
- let legatoFootswitch: number;
107
- let hold2Pedal: number;
108
- let soundVariation: number;
109
- let timbreHarmonicContent: number;
110
- let releaseTime: number;
111
- let attackTime: number;
112
- let brightness: number;
113
- let soundController6: number;
114
- let soundController7: number;
115
- let soundController8: number;
116
- let soundController9: number;
117
- let soundController10: number;
118
- let generalPurposeController5: number;
119
- let generalPurposeController6: number;
120
- let generalPurposeController7: number;
121
- let generalPurposeController8: number;
122
- let portamentoControl: number;
123
- let reverbDepth: number;
124
- let tremoloDepth: number;
125
- let chorusDepth: number;
126
- let detuneDepth: number;
127
- let phaserDepth: number;
128
- let dataIncrement: number;
129
- let dataDecrement: number;
130
- let NRPNLsb: number;
131
- let NRPNMsb: number;
132
- let RPNLsb: number;
133
- let RPNMsb: number;
134
- let allSoundOff: number;
135
- let resetAllControllers: number;
136
- let localControlOnOff: number;
137
- let allNotesOff: number;
138
- let omniModeOff: number;
139
- let omniModeOn: number;
140
- let monoModeOn: number;
141
- let polyModeOn: number;
142
- }
143
- /**
144
- * @type {{"11": number, "12": number, "13": number, "14": number, "8": number, "9": number, "10": number}}
145
- */
146
- export const dataBytesAmount: {
147
- "11": number;
148
- "12": number;
149
- "13": number;
150
- "14": number;
151
- "8": number;
152
- "9": number;
153
- "10": number;
154
- };
155
- import { IndexedByteArray } from "../utils/indexed_array.js";