spessasynth_lib 3.24.3 → 3.24.4

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 (93) hide show
  1. package/package.json +1 -2
  2. package/sequencer/worklet_sequencer/worklet_sequencer.js +6 -0
  3. package/synthetizer/worklet_processor.min.js +6 -6
  4. package/@types/external_midi/midi_handler.d.ts +0 -39
  5. package/@types/external_midi/web_midi_link.d.ts +0 -12
  6. package/@types/externals/stbvorbis_sync/stbvorbis_sync.min.d.ts +0 -1
  7. package/@types/index.d.ts +0 -44
  8. package/@types/midi_parser/basic_midi.d.ts +0 -36
  9. package/@types/midi_parser/midi_builder.d.ts +0 -68
  10. package/@types/midi_parser/midi_data.d.ts +0 -46
  11. package/@types/midi_parser/midi_editor.d.ts +0 -89
  12. package/@types/midi_parser/midi_loader.d.ts +0 -30
  13. package/@types/midi_parser/midi_message.d.ts +0 -155
  14. package/@types/midi_parser/midi_sequence.d.ts +0 -135
  15. package/@types/midi_parser/midi_writer.d.ts +0 -6
  16. package/@types/midi_parser/rmidi_writer.d.ts +0 -85
  17. package/@types/midi_parser/used_keys_loaded.d.ts +0 -10
  18. package/@types/sequencer/sequencer.d.ts +0 -277
  19. package/@types/sequencer/worklet_sequencer/sequencer_message.d.ts +0 -31
  20. package/@types/soundfont/basic_soundfont/basic_instrument.d.ts +0 -29
  21. package/@types/soundfont/basic_soundfont/basic_preset.d.ts +0 -86
  22. package/@types/soundfont/basic_soundfont/basic_sample.d.ts +0 -88
  23. package/@types/soundfont/basic_soundfont/basic_soundfont.d.ts +0 -102
  24. package/@types/soundfont/basic_soundfont/basic_zone.d.ts +0 -58
  25. package/@types/soundfont/basic_soundfont/basic_zones.d.ts +0 -22
  26. package/@types/soundfont/basic_soundfont/generator.d.ts +0 -102
  27. package/@types/soundfont/basic_soundfont/modulator.d.ts +0 -92
  28. package/@types/soundfont/basic_soundfont/riff_chunk.d.ts +0 -45
  29. package/@types/soundfont/basic_soundfont/write_dls/art2.d.ts +0 -6
  30. package/@types/soundfont/basic_soundfont/write_dls/articulator.d.ts +0 -28
  31. package/@types/soundfont/basic_soundfont/write_dls/combine_zones.d.ts +0 -8
  32. package/@types/soundfont/basic_soundfont/write_dls/ins.d.ts +0 -7
  33. package/@types/soundfont/basic_soundfont/write_dls/lins.d.ts +0 -5
  34. package/@types/soundfont/basic_soundfont/write_dls/modulator_converter.d.ts +0 -11
  35. package/@types/soundfont/basic_soundfont/write_dls/rgn2.d.ts +0 -8
  36. package/@types/soundfont/basic_soundfont/write_dls/wave.d.ts +0 -6
  37. package/@types/soundfont/basic_soundfont/write_dls/write_dls.d.ts +0 -6
  38. package/@types/soundfont/basic_soundfont/write_dls/wsmp.d.ts +0 -12
  39. package/@types/soundfont/basic_soundfont/write_dls/wvpl.d.ts +0 -8
  40. package/@types/soundfont/basic_soundfont/write_sf2/ibag.d.ts +0 -6
  41. package/@types/soundfont/basic_soundfont/write_sf2/igen.d.ts +0 -6
  42. package/@types/soundfont/basic_soundfont/write_sf2/imod.d.ts +0 -6
  43. package/@types/soundfont/basic_soundfont/write_sf2/inst.d.ts +0 -6
  44. package/@types/soundfont/basic_soundfont/write_sf2/pbag.d.ts +0 -6
  45. package/@types/soundfont/basic_soundfont/write_sf2/pgen.d.ts +0 -6
  46. package/@types/soundfont/basic_soundfont/write_sf2/phdr.d.ts +0 -6
  47. package/@types/soundfont/basic_soundfont/write_sf2/pmod.d.ts +0 -6
  48. package/@types/soundfont/basic_soundfont/write_sf2/sdta.d.ts +0 -11
  49. package/@types/soundfont/basic_soundfont/write_sf2/shdr.d.ts +0 -8
  50. package/@types/soundfont/basic_soundfont/write_sf2/soundfont_trimmer.d.ts +0 -6
  51. package/@types/soundfont/basic_soundfont/write_sf2/write.d.ts +0 -21
  52. package/@types/soundfont/dls/articulator_converter.d.ts +0 -19
  53. package/@types/soundfont/dls/dls_destinations.d.ts +0 -29
  54. package/@types/soundfont/dls/dls_preset.d.ts +0 -13
  55. package/@types/soundfont/dls/dls_sample.d.ts +0 -19
  56. package/@types/soundfont/dls/dls_soundfont.d.ts +0 -31
  57. package/@types/soundfont/dls/dls_sources.d.ts +0 -27
  58. package/@types/soundfont/dls/dls_zone.d.ts +0 -23
  59. package/@types/soundfont/dls/read_articulation.d.ts +0 -12
  60. package/@types/soundfont/dls/read_instrument.d.ts +0 -5
  61. package/@types/soundfont/dls/read_instrument_list.d.ts +0 -5
  62. package/@types/soundfont/dls/read_lart.d.ts +0 -7
  63. package/@types/soundfont/dls/read_region.d.ts +0 -7
  64. package/@types/soundfont/dls/read_samples.d.ts +0 -5
  65. package/@types/soundfont/load_soundfont.d.ts +0 -6
  66. package/@types/soundfont/read_sf2/generators.d.ts +0 -16
  67. package/@types/soundfont/read_sf2/instruments.d.ts +0 -29
  68. package/@types/soundfont/read_sf2/modulators.d.ts +0 -15
  69. package/@types/soundfont/read_sf2/presets.d.ts +0 -30
  70. package/@types/soundfont/read_sf2/samples.d.ts +0 -55
  71. package/@types/soundfont/read_sf2/soundfont.d.ts +0 -28
  72. package/@types/soundfont/read_sf2/zones.d.ts +0 -99
  73. package/@types/synthetizer/audio_effects/effects_config.d.ts +0 -41
  74. package/@types/synthetizer/audio_effects/fancy_chorus.d.ts +0 -97
  75. package/@types/synthetizer/audio_effects/reverb.d.ts +0 -7
  76. package/@types/synthetizer/key_modifier_manager.d.ts +0 -56
  77. package/@types/synthetizer/synth_event_handler.d.ts +0 -263
  78. package/@types/synthetizer/synth_soundfont_manager.d.ts +0 -52
  79. package/@types/synthetizer/synthetizer.d.ts +0 -358
  80. package/@types/synthetizer/worklet_system/message_protocol/worklet_message.d.ts +0 -98
  81. package/@types/synthetizer/worklet_system/worklet_methods/worklet_key_modifier.d.ts +0 -77
  82. package/@types/synthetizer/worklet_system/worklet_methods/worklet_soundfont_manager/sfman_message.d.ts +0 -7
  83. package/@types/synthetizer/worklet_system/worklet_utilities/controller_tables.d.ts +0 -23
  84. package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +0 -155
  85. package/@types/synthetizer/worklet_url.d.ts +0 -5
  86. package/@types/utils/buffer_to_wav.d.ts +0 -31
  87. package/@types/utils/byte_functions/big_endian.d.ts +0 -13
  88. package/@types/utils/byte_functions/little_endian.d.ts +0 -35
  89. package/@types/utils/byte_functions/string.d.ts +0 -27
  90. package/@types/utils/byte_functions/variable_length_quantity.d.ts +0 -12
  91. package/@types/utils/indexed_array.d.ts +0 -21
  92. package/@types/utils/loggin.d.ts +0 -26
  93. package/@types/utils/other.d.ts +0 -37
@@ -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";
@@ -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,6 +0,0 @@
1
- /**
2
- * Exports the midi as a .mid file
3
- * @param midi {BasicMIDI} the midi to export
4
- * @returns {Uint8Array} the binary .mid file data
5
- */
6
- export function writeMIDIFile(midi: BasicMIDI): Uint8Array;