spessasynth_core 3.27.8 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +85 -51
  2. package/dist/index.d.ts +4057 -0
  3. package/dist/index.js +17188 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +23 -6
  6. package/index.js +0 -132
  7. package/src/externals/README.md +0 -6
  8. package/src/externals/fflate/LICENSE +0 -21
  9. package/src/externals/fflate/fflate.min.js +0 -1
  10. package/src/externals/stbvorbis_sync/@types/stbvorbis_sync.d.ts +0 -12
  11. package/src/externals/stbvorbis_sync/LICENSE +0 -202
  12. package/src/externals/stbvorbis_sync/NOTICE +0 -6
  13. package/src/externals/stbvorbis_sync/stbvorbis_sync.min.js +0 -1
  14. package/src/midi/README.md +0 -32
  15. package/src/midi/basic_midi.js +0 -587
  16. package/src/midi/midi_builder.js +0 -203
  17. package/src/midi/midi_loader.js +0 -321
  18. package/src/midi/midi_message.js +0 -254
  19. package/src/midi/midi_sequence.js +0 -230
  20. package/src/midi/midi_tools/get_note_times.js +0 -154
  21. package/src/midi/midi_tools/midi_editor.js +0 -611
  22. package/src/midi/midi_tools/midi_writer.js +0 -105
  23. package/src/midi/midi_tools/rmidi_writer.js +0 -566
  24. package/src/midi/midi_tools/used_keys_loaded.js +0 -256
  25. package/src/midi/xmf_loader.js +0 -454
  26. package/src/sequencer/README.md +0 -9
  27. package/src/sequencer/events.js +0 -81
  28. package/src/sequencer/play.js +0 -362
  29. package/src/sequencer/process_event.js +0 -165
  30. package/src/sequencer/process_tick.js +0 -104
  31. package/src/sequencer/sequencer_engine.js +0 -372
  32. package/src/sequencer/song_control.js +0 -196
  33. package/src/soundfont/README.md +0 -11
  34. package/src/soundfont/basic_soundfont/basic_global_zone.js +0 -6
  35. package/src/soundfont/basic_soundfont/basic_instrument.js +0 -115
  36. package/src/soundfont/basic_soundfont/basic_instrument_zone.js +0 -45
  37. package/src/soundfont/basic_soundfont/basic_preset.js +0 -313
  38. package/src/soundfont/basic_soundfont/basic_preset_zone.js +0 -39
  39. package/src/soundfont/basic_soundfont/basic_sample.js +0 -477
  40. package/src/soundfont/basic_soundfont/basic_soundbank.js +0 -740
  41. package/src/soundfont/basic_soundfont/basic_zone.js +0 -145
  42. package/src/soundfont/basic_soundfont/generator.js +0 -76
  43. package/src/soundfont/basic_soundfont/generator_types.js +0 -151
  44. package/src/soundfont/basic_soundfont/modulator.js +0 -581
  45. package/src/soundfont/basic_soundfont/riff_chunk.js +0 -195
  46. package/src/soundfont/basic_soundfont/write_dls/art2.js +0 -174
  47. package/src/soundfont/basic_soundfont/write_dls/articulator.js +0 -49
  48. package/src/soundfont/basic_soundfont/write_dls/combine_zones.js +0 -374
  49. package/src/soundfont/basic_soundfont/write_dls/ins.js +0 -85
  50. package/src/soundfont/basic_soundfont/write_dls/lins.js +0 -15
  51. package/src/soundfont/basic_soundfont/write_dls/modulator_converter.js +0 -330
  52. package/src/soundfont/basic_soundfont/write_dls/rgn2.js +0 -120
  53. package/src/soundfont/basic_soundfont/write_dls/wave.js +0 -71
  54. package/src/soundfont/basic_soundfont/write_dls/write_dls.js +0 -124
  55. package/src/soundfont/basic_soundfont/write_dls/wsmp.js +0 -78
  56. package/src/soundfont/basic_soundfont/write_dls/wvpl.js +0 -35
  57. package/src/soundfont/basic_soundfont/write_sf2/ibag.js +0 -60
  58. package/src/soundfont/basic_soundfont/write_sf2/igen.js +0 -91
  59. package/src/soundfont/basic_soundfont/write_sf2/imod.js +0 -62
  60. package/src/soundfont/basic_soundfont/write_sf2/inst.js +0 -42
  61. package/src/soundfont/basic_soundfont/write_sf2/pbag.js +0 -57
  62. package/src/soundfont/basic_soundfont/write_sf2/pgen.js +0 -92
  63. package/src/soundfont/basic_soundfont/write_sf2/phdr.js +0 -61
  64. package/src/soundfont/basic_soundfont/write_sf2/pmod.js +0 -62
  65. package/src/soundfont/basic_soundfont/write_sf2/sdta.js +0 -131
  66. package/src/soundfont/basic_soundfont/write_sf2/shdr.js +0 -77
  67. package/src/soundfont/basic_soundfont/write_sf2/write.js +0 -287
  68. package/src/soundfont/dls/articulator_converter.js +0 -402
  69. package/src/soundfont/dls/dls_destinations.js +0 -38
  70. package/src/soundfont/dls/dls_instrument.js +0 -20
  71. package/src/soundfont/dls/dls_preset.js +0 -43
  72. package/src/soundfont/dls/dls_sample.js +0 -238
  73. package/src/soundfont/dls/dls_soundfont.js +0 -183
  74. package/src/soundfont/dls/dls_sources.js +0 -63
  75. package/src/soundfont/dls/dls_zone.js +0 -89
  76. package/src/soundfont/dls/read_articulation.js +0 -300
  77. package/src/soundfont/dls/read_instrument.js +0 -118
  78. package/src/soundfont/dls/read_instrument_list.js +0 -17
  79. package/src/soundfont/dls/read_lart.js +0 -35
  80. package/src/soundfont/dls/read_region.js +0 -157
  81. package/src/soundfont/dls/read_samples.js +0 -154
  82. package/src/soundfont/load_soundfont.js +0 -21
  83. package/src/soundfont/read_sf2/generators.js +0 -43
  84. package/src/soundfont/read_sf2/instrument_zones.js +0 -75
  85. package/src/soundfont/read_sf2/instruments.js +0 -71
  86. package/src/soundfont/read_sf2/modulators.js +0 -25
  87. package/src/soundfont/read_sf2/preset_zones.js +0 -79
  88. package/src/soundfont/read_sf2/presets.js +0 -80
  89. package/src/soundfont/read_sf2/samples.js +0 -317
  90. package/src/soundfont/read_sf2/soundfont.js +0 -452
  91. package/src/soundfont/read_sf2/zones.js +0 -28
  92. package/src/synthetizer/README.md +0 -7
  93. package/src/synthetizer/audio_engine/README.md +0 -9
  94. package/src/synthetizer/audio_engine/engine_components/compute_modulator.js +0 -289
  95. package/src/synthetizer/audio_engine/engine_components/controller_tables.js +0 -90
  96. package/src/synthetizer/audio_engine/engine_components/dynamic_modulator_system.js +0 -95
  97. package/src/synthetizer/audio_engine/engine_components/enums.js +0 -18
  98. package/src/synthetizer/audio_engine/engine_components/key_modifier_manager.js +0 -151
  99. package/src/synthetizer/audio_engine/engine_components/lfo.js +0 -26
  100. package/src/synthetizer/audio_engine/engine_components/lowpass_filter.js +0 -282
  101. package/src/synthetizer/audio_engine/engine_components/midi_audio_channel.js +0 -551
  102. package/src/synthetizer/audio_engine/engine_components/modulation_envelope.js +0 -181
  103. package/src/synthetizer/audio_engine/engine_components/modulator_curves.js +0 -89
  104. package/src/synthetizer/audio_engine/engine_components/soundfont_manager.js +0 -265
  105. package/src/synthetizer/audio_engine/engine_components/stereo_panner.js +0 -124
  106. package/src/synthetizer/audio_engine/engine_components/unit_converter.js +0 -73
  107. package/src/synthetizer/audio_engine/engine_components/voice.js +0 -525
  108. package/src/synthetizer/audio_engine/engine_components/volume_envelope.js +0 -402
  109. package/src/synthetizer/audio_engine/engine_components/wavetable_oscillator.js +0 -274
  110. package/src/synthetizer/audio_engine/engine_methods/controller_control/controller_change.js +0 -159
  111. package/src/synthetizer/audio_engine/engine_methods/controller_control/master_parameters.js +0 -53
  112. package/src/synthetizer/audio_engine/engine_methods/controller_control/reset_controllers.js +0 -254
  113. package/src/synthetizer/audio_engine/engine_methods/create_midi_channel.js +0 -20
  114. package/src/synthetizer/audio_engine/engine_methods/data_entry/awe32.js +0 -198
  115. package/src/synthetizer/audio_engine/engine_methods/data_entry/data_entry_coarse.js +0 -281
  116. package/src/synthetizer/audio_engine/engine_methods/data_entry/data_entry_fine.js +0 -109
  117. package/src/synthetizer/audio_engine/engine_methods/mute_channel.js +0 -17
  118. package/src/synthetizer/audio_engine/engine_methods/note_on.js +0 -220
  119. package/src/synthetizer/audio_engine/engine_methods/portamento_time.js +0 -92
  120. package/src/synthetizer/audio_engine/engine_methods/program_change.js +0 -35
  121. package/src/synthetizer/audio_engine/engine_methods/render_voice.js +0 -214
  122. package/src/synthetizer/audio_engine/engine_methods/soundfont_management/embedded_sound_bank.js +0 -42
  123. package/src/synthetizer/audio_engine/engine_methods/soundfont_management/get_preset.js +0 -0
  124. package/src/synthetizer/audio_engine/engine_methods/soundfont_management/update_preset_list.js +0 -19
  125. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/kill_note.js +0 -23
  126. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/note_off.js +0 -56
  127. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/stop_all_channels.js +0 -16
  128. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/stop_all_notes.js +0 -30
  129. package/src/synthetizer/audio_engine/engine_methods/stopping_notes/voice_killing.js +0 -63
  130. package/src/synthetizer/audio_engine/engine_methods/system_exclusive.js +0 -1058
  131. package/src/synthetizer/audio_engine/engine_methods/tuning_control/channel_pressure.js +0 -23
  132. package/src/synthetizer/audio_engine/engine_methods/tuning_control/pitch_wheel.js +0 -31
  133. package/src/synthetizer/audio_engine/engine_methods/tuning_control/poly_pressure.js +0 -29
  134. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_master_tuning.js +0 -15
  135. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_modulation_depth.js +0 -26
  136. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_octave_tuning.js +0 -19
  137. package/src/synthetizer/audio_engine/engine_methods/tuning_control/set_tuning.js +0 -27
  138. package/src/synthetizer/audio_engine/engine_methods/tuning_control/transpose_all_channels.js +0 -15
  139. package/src/synthetizer/audio_engine/engine_methods/tuning_control/transpose_channel.js +0 -34
  140. package/src/synthetizer/audio_engine/main_processor.js +0 -817
  141. package/src/synthetizer/audio_engine/snapshot/apply_synthesizer_snapshot.js +0 -16
  142. package/src/synthetizer/audio_engine/snapshot/channel_snapshot.js +0 -175
  143. package/src/synthetizer/audio_engine/snapshot/synthesizer_snapshot.js +0 -116
  144. package/src/synthetizer/audio_engine/synth_processor_options.js +0 -18
  145. package/src/synthetizer/synth_constants.js +0 -26
  146. package/src/utils/README.md +0 -8
  147. package/src/utils/buffer_to_wav.js +0 -197
  148. package/src/utils/byte_functions/big_endian.js +0 -32
  149. package/src/utils/byte_functions/little_endian.js +0 -77
  150. package/src/utils/byte_functions/string.js +0 -92
  151. package/src/utils/byte_functions/variable_length_quantity.js +0 -42
  152. package/src/utils/fill_with_defaults.js +0 -21
  153. package/src/utils/indexed_array.js +0 -34
  154. package/src/utils/loggin.js +0 -71
  155. package/src/utils/other.js +0 -92
  156. package/src/utils/sysex_detector.js +0 -58
  157. package/src/utils/xg_hacks.js +0 -193
@@ -1,23 +0,0 @@
1
- import { NON_CC_INDEX_OFFSET } from "../../engine_components/controller_tables.js";
2
- import { modulatorSources } from "../../../../soundfont/basic_soundfont/modulator.js";
3
-
4
- /**
5
- * Sets the pressure of the given channel
6
- * @this {MidiAudioChannel}
7
- * @param pressure {number} the pressure of the channel
8
- */
9
- export function channelPressure(pressure)
10
- {
11
- this.midiControllers[NON_CC_INDEX_OFFSET + modulatorSources.channelPressure] = pressure << 7;
12
- this.updateChannelTuning();
13
- this.voices.forEach(v =>
14
- this.computeModulators(
15
- v,
16
- 0,
17
- modulatorSources.channelPressure
18
- ));
19
- this.synth.callEvent("channelpressure", {
20
- channel: this.channelNumber,
21
- pressure: pressure
22
- });
23
- }
@@ -1,31 +0,0 @@
1
- import { NON_CC_INDEX_OFFSET } from "../../engine_components/controller_tables.js";
2
- import { modulatorSources } from "../../../../soundfont/basic_soundfont/modulator.js";
3
-
4
- /**
5
- * Sets the pitch of the given channel
6
- * @this {MidiAudioChannel}
7
- * @param MSB {number} SECOND byte of the MIDI pitchWheel message
8
- * @param LSB {number} FIRST byte of the MIDI pitchWheel message
9
- */
10
- export function pitchWheel(MSB, LSB)
11
- {
12
- if (this.lockedControllers[NON_CC_INDEX_OFFSET + modulatorSources.pitchWheel])
13
- {
14
- return;
15
- }
16
- const bend = (LSB | (MSB << 7));
17
- this.synth.callEvent("pitchwheel", {
18
- channel: this.channelNumber,
19
- MSB: MSB,
20
- LSB: LSB
21
- });
22
- this.midiControllers[NON_CC_INDEX_OFFSET + modulatorSources.pitchWheel] = bend;
23
- this.voices.forEach(v =>
24
- // compute pitch modulators
25
- this.computeModulators(
26
- v,
27
- 0,
28
- modulatorSources.pitchWheel
29
- ));
30
- this.sendChannelProperty();
31
- }
@@ -1,29 +0,0 @@
1
- import { modulatorSources } from "../../../../soundfont/basic_soundfont/modulator.js";
2
-
3
- /**
4
- * Sets the pressure of the given note on a specific channel
5
- * @this {MidiAudioChannel}
6
- * @param midiNote {number} 0-127
7
- * @param pressure {number} the pressure of the note
8
- */
9
- export function polyPressure(midiNote, pressure)
10
- {
11
- this.voices.forEach(v =>
12
- {
13
- if (v.midiNote !== midiNote)
14
- {
15
- return;
16
- }
17
- v.pressure = pressure;
18
- this.computeModulators(
19
- v,
20
- 0,
21
- modulatorSources.polyPressure
22
- );
23
- });
24
- this.synth.callEvent("polypressure", {
25
- channel: this.channelNumber,
26
- midiNote: midiNote,
27
- pressure: pressure
28
- });
29
- }
@@ -1,15 +0,0 @@
1
- import { customControllers } from "../../engine_components/controller_tables.js";
2
-
3
- /**
4
- * Sets the synth's primary tuning
5
- * @this {SpessaSynthProcessor}
6
- * @param cents {number}
7
- */
8
- export function setMasterTuning(cents)
9
- {
10
- cents = Math.round(cents);
11
- for (let i = 0; i < this.midiAudioChannels.length; i++)
12
- {
13
- this.midiAudioChannels[i].setCustomController(customControllers.masterTuning, cents);
14
- }
15
- }
@@ -1,26 +0,0 @@
1
- import {SpessaSynthInfo} from "../../../../utils/loggin.js";
2
- import {consoleColors} from "../../../../utils/other.js";
3
- import {customControllers} from "../../engine_components/controller_tables.js";
4
-
5
- /**
6
- * @this {MidiAudioChannel}
7
- * @param cents {number}
8
- */
9
- export function setModulationDepth(cents) {
10
- cents = Math.round(cents);
11
- SpessaSynthInfo(
12
- `%cChannel ${this.channelNumber} modulation depth. Cents: %c${cents}`,
13
- consoleColors.info,
14
- consoleColors.value
15
- );
16
- /* ==============
17
- Important
18
- here we convert cents into a multiplier.
19
- midi spec assumes the default is 50 cents,
20
- but it might be different for the soundfont,
21
- so we create a multiplier by dividing cents by 50.
22
- for example, if we want 100 cents, then multiplier will be 2,
23
- which for a preset with depth of 50 will create 100.
24
- ================ */
25
- this.setCustomController(customControllers.modulationMultiplier, cents / 50);
26
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Sets the octave tuning for a given channel
3
- * @this {MidiAudioChannel}
4
- * @param tuning {Int8Array} LENGTH of 12!
5
- * relative cent tuning.
6
- * min -128 max 127.
7
- */
8
- export function setOctaveTuning(tuning)
9
- {
10
- if (tuning.length !== 12)
11
- {
12
- throw new Error("Tuning is not the length of 12.");
13
- }
14
- this.channelOctaveTuning = new Int8Array(128);
15
- for (let i = 0; i < 128; i++)
16
- {
17
- this.channelOctaveTuning[i] = tuning[i % 12];
18
- }
19
- }
@@ -1,27 +0,0 @@
1
- import { customControllers } from "../../engine_components/controller_tables.js";
2
- import { SpessaSynthInfo } from "../../../../utils/loggin.js";
3
- import { consoleColors } from "../../../../utils/other.js";
4
-
5
- /**
6
- * Sets the channel's tuning
7
- * @this {MidiAudioChannel}
8
- * @param cents {number}
9
- * @param log {boolean}
10
- */
11
- export function setTuning(cents, log = true)
12
- {
13
- cents = Math.round(cents);
14
- this.setCustomController(customControllers.channelTuning, cents);
15
- if (!log)
16
- {
17
- return;
18
- }
19
- SpessaSynthInfo(
20
- `%cFine tuning for %c${this.channelNumber}%c is now set to %c${cents}%c cents.`,
21
- consoleColors.info,
22
- consoleColors.recognized,
23
- consoleColors.info,
24
- consoleColors.value,
25
- consoleColors.info
26
- );
27
- }
@@ -1,15 +0,0 @@
1
- /**
2
- * Transposes all channels by given amount of semitones
3
- * @this {SpessaSynthProcessor}
4
- * @param semitones {number} Can be float
5
- * @param force {boolean} defaults to false, if true transposes the channel even if it's a drum channel
6
- */
7
- export function transposeAllChannels(semitones, force = false)
8
- {
9
- this.transposition = 0;
10
- for (let i = 0; i < this.midiAudioChannels.length; i++)
11
- {
12
- this.midiAudioChannels[i].transposeChannel(semitones, force);
13
- }
14
- this.transposition = semitones;
15
- }
@@ -1,34 +0,0 @@
1
- import { customControllers } from "../../engine_components/controller_tables.js";
2
- import { midiControllers } from "../../../../midi/midi_message.js";
3
-
4
- /**
5
- * Transposes the channel by given amount of semitones
6
- * @this {MidiAudioChannel}
7
- * @param semitones {number} Can be float
8
- * @param force {boolean} defaults to false, if true transposes the channel even if it's a drum channel
9
- */
10
- export function transposeChannel(semitones, force = false)
11
- {
12
- if (!this.drumChannel)
13
- {
14
- semitones += this.synth.transposition;
15
- }
16
- const keyShift = Math.trunc(semitones);
17
- const currentTranspose = this.channelTransposeKeyShift + this.customControllers[customControllers.channelTransposeFine] / 100;
18
- if (
19
- (this.drumChannel && !force)
20
- || semitones === currentTranspose
21
- )
22
- {
23
- return;
24
- }
25
- if (keyShift !== this.channelTransposeKeyShift)
26
- {
27
- // stop all (and emit cc change)
28
- this.controllerChange(midiControllers.allNotesOff, 127);
29
- }
30
- // apply transpose
31
- this.channelTransposeKeyShift = keyShift;
32
- this.setCustomController(customControllers.channelTransposeFine, (semitones - keyShift) * 100);
33
- this.sendChannelProperty();
34
- }