spessasynth_lib 0.0.1
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/.idea/modules.xml +8 -0
- package/.idea/spessasynth_lib.iml +12 -0
- package/.idea/vcs.xml +6 -0
- package/copy_version.sh +38 -0
- package/index.js +73 -0
- package/package/@types/externals/stbvorbis_sync/stbvorbis_sync.min.d.ts +1 -0
- package/package/@types/index.d.ts +34 -0
- package/package/@types/midi_handler/midi_handler.d.ts +39 -0
- package/package/@types/midi_handler/web_midi_link.d.ts +12 -0
- package/package/@types/midi_parser/midi_data.d.ts +95 -0
- package/package/@types/midi_parser/midi_editor.d.ts +45 -0
- package/package/@types/midi_parser/midi_loader.d.ts +100 -0
- package/package/@types/midi_parser/midi_message.d.ts +154 -0
- package/package/@types/midi_parser/midi_writer.d.ts +6 -0
- package/package/@types/midi_parser/rmidi_writer.d.ts +9 -0
- package/package/@types/midi_parser/used_keys_loaded.d.ts +7 -0
- package/package/@types/sequencer/sequencer.d.ts +180 -0
- package/package/@types/sequencer/worklet_sequencer/sequencer_message.d.ts +28 -0
- package/package/@types/soundfont/read/generators.d.ts +98 -0
- package/package/@types/soundfont/read/instruments.d.ts +50 -0
- package/package/@types/soundfont/read/modulators.d.ts +73 -0
- package/package/@types/soundfont/read/presets.d.ts +87 -0
- package/package/@types/soundfont/read/riff_chunk.d.ts +31 -0
- package/package/@types/soundfont/read/samples.d.ts +134 -0
- package/package/@types/soundfont/read/zones.d.ts +141 -0
- package/package/@types/soundfont/soundfont.d.ts +76 -0
- package/package/@types/soundfont/write/ibag.d.ts +6 -0
- package/package/@types/soundfont/write/igen.d.ts +6 -0
- package/package/@types/soundfont/write/imod.d.ts +6 -0
- package/package/@types/soundfont/write/inst.d.ts +6 -0
- package/package/@types/soundfont/write/pbag.d.ts +6 -0
- package/package/@types/soundfont/write/pgen.d.ts +6 -0
- package/package/@types/soundfont/write/phdr.d.ts +6 -0
- package/package/@types/soundfont/write/pmod.d.ts +6 -0
- package/package/@types/soundfont/write/sdta.d.ts +11 -0
- package/package/@types/soundfont/write/shdr.d.ts +8 -0
- package/package/@types/soundfont/write/soundfont_trimmer.d.ts +6 -0
- package/package/@types/soundfont/write/write.d.ts +21 -0
- package/package/@types/synthetizer/audio_effects/effects_config.d.ts +29 -0
- package/package/@types/synthetizer/audio_effects/fancy_chorus.d.ts +93 -0
- package/package/@types/synthetizer/audio_effects/reverb.d.ts +7 -0
- package/package/@types/synthetizer/synth_event_handler.d.ts +161 -0
- package/package/@types/synthetizer/synthetizer.d.ts +294 -0
- package/package/@types/synthetizer/worklet_system/message_protocol/worklet_message.d.ts +89 -0
- package/package/@types/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.d.ts +134 -0
- package/package/@types/synthetizer/worklet_url.d.ts +5 -0
- package/package/@types/utils/buffer_to_wav.d.ts +8 -0
- package/package/@types/utils/byte_functions/big_endian.d.ts +13 -0
- package/package/@types/utils/byte_functions/little_endian.d.ts +35 -0
- package/package/@types/utils/byte_functions/string.d.ts +22 -0
- package/package/@types/utils/byte_functions/variable_length_quantity.d.ts +12 -0
- package/package/@types/utils/indexed_array.d.ts +21 -0
- package/package/@types/utils/loggin.d.ts +26 -0
- package/package/@types/utils/other.d.ts +32 -0
- package/package/LICENSE +26 -0
- package/package/README.md +84 -0
- package/package/externals/NOTICE +9 -0
- package/package/externals/libvorbis/@types/OggVorbisEncoder.d.ts +34 -0
- package/package/externals/libvorbis/OggVorbisEncoder.min.js +1 -0
- package/package/externals/stbvorbis_sync/@types/stbvorbis_sync.d.ts +12 -0
- package/package/externals/stbvorbis_sync/LICENSE +202 -0
- package/package/externals/stbvorbis_sync/stbvorbis_sync.min.js +1 -0
- package/package/index.js +73 -0
- package/package/midi_handler/README.md +3 -0
- package/package/midi_handler/midi_handler.js +118 -0
- package/package/midi_handler/web_midi_link.js +41 -0
- package/package/midi_parser/README.md +3 -0
- package/package/midi_parser/midi_data.js +121 -0
- package/package/midi_parser/midi_editor.js +557 -0
- package/package/midi_parser/midi_loader.js +502 -0
- package/package/midi_parser/midi_message.js +234 -0
- package/package/midi_parser/midi_writer.js +95 -0
- package/package/midi_parser/rmidi_writer.js +271 -0
- package/package/midi_parser/used_keys_loaded.js +172 -0
- package/package/package.json +43 -0
- package/package/sequencer/README.md +23 -0
- package/package/sequencer/sequencer.js +439 -0
- package/package/sequencer/worklet_sequencer/events.js +92 -0
- package/package/sequencer/worklet_sequencer/play.js +309 -0
- package/package/sequencer/worklet_sequencer/process_event.js +167 -0
- package/package/sequencer/worklet_sequencer/process_tick.js +85 -0
- package/package/sequencer/worklet_sequencer/sequencer_message.js +39 -0
- package/package/sequencer/worklet_sequencer/song_control.js +193 -0
- package/package/sequencer/worklet_sequencer/worklet_sequencer.js +218 -0
- package/package/soundfont/README.md +8 -0
- package/package/soundfont/read/generators.js +212 -0
- package/package/soundfont/read/instruments.js +125 -0
- package/package/soundfont/read/modulators.js +249 -0
- package/package/soundfont/read/presets.js +300 -0
- package/package/soundfont/read/riff_chunk.js +81 -0
- package/package/soundfont/read/samples.js +398 -0
- package/package/soundfont/read/zones.js +310 -0
- package/package/soundfont/soundfont.js +357 -0
- package/package/soundfont/write/ibag.js +39 -0
- package/package/soundfont/write/igen.js +75 -0
- package/package/soundfont/write/imod.js +46 -0
- package/package/soundfont/write/inst.js +34 -0
- package/package/soundfont/write/pbag.js +39 -0
- package/package/soundfont/write/pgen.js +77 -0
- package/package/soundfont/write/phdr.js +42 -0
- package/package/soundfont/write/pmod.js +46 -0
- package/package/soundfont/write/sdta.js +72 -0
- package/package/soundfont/write/shdr.js +54 -0
- package/package/soundfont/write/soundfont_trimmer.js +169 -0
- package/package/soundfont/write/write.js +180 -0
- package/package/synthetizer/README.md +6 -0
- package/package/synthetizer/audio_effects/effects_config.js +21 -0
- package/package/synthetizer/audio_effects/fancy_chorus.js +120 -0
- package/package/synthetizer/audio_effects/impulse_response_2.flac +0 -0
- package/package/synthetizer/audio_effects/reverb.js +24 -0
- package/package/synthetizer/synth_event_handler.js +156 -0
- package/package/synthetizer/synthetizer.js +766 -0
- package/package/synthetizer/worklet_processor.min.js +13 -0
- package/package/synthetizer/worklet_system/README.md +6 -0
- package/package/synthetizer/worklet_system/main_processor.js +363 -0
- package/package/synthetizer/worklet_system/message_protocol/handle_message.js +197 -0
- package/package/synthetizer/worklet_system/message_protocol/message_sending.js +74 -0
- package/package/synthetizer/worklet_system/message_protocol/worklet_message.js +121 -0
- package/package/synthetizer/worklet_system/minify_processor.sh +4 -0
- package/package/synthetizer/worklet_system/worklet_methods/controller_control.js +230 -0
- package/package/synthetizer/worklet_system/worklet_methods/data_entry.js +277 -0
- package/package/synthetizer/worklet_system/worklet_methods/note_off.js +109 -0
- package/package/synthetizer/worklet_system/worklet_methods/note_on.js +91 -0
- package/package/synthetizer/worklet_system/worklet_methods/program_control.js +183 -0
- package/package/synthetizer/worklet_system/worklet_methods/reset_controllers.js +177 -0
- package/package/synthetizer/worklet_system/worklet_methods/snapshot.js +129 -0
- package/package/synthetizer/worklet_system/worklet_methods/system_exclusive.js +272 -0
- package/package/synthetizer/worklet_system/worklet_methods/tuning_control.js +195 -0
- package/package/synthetizer/worklet_system/worklet_methods/vibrato_control.js +29 -0
- package/package/synthetizer/worklet_system/worklet_methods/voice_control.js +233 -0
- package/package/synthetizer/worklet_system/worklet_processor.js +9 -0
- package/package/synthetizer/worklet_system/worklet_utilities/lfo.js +23 -0
- package/package/synthetizer/worklet_system/worklet_utilities/lowpass_filter.js +130 -0
- package/package/synthetizer/worklet_system/worklet_utilities/modulation_envelope.js +73 -0
- package/package/synthetizer/worklet_system/worklet_utilities/modulator_curves.js +86 -0
- package/package/synthetizer/worklet_system/worklet_utilities/stereo_panner.js +81 -0
- package/package/synthetizer/worklet_system/worklet_utilities/unit_converter.js +66 -0
- package/package/synthetizer/worklet_system/worklet_utilities/volume_envelope.js +265 -0
- package/package/synthetizer/worklet_system/worklet_utilities/wavetable_oscillator.js +83 -0
- package/package/synthetizer/worklet_system/worklet_utilities/worklet_modulator.js +234 -0
- package/package/synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js +116 -0
- package/package/synthetizer/worklet_system/worklet_utilities/worklet_voice.js +272 -0
- package/package/synthetizer/worklet_url.js +5 -0
- package/package/utils/README.md +4 -0
- package/package/utils/buffer_to_wav.js +101 -0
- package/package/utils/byte_functions/big_endian.js +28 -0
- package/package/utils/byte_functions/little_endian.js +74 -0
- package/package/utils/byte_functions/string.js +97 -0
- package/package/utils/byte_functions/variable_length_quantity.js +37 -0
- package/package/utils/encode_vorbis.js +30 -0
- package/package/utils/indexed_array.js +41 -0
- package/package/utils/loggin.js +79 -0
- package/package/utils/other.js +54 -0
- package/package.json +43 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/spessasynth_lib.iml" filepath="$PROJECT_DIR$/.idea/spessasynth_lib.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="WEB_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$">
|
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
+
</content>
|
|
9
|
+
<orderEntry type="inheritedJdk" />
|
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
+
</component>
|
|
12
|
+
</module>
|
package/.idea/vcs.xml
ADDED
package/copy_version.sh
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Ensure jq is installed
|
|
4
|
+
if ! command -v jq &> /dev/null
|
|
5
|
+
then
|
|
6
|
+
echo "jq command not found. Please install jq to use this script."
|
|
7
|
+
exit 1
|
|
8
|
+
fi
|
|
9
|
+
|
|
10
|
+
# Define source and destination files
|
|
11
|
+
SOURCE_FILE="../SpessaSynth/package.json"
|
|
12
|
+
DEST_FILE="package/package.json"
|
|
13
|
+
|
|
14
|
+
# Check if source file exists
|
|
15
|
+
if [ ! -f "$SOURCE_FILE" ]; then
|
|
16
|
+
echo "Source file $SOURCE_FILE does not exist."
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Check if destination file exists
|
|
21
|
+
if [ ! -f "$DEST_FILE" ]; then
|
|
22
|
+
echo "Destination file $DEST_FILE does not exist."
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Extract the version from source/package.json
|
|
27
|
+
VERSION=$(jq -r '.version' "$SOURCE_FILE")
|
|
28
|
+
|
|
29
|
+
# Check if version was extracted successfully
|
|
30
|
+
if [ "$VERSION" == "null" ]; then
|
|
31
|
+
echo "Version field not found in $SOURCE_FILE."
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Update the version field in destination/package.json
|
|
36
|
+
jq --arg ver "$VERSION" '.version = $ver' "$DEST_FILE" > temp.json && mv temp.json "$DEST_FILE"
|
|
37
|
+
|
|
38
|
+
echo "Version updated successfully in $DEST_FILE."
|
package/index.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Import modules
|
|
2
|
+
import { SoundFont2 } from './soundfont/soundfont.js';
|
|
3
|
+
import { MIDI } from './midi_parser/midi_loader.js';
|
|
4
|
+
import { Synthetizer, VOICE_CAP, DEFAULT_PERCUSSION } from './synthetizer/synthetizer.js';
|
|
5
|
+
import { Sequencer } from './sequencer/sequencer.js';
|
|
6
|
+
import { IndexedByteArray } from './utils/indexed_array.js';
|
|
7
|
+
import { writeMIDIFile } from './midi_parser/midi_writer.js';
|
|
8
|
+
import { writeRMIDI } from './midi_parser/rmidi_writer.js'
|
|
9
|
+
import { applySnapshotToMIDI, modifyMIDI } from './midi_parser/midi_editor.js';
|
|
10
|
+
import { audioBufferToWav } from './utils/buffer_to_wav.js';
|
|
11
|
+
import {
|
|
12
|
+
SpessaSynthInfo,
|
|
13
|
+
SpessaSynthWarn,
|
|
14
|
+
SpessaSynthGroupCollapsed,
|
|
15
|
+
SpessaSynthGroupEnd,
|
|
16
|
+
SpessaSynthTable,
|
|
17
|
+
SpessaSynthLogging,
|
|
18
|
+
SpessaSynthGroup
|
|
19
|
+
} from './utils/loggin.js';
|
|
20
|
+
import { midiControllers, messageTypes } from './midi_parser/midi_message.js';
|
|
21
|
+
import { MIDIDeviceHandler } from './midi_handler/midi_handler.js';
|
|
22
|
+
import { WebMidiLinkHandler } from './midi_handler/web_midi_link.js';
|
|
23
|
+
import { formatTime, formatTitle, consoleColors, arrayToHexString } from './utils/other.js';
|
|
24
|
+
import { readBytesAsUintBigEndian } from './utils/byte_functions/big_endian.js';
|
|
25
|
+
import { NON_CC_INDEX_OFFSET } from './synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js';
|
|
26
|
+
import { modulatorSources } from './soundfont/read/modulators.js';
|
|
27
|
+
import { ALL_CHANNELS_OR_DIFFERENT_ACTION } from './synthetizer/worklet_system/message_protocol/worklet_message.js';
|
|
28
|
+
import { trimSoundfont } from './soundfont/write/soundfont_trimmer.js';
|
|
29
|
+
import { WORKLET_URL_ABSOLUTE } from './synthetizer/worklet_url.js'
|
|
30
|
+
|
|
31
|
+
// Export modules
|
|
32
|
+
export {
|
|
33
|
+
// Synthesizer and Sequencer
|
|
34
|
+
Sequencer,
|
|
35
|
+
Synthetizer,
|
|
36
|
+
DEFAULT_PERCUSSION,
|
|
37
|
+
VOICE_CAP,
|
|
38
|
+
|
|
39
|
+
// SoundFont
|
|
40
|
+
SoundFont2,
|
|
41
|
+
trimSoundfont,
|
|
42
|
+
modulatorSources,
|
|
43
|
+
|
|
44
|
+
// MIDI
|
|
45
|
+
MIDI,
|
|
46
|
+
IndexedByteArray,
|
|
47
|
+
writeMIDIFile,
|
|
48
|
+
writeRMIDI,
|
|
49
|
+
applySnapshotToMIDI,
|
|
50
|
+
modifyMIDI,
|
|
51
|
+
|
|
52
|
+
// Utilities
|
|
53
|
+
audioBufferToWav,
|
|
54
|
+
SpessaSynthLogging,
|
|
55
|
+
SpessaSynthGroup,
|
|
56
|
+
SpessaSynthTable,
|
|
57
|
+
SpessaSynthGroupEnd,
|
|
58
|
+
SpessaSynthInfo,
|
|
59
|
+
SpessaSynthWarn,
|
|
60
|
+
SpessaSynthGroupCollapsed,
|
|
61
|
+
midiControllers,
|
|
62
|
+
messageTypes,
|
|
63
|
+
MIDIDeviceHandler,
|
|
64
|
+
WebMidiLinkHandler,
|
|
65
|
+
arrayToHexString,
|
|
66
|
+
consoleColors,
|
|
67
|
+
formatTitle,
|
|
68
|
+
formatTime,
|
|
69
|
+
readBytesAsUintBigEndian,
|
|
70
|
+
NON_CC_INDEX_OFFSET,
|
|
71
|
+
ALL_CHANNELS_OR_DIFFERENT_ACTION,
|
|
72
|
+
WORKLET_URL_ABSOLUTE
|
|
73
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const stbvorbis: any;
|
|
@@ -0,0 +1,34 @@
|
|
|
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 { SoundFont2 } from './soundfont/soundfont.js';
|
|
6
|
+
import { trimSoundfont } from './soundfont/write/soundfont_trimmer.js';
|
|
7
|
+
import { modulatorSources } from './soundfont/read/modulators.js';
|
|
8
|
+
import { MIDI } from './midi_parser/midi_loader.js';
|
|
9
|
+
import { IndexedByteArray } from './utils/indexed_array.js';
|
|
10
|
+
import { writeMIDIFile } from './midi_parser/midi_writer.js';
|
|
11
|
+
import { writeRMIDI } from './midi_parser/rmidi_writer.js';
|
|
12
|
+
import { applySnapshotToMIDI } from './midi_parser/midi_editor.js';
|
|
13
|
+
import { modifyMIDI } from './midi_parser/midi_editor.js';
|
|
14
|
+
import { audioBufferToWav } from './utils/buffer_to_wav.js';
|
|
15
|
+
import { SpessaSynthLogging } from './utils/loggin.js';
|
|
16
|
+
import { SpessaSynthGroup } from './utils/loggin.js';
|
|
17
|
+
import { SpessaSynthTable } from './utils/loggin.js';
|
|
18
|
+
import { SpessaSynthGroupEnd } from './utils/loggin.js';
|
|
19
|
+
import { SpessaSynthInfo } from './utils/loggin.js';
|
|
20
|
+
import { SpessaSynthWarn } from './utils/loggin.js';
|
|
21
|
+
import { SpessaSynthGroupCollapsed } from './utils/loggin.js';
|
|
22
|
+
import { midiControllers } from './midi_parser/midi_message.js';
|
|
23
|
+
import { messageTypes } from './midi_parser/midi_message.js';
|
|
24
|
+
import { MIDIDeviceHandler } from './midi_handler/midi_handler.js';
|
|
25
|
+
import { WebMidiLinkHandler } from './midi_handler/web_midi_link.js';
|
|
26
|
+
import { arrayToHexString } from './utils/other.js';
|
|
27
|
+
import { consoleColors } from './utils/other.js';
|
|
28
|
+
import { formatTitle } from './utils/other.js';
|
|
29
|
+
import { formatTime } from './utils/other.js';
|
|
30
|
+
import { readBytesAsUintBigEndian } from './utils/byte_functions/big_endian.js';
|
|
31
|
+
import { NON_CC_INDEX_OFFSET } from './synthetizer/worklet_system/worklet_utilities/worklet_processor_channel.js';
|
|
32
|
+
import { ALL_CHANNELS_OR_DIFFERENT_ACTION } from './synthetizer/worklet_system/message_protocol/worklet_message.js';
|
|
33
|
+
import { WORKLET_URL_ABSOLUTE } from './synthetizer/worklet_url.js';
|
|
34
|
+
export { Sequencer, Synthetizer, DEFAULT_PERCUSSION, VOICE_CAP, SoundFont2, trimSoundfont, modulatorSources, MIDI, IndexedByteArray, writeMIDIFile, writeRMIDI, applySnapshotToMIDI, modifyMIDI, 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 };
|
|
@@ -0,0 +1,39 @@
|
|
|
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';
|
|
@@ -0,0 +1,12 @@
|
|
|
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';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A simplified version of the MIDI, accessible at all times from the Sequencer. use getMIDI() to get the actual sequence
|
|
3
|
+
* This class contains all properties that MIDI does, except for tracks, which is the track data.
|
|
4
|
+
*/
|
|
5
|
+
export class MidiData {
|
|
6
|
+
/**
|
|
7
|
+
* @param midi {MIDI}
|
|
8
|
+
*/
|
|
9
|
+
constructor(midi: MIDI);
|
|
10
|
+
/**
|
|
11
|
+
* The time division of the sequence
|
|
12
|
+
* @type {number}
|
|
13
|
+
*/
|
|
14
|
+
timeDivision: number;
|
|
15
|
+
/**
|
|
16
|
+
* The duration of the sequence, in seconds
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
duration: number;
|
|
20
|
+
/**
|
|
21
|
+
* The tempo changes in the sequence, ordered from last to first
|
|
22
|
+
* @type {{ticks: number, tempo: number}[]}
|
|
23
|
+
*/
|
|
24
|
+
tempoChanges: {
|
|
25
|
+
ticks: number;
|
|
26
|
+
tempo: number;
|
|
27
|
+
}[];
|
|
28
|
+
/**
|
|
29
|
+
* Contains the copyright strings
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
copyright: string;
|
|
33
|
+
/**
|
|
34
|
+
* The amount of tracks in the sequence
|
|
35
|
+
* @type {number}
|
|
36
|
+
*/
|
|
37
|
+
tracksAmount: number;
|
|
38
|
+
/**
|
|
39
|
+
* The lyrics of the sequence as binary chunks
|
|
40
|
+
* @type {Uint8Array[]}
|
|
41
|
+
*/
|
|
42
|
+
lyrics: Uint8Array[];
|
|
43
|
+
firstNoteOn: any;
|
|
44
|
+
/**
|
|
45
|
+
* The MIDI's key range
|
|
46
|
+
* @type {{min: number, max: number}}
|
|
47
|
+
*/
|
|
48
|
+
keyRange: {
|
|
49
|
+
min: number;
|
|
50
|
+
max: number;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* The last voice (note on, off, cc change etc.) event tick
|
|
54
|
+
* @type {number}
|
|
55
|
+
*/
|
|
56
|
+
lastVoiceEventTick: number;
|
|
57
|
+
/**
|
|
58
|
+
* Midi port numbers for each track
|
|
59
|
+
* @type {number[]}
|
|
60
|
+
*/
|
|
61
|
+
midiPorts: number[];
|
|
62
|
+
/**
|
|
63
|
+
* All channels that each track uses
|
|
64
|
+
* @type {Set<number>[]}
|
|
65
|
+
*/
|
|
66
|
+
usedChannelsOnTrack: Set<number>[];
|
|
67
|
+
/**
|
|
68
|
+
* The loop points (in ticks) of the sequence
|
|
69
|
+
* @type {{start: number, end: number}}
|
|
70
|
+
*/
|
|
71
|
+
loop: {
|
|
72
|
+
start: number;
|
|
73
|
+
end: number;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* The sequence's name
|
|
77
|
+
* @type {string}
|
|
78
|
+
*/
|
|
79
|
+
midiName: string;
|
|
80
|
+
/**
|
|
81
|
+
* The file name of the sequence, if provided in the MIDI class
|
|
82
|
+
* @type {string}
|
|
83
|
+
*/
|
|
84
|
+
fileName: string;
|
|
85
|
+
/**
|
|
86
|
+
* The raw, encoded MIDI name.
|
|
87
|
+
* @type {Uint8Array}
|
|
88
|
+
*/
|
|
89
|
+
rawMidiName: Uint8Array;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @type {MidiData}
|
|
94
|
+
*/
|
|
95
|
+
export const DUMMY_MIDI_DATA: MidiData;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param ticks {number}
|
|
3
|
+
* @returns {MidiMessage}
|
|
4
|
+
*/
|
|
5
|
+
export function getGsOn(ticks: number): MidiMessage;
|
|
6
|
+
/**
|
|
7
|
+
* Allows easy editing of the file
|
|
8
|
+
* @param midi {MIDI}
|
|
9
|
+
* @param desiredProgramChanges {{
|
|
10
|
+
* channel: number,
|
|
11
|
+
* program: number,
|
|
12
|
+
* bank: number,
|
|
13
|
+
* isDrum: boolean
|
|
14
|
+
* }[]} the programs to set on given channels. Note that the channel may be more than 16, function will adjust midi ports automatically
|
|
15
|
+
* @param desiredControllerChanges {{
|
|
16
|
+
* channel: number,
|
|
17
|
+
* controllerNumber: number,
|
|
18
|
+
* controllerValue: number,
|
|
19
|
+
* }[]} the controllers to set on given channels. Note that the channel may be more than 16, function will adjust midi ports automatically
|
|
20
|
+
* @param desiredChannelsToClear {number[]} the channels to remove from the sequence. Note that the channel may be more than 16, function will adjust midi ports automatically
|
|
21
|
+
* @param desiredChannelsToTranspose {{
|
|
22
|
+
* channel: number,
|
|
23
|
+
* keyShift: number
|
|
24
|
+
* }[]} the channels to transpose. if keyShift is float, rpn fine tuning will be applied as well. Note that the channel may be more than 16, function will adjust midi ports automatically
|
|
25
|
+
*/
|
|
26
|
+
export function modifyMIDI(midi: MIDI, desiredProgramChanges?: {
|
|
27
|
+
channel: number;
|
|
28
|
+
program: number;
|
|
29
|
+
bank: number;
|
|
30
|
+
isDrum: boolean;
|
|
31
|
+
}[], desiredControllerChanges?: {
|
|
32
|
+
channel: number;
|
|
33
|
+
controllerNumber: number;
|
|
34
|
+
controllerValue: number;
|
|
35
|
+
}[], desiredChannelsToClear?: number[], desiredChannelsToTranspose?: {
|
|
36
|
+
channel: number;
|
|
37
|
+
keyShift: number;
|
|
38
|
+
}[]): void;
|
|
39
|
+
/**
|
|
40
|
+
* Modifies the sequence according to the locked presets and controllers in the given snapshot
|
|
41
|
+
* @param midi {MIDI}
|
|
42
|
+
* @param snapshot {SynthesizerSnapshot}
|
|
43
|
+
*/
|
|
44
|
+
export function applySnapshotToMIDI(midi: MIDI, snapshot: SynthesizerSnapshot): void;
|
|
45
|
+
import { MidiMessage } from './midi_message.js';
|
|
@@ -0,0 +1,100 @@
|
|
|
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
|
+
export class MIDI {
|
|
6
|
+
/**
|
|
7
|
+
* Parses a given midi file
|
|
8
|
+
* @param arrayBuffer {ArrayBuffer}
|
|
9
|
+
* @param fileName {string} optional, replaces the decoded title if empty
|
|
10
|
+
*/
|
|
11
|
+
constructor(arrayBuffer: ArrayBuffer, fileName?: string);
|
|
12
|
+
/**
|
|
13
|
+
* If the RMI file has an embedded sf2 in it, it will appeear here, otherwise undefined
|
|
14
|
+
* @type {ArrayBuffer}
|
|
15
|
+
*/
|
|
16
|
+
embeddedSoundFont: ArrayBuffer;
|
|
17
|
+
/**
|
|
18
|
+
* Contains the copyright strings
|
|
19
|
+
* @type {string}
|
|
20
|
+
*/
|
|
21
|
+
copyright: string;
|
|
22
|
+
format: number;
|
|
23
|
+
tracksAmount: number;
|
|
24
|
+
timeDivision: number;
|
|
25
|
+
/**
|
|
26
|
+
* The MIDI's key range
|
|
27
|
+
* @type {{min: number, max: number}}
|
|
28
|
+
*/
|
|
29
|
+
keyRange: {
|
|
30
|
+
min: number;
|
|
31
|
+
max: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Contains the lyrics as binary chunks
|
|
35
|
+
* @type {Uint8Array[]}
|
|
36
|
+
*/
|
|
37
|
+
lyrics: Uint8Array[];
|
|
38
|
+
/**
|
|
39
|
+
* Contains all the tempo changes in the file. (Ordered from last to first)
|
|
40
|
+
* @type {{
|
|
41
|
+
* ticks: number,
|
|
42
|
+
* tempo: number
|
|
43
|
+
* }[]}
|
|
44
|
+
*/
|
|
45
|
+
tempoChanges: {
|
|
46
|
+
ticks: number;
|
|
47
|
+
tempo: number;
|
|
48
|
+
}[];
|
|
49
|
+
lastVoiceEventTick: number;
|
|
50
|
+
/**
|
|
51
|
+
* Midi port numbers for each tracks
|
|
52
|
+
* @type {number[]}
|
|
53
|
+
*/
|
|
54
|
+
midiPorts: number[];
|
|
55
|
+
/**
|
|
56
|
+
* All channels that each track uses. Note: these channels range from 0 to 15, excluding the port offsets!
|
|
57
|
+
* @type {Set<number>[]}
|
|
58
|
+
*/
|
|
59
|
+
usedChannelsOnTrack: Set<number>[];
|
|
60
|
+
/**
|
|
61
|
+
* Read all the tracks
|
|
62
|
+
* @type {MidiMessage[][]}
|
|
63
|
+
*/
|
|
64
|
+
tracks: MidiMessage[][];
|
|
65
|
+
firstNoteOn: number;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @type {{start: number, end: number}}
|
|
69
|
+
*/
|
|
70
|
+
loop: {
|
|
71
|
+
start: number;
|
|
72
|
+
end: number;
|
|
73
|
+
};
|
|
74
|
+
midiName: string;
|
|
75
|
+
rawMidiName: Uint8Array;
|
|
76
|
+
fileName: string;
|
|
77
|
+
/**
|
|
78
|
+
* The total playback time, in seconds
|
|
79
|
+
* @type {number}
|
|
80
|
+
*/
|
|
81
|
+
duration: number;
|
|
82
|
+
/**
|
|
83
|
+
* @param fileByteArray {IndexedByteArray}
|
|
84
|
+
* @returns {{type: string, size: number, data: IndexedByteArray}}
|
|
85
|
+
*/
|
|
86
|
+
readMIDIChunk(fileByteArray: IndexedByteArray): {
|
|
87
|
+
type: string;
|
|
88
|
+
size: number;
|
|
89
|
+
data: IndexedByteArray;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Coverts ticks to time in seconds
|
|
93
|
+
* @param ticks {number}
|
|
94
|
+
* @returns {number}
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private _ticksToSeconds;
|
|
98
|
+
}
|
|
99
|
+
import { MidiMessage } from './midi_message.js';
|
|
100
|
+
import { IndexedByteArray } from '../utils/indexed_array.js';
|
|
@@ -0,0 +1,154 @@
|
|
|
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 midiChannelPrefix: number;
|
|
63
|
+
export let midiPort: number;
|
|
64
|
+
export let endOfTrack: number;
|
|
65
|
+
export let setTempo: number;
|
|
66
|
+
export let smpteOffset: number;
|
|
67
|
+
export let timeSignature: number;
|
|
68
|
+
export let keySignature: number;
|
|
69
|
+
export let sequenceSpecific: number;
|
|
70
|
+
}
|
|
71
|
+
export type midiControllers = number;
|
|
72
|
+
export namespace midiControllers {
|
|
73
|
+
let bankSelect: number;
|
|
74
|
+
let modulationWheel: number;
|
|
75
|
+
let breathController: number;
|
|
76
|
+
let footController: number;
|
|
77
|
+
let portamentoTime: number;
|
|
78
|
+
let dataEntryMsb: number;
|
|
79
|
+
let mainVolume: number;
|
|
80
|
+
let balance: number;
|
|
81
|
+
let pan: number;
|
|
82
|
+
let expressionController: number;
|
|
83
|
+
let effectControl1: number;
|
|
84
|
+
let effectControl2: number;
|
|
85
|
+
let generalPurposeController1: number;
|
|
86
|
+
let generalPurposeController2: number;
|
|
87
|
+
let generalPurposeController3: number;
|
|
88
|
+
let generalPurposeController4: number;
|
|
89
|
+
let lsbForControl0BankSelect: number;
|
|
90
|
+
let lsbForControl1ModulationWheel: number;
|
|
91
|
+
let lsbForControl2BreathController: number;
|
|
92
|
+
let lsbForControl4FootController: number;
|
|
93
|
+
let lsbForControl5PortamentoTime: number;
|
|
94
|
+
let lsbForControl6DataEntry: number;
|
|
95
|
+
let lsbForControl7MainVolume: number;
|
|
96
|
+
let lsbForControl8Balance: number;
|
|
97
|
+
let lsbForControl10Pan: number;
|
|
98
|
+
let lsbForControl11ExpressionController: number;
|
|
99
|
+
let lsbForControl12EffectControl1: number;
|
|
100
|
+
let lsbForControl13EffectControl2: number;
|
|
101
|
+
let sustainPedal: number;
|
|
102
|
+
let portamentoOnOff: number;
|
|
103
|
+
let sostenutoPedal: number;
|
|
104
|
+
let softPedal: number;
|
|
105
|
+
let legatoFootswitch: number;
|
|
106
|
+
let hold2Pedal: number;
|
|
107
|
+
let soundVariation: number;
|
|
108
|
+
let timbreHarmonicContent: number;
|
|
109
|
+
let releaseTime: number;
|
|
110
|
+
let attackTime: number;
|
|
111
|
+
let brightness: number;
|
|
112
|
+
let soundController6: number;
|
|
113
|
+
let soundController7: number;
|
|
114
|
+
let soundController8: number;
|
|
115
|
+
let soundController9: number;
|
|
116
|
+
let soundController10: number;
|
|
117
|
+
let generalPurposeController5: number;
|
|
118
|
+
let generalPurposeController6: number;
|
|
119
|
+
let generalPurposeController7: number;
|
|
120
|
+
let generalPurposeController8: number;
|
|
121
|
+
let portamentoControl: number;
|
|
122
|
+
let effects1Depth: number;
|
|
123
|
+
let effects2Depth: number;
|
|
124
|
+
let effects3Depth: number;
|
|
125
|
+
let effects4Depth: number;
|
|
126
|
+
let effects5Depth: number;
|
|
127
|
+
let dataIncrement: number;
|
|
128
|
+
let dataDecrement: number;
|
|
129
|
+
let NRPNLsb: number;
|
|
130
|
+
let NRPNMsb: number;
|
|
131
|
+
let RPNLsb: number;
|
|
132
|
+
let RPNMsb: number;
|
|
133
|
+
let allSoundOff: number;
|
|
134
|
+
let resetAllControllers: number;
|
|
135
|
+
let localControlOnOff: number;
|
|
136
|
+
let allNotesOff: number;
|
|
137
|
+
let omniModeOff: number;
|
|
138
|
+
let omniModeOn: number;
|
|
139
|
+
let monoModeOn: number;
|
|
140
|
+
let polyModeOn: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* @type {{"11": number, "12": number, "13": number, "14": number, "8": number, "9": number, "10": number}}
|
|
144
|
+
*/
|
|
145
|
+
export const dataBytesAmount: {
|
|
146
|
+
"11": number;
|
|
147
|
+
"12": number;
|
|
148
|
+
"13": number;
|
|
149
|
+
"14": number;
|
|
150
|
+
"8": number;
|
|
151
|
+
"9": number;
|
|
152
|
+
"10": number;
|
|
153
|
+
};
|
|
154
|
+
import { IndexedByteArray } from "../utils/indexed_array.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param soundfontBinary {Uint8Array}
|
|
4
|
+
* @param mid {MIDI}
|
|
5
|
+
* @param soundfont {SoundFont2}
|
|
6
|
+
* @returns {IndexedByteArray}
|
|
7
|
+
*/
|
|
8
|
+
export function writeRMIDI(soundfontBinary: Uint8Array, mid: MIDI, soundfont: SoundFont2): IndexedByteArray;
|
|
9
|
+
import { IndexedByteArray } from '../utils/indexed_array.js';
|