spessasynth_lib 3.26.0 → 3.26.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/external_midi/README.md +4 -0
- package/external_midi/midi_handler.js +130 -0
- package/external_midi/web_midi_link.js +43 -0
- package/package.json +5 -2
- package/sequencer/README.md +32 -0
- package/sequencer/default_sequencer_options.js +8 -0
- package/sequencer/midi_data.js +63 -0
- package/sequencer/sequencer.js +808 -0
- package/sequencer/sequencer_message.js +53 -0
- package/synthetizer/README.md +38 -0
- package/synthetizer/audio_effects/effects_config.js +25 -0
- package/synthetizer/audio_effects/fancy_chorus.js +162 -0
- package/synthetizer/audio_effects/rb_compressed.min.js +1 -0
- package/synthetizer/audio_effects/reverb.js +35 -0
- package/synthetizer/audio_effects/reverb_as_binary.js +18 -0
- package/synthetizer/key_modifier_manager.js +113 -0
- package/synthetizer/sfman_message.js +9 -0
- package/synthetizer/synth_event_handler.js +217 -0
- package/synthetizer/synth_soundfont_manager.js +112 -0
- package/synthetizer/synthetizer.js +1033 -0
- package/synthetizer/worklet_message.js +120 -0
- package/synthetizer/worklet_processor.js +637 -0
- package/synthetizer/worklet_processor.min.js +22 -0
- package/synthetizer/worklet_processor.min.js.map +7 -0
- package/synthetizer/worklet_url.js +18 -0
- package/utils/buffer_to_wav.js +28 -0
- package/utils/fill_with_defaults.js +21 -0
- package/utils/other.js +11 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BasicMIDI, SynthesizerSnapshot } from "spessasynth_core";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The absolute path (from the spessasynth_lib folder) to the worklet module
|
|
5
|
+
* @type {string}
|
|
6
|
+
*/
|
|
7
|
+
export const WORKLET_URL_ABSOLUTE = "synthetizer/worklet_processor.min.js";
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} StartRenderingDataConfig
|
|
10
|
+
* @property {BasicMIDI} parsedMIDI - the MIDI to render
|
|
11
|
+
* @property {SynthesizerSnapshot?} snapshot - the snapshot to apply
|
|
12
|
+
* @property {boolean?} oneOutput - if synth should use one output with 32 channels (2 audio channels for each midi channel).
|
|
13
|
+
* this disabled chorus and reverb.
|
|
14
|
+
* @property {number?} loopCount - the times to loop the song
|
|
15
|
+
* @property {SequencerOptions?} sequencerOptions - the options to pass to the sequencer
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export const WORKLET_PROCESSOR_NAME = "spessasynth-worklet-processor";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} WaveMetadata
|
|
3
|
+
* @property {string|undefined} title - the song's title
|
|
4
|
+
* @property {string|undefined} artist - the song's artist
|
|
5
|
+
* @property {string|undefined} album - the song's album
|
|
6
|
+
* @property {string|undefined} genre - the song's genre
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { audioToWav } from "spessasynth_core";
|
|
10
|
+
|
|
11
|
+
// noinspection JSUnusedGlobalSymbols
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param audioBuffer {AudioBuffer}
|
|
15
|
+
* @param normalizeAudio {boolean} find the max sample point and set it to 1, and scale others with it
|
|
16
|
+
* @param channelOffset {number} channel offset and channel offset + 1 get saved
|
|
17
|
+
* @param metadata {WaveMetadata}
|
|
18
|
+
* @param loop {{start: number, end: number}} loop start and end points in seconds. Undefined if no loop
|
|
19
|
+
* @returns {Blob}
|
|
20
|
+
*/
|
|
21
|
+
export function audioBufferToWav(audioBuffer, normalizeAudio = true, channelOffset = 0, metadata = {}, loop = undefined)
|
|
22
|
+
{
|
|
23
|
+
return new Blob([audioToWav({
|
|
24
|
+
leftChannel: audioBuffer.getChannelData(channelOffset),
|
|
25
|
+
rightChannel: audioBuffer.getChannelData(channelOffset + 1),
|
|
26
|
+
sampleRate: audioBuffer.sampleRate
|
|
27
|
+
}, normalizeAudio, metadata, loop)], { type: "audio/wav" });
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fills the object with default values
|
|
3
|
+
* @param obj {Object}
|
|
4
|
+
* @param defObj {Object}
|
|
5
|
+
* @returns {Object}
|
|
6
|
+
*/
|
|
7
|
+
export function fillWithDefaults(obj, defObj)
|
|
8
|
+
{
|
|
9
|
+
if (obj === undefined)
|
|
10
|
+
{
|
|
11
|
+
obj = {};
|
|
12
|
+
}
|
|
13
|
+
for (const key in defObj)
|
|
14
|
+
{
|
|
15
|
+
if (defObj.hasOwnProperty(key) && !(key in obj))
|
|
16
|
+
{
|
|
17
|
+
obj[key] = defObj[key];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return obj;
|
|
21
|
+
}
|
package/utils/other.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* other.js
|
|
3
|
+
* purpose: contains some useful functions that don't belong in any specific category
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { SpessaSynthCoreUtils } from "spessasynth_core";
|
|
7
|
+
|
|
8
|
+
const consoleColors = SpessaSynthCoreUtils.consoleColors;
|
|
9
|
+
|
|
10
|
+
export { consoleColors };
|
|
11
|
+
|