libadlmidi-js 1.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.
- package/LICENSE +165 -0
- package/README.md +126 -0
- package/dist/core.d.ts +276 -0
- package/dist/fm_banks/ail/MonopolyDeluxe.wopl +0 -0
- package/dist/fm_banks/ail/master_of_magic.wopl +0 -0
- package/dist/fm_banks/manifest.json +60 -0
- package/dist/fm_banks/wopl/Apogee-IMF-90.wopl +0 -0
- package/dist/fm_banks/wopl/DMXOPL3-by-sneakernets-GS.wopl +0 -0
- package/dist/fm_banks/wopl/GM-By-J.A.Nguyen-and-Wohlstand.wopl +0 -0
- package/dist/fm_banks/wopl/Wohlstand's-modded-FatMan.wopl +0 -0
- package/dist/fm_banks/wopl/fatman-2op.wopl +0 -0
- package/dist/fm_banks/wopl/fatman-4op.wopl +0 -0
- package/dist/fm_banks/wopl/msadlib.wopl +0 -0
- package/dist/libadlmidi.d.ts +453 -0
- package/dist/libadlmidi.dosbox.browser.js +2 -0
- package/dist/libadlmidi.dosbox.browser.wasm +0 -0
- package/dist/libadlmidi.dosbox.core.js +2 -0
- package/dist/libadlmidi.dosbox.core.wasm +0 -0
- package/dist/libadlmidi.dosbox.js +0 -0
- package/dist/libadlmidi.dosbox.processor.js +3226 -0
- package/dist/libadlmidi.dosbox.slim.browser.js +2 -0
- package/dist/libadlmidi.dosbox.slim.browser.wasm +0 -0
- package/dist/libadlmidi.dosbox.slim.core.js +2 -0
- package/dist/libadlmidi.dosbox.slim.core.wasm +0 -0
- package/dist/libadlmidi.dosbox.slim.js +0 -0
- package/dist/libadlmidi.dosbox.slim.processor.js +3226 -0
- package/dist/libadlmidi.full.browser.js +2 -0
- package/dist/libadlmidi.full.browser.wasm +0 -0
- package/dist/libadlmidi.full.core.js +2 -0
- package/dist/libadlmidi.full.core.wasm +0 -0
- package/dist/libadlmidi.full.js +0 -0
- package/dist/libadlmidi.full.processor.js +3226 -0
- package/dist/libadlmidi.full.slim.browser.js +2 -0
- package/dist/libadlmidi.full.slim.browser.wasm +0 -0
- package/dist/libadlmidi.full.slim.core.js +2 -0
- package/dist/libadlmidi.full.slim.core.wasm +0 -0
- package/dist/libadlmidi.full.slim.js +0 -0
- package/dist/libadlmidi.full.slim.processor.js +3226 -0
- package/dist/libadlmidi.js +445 -0
- package/dist/libadlmidi.js.map +7 -0
- package/dist/libadlmidi.light.browser.js +2 -0
- package/dist/libadlmidi.light.browser.wasm +0 -0
- package/dist/libadlmidi.light.core.js +2 -0
- package/dist/libadlmidi.light.core.wasm +0 -0
- package/dist/libadlmidi.light.js +0 -0
- package/dist/libadlmidi.light.processor.js +3226 -0
- package/dist/libadlmidi.light.slim.browser.js +2 -0
- package/dist/libadlmidi.light.slim.browser.wasm +0 -0
- package/dist/libadlmidi.light.slim.core.js +2 -0
- package/dist/libadlmidi.light.slim.core.wasm +0 -0
- package/dist/libadlmidi.light.slim.js +0 -0
- package/dist/libadlmidi.light.slim.processor.js +3226 -0
- package/dist/libadlmidi.nuked.browser.js +2 -0
- package/dist/libadlmidi.nuked.browser.wasm +0 -0
- package/dist/libadlmidi.nuked.core.js +2 -0
- package/dist/libadlmidi.nuked.core.wasm +0 -0
- package/dist/libadlmidi.nuked.js +0 -0
- package/dist/libadlmidi.nuked.processor.js +3226 -0
- package/dist/libadlmidi.nuked.slim.browser.js +2 -0
- package/dist/libadlmidi.nuked.slim.browser.wasm +0 -0
- package/dist/libadlmidi.nuked.slim.core.js +2 -0
- package/dist/libadlmidi.nuked.slim.core.wasm +0 -0
- package/dist/libadlmidi.nuked.slim.js +0 -0
- package/dist/libadlmidi.nuked.slim.processor.js +3226 -0
- package/dist/profiles/dosbox.d.ts +49 -0
- package/dist/profiles/dosbox.slim.d.ts +49 -0
- package/dist/profiles/full.d.ts +49 -0
- package/dist/profiles/full.slim.d.ts +49 -0
- package/dist/profiles/light.d.ts +49 -0
- package/dist/profiles/light.slim.d.ts +49 -0
- package/dist/profiles/nuked.d.ts +49 -0
- package/dist/profiles/nuked.slim.d.ts +49 -0
- package/dist/utils/struct.d.ts +209 -0
- package/package.json +103 -0
- package/src/core.js +591 -0
- package/src/libadlmidi.js +524 -0
- package/src/processor.js +517 -0
- package/src/profiles/dosbox.js +82 -0
- package/src/profiles/dosbox.slim.js +82 -0
- package/src/profiles/full.js +82 -0
- package/src/profiles/full.slim.js +82 -0
- package/src/profiles/light.js +82 -0
- package/src/profiles/light.slim.js +82 -0
- package/src/profiles/nuked.js +82 -0
- package/src/profiles/nuked.slim.js +82 -0
- package/src/utils/struct.js +288 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-config full profile for libADLMIDI-JS
|
|
3
|
+
*
|
|
4
|
+
* Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @module profiles/full
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AdlMidi as BaseAdlMidi } from '../libadlmidi.js';
|
|
11
|
+
import { AdlMidiCore as BaseAdlMidiCore } from '../core.js';
|
|
12
|
+
|
|
13
|
+
// Resolve paths relative to this module
|
|
14
|
+
const PROCESSOR_URL = new URL('../../dist/libadlmidi.full.processor.js', import.meta.url).href;
|
|
15
|
+
const WASM_URL = new URL('../../dist/libadlmidi.full.core.wasm', import.meta.url).href;
|
|
16
|
+
const CORE_PATH = new URL('../../dist/libadlmidi.full.core.js', import.meta.url).href;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pre-configured AdlMidi for full profile.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* import { AdlMidi } from 'libadlmidi-js/full';
|
|
24
|
+
*
|
|
25
|
+
* const synth = new AdlMidi();
|
|
26
|
+
* await synth.init(); // No paths needed!
|
|
27
|
+
* synth.noteOn(0, 60, 100);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class AdlMidi extends BaseAdlMidi {
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the synthesizer with this profile's WASM.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [processorUrl] - Override processor URL (optional)
|
|
35
|
+
* @param {string} [wasmUrl] - Override WASM URL (optional)
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
38
|
+
async init(processorUrl, wasmUrl) {
|
|
39
|
+
return super.init(
|
|
40
|
+
processorUrl || PROCESSOR_URL,
|
|
41
|
+
wasmUrl || WASM_URL
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pre-configured AdlMidiCore for full profile.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* import { AdlMidiCore } from 'libadlmidi-js/full/core';
|
|
52
|
+
*
|
|
53
|
+
* const synth = await AdlMidiCore.create(); // No paths needed!
|
|
54
|
+
* synth.init(44100);
|
|
55
|
+
* synth.noteOn(0, 60, 100);
|
|
56
|
+
* const samples = synth.generate(4096);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export class AdlMidiCore {
|
|
60
|
+
/**
|
|
61
|
+
* Create a new AdlMidiCore instance with this profile's WASM.
|
|
62
|
+
*
|
|
63
|
+
* @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
|
|
64
|
+
* @returns {Promise<BaseAdlMidiCore>}
|
|
65
|
+
*/
|
|
66
|
+
static async create(options = {}) {
|
|
67
|
+
return BaseAdlMidiCore.create({
|
|
68
|
+
...options,
|
|
69
|
+
corePath: options.corePath || CORE_PATH
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Re-export struct utilities for convenience
|
|
75
|
+
export {
|
|
76
|
+
encodeInstrument,
|
|
77
|
+
decodeInstrument,
|
|
78
|
+
defaultInstrument,
|
|
79
|
+
encodeOperator,
|
|
80
|
+
decodeOperator,
|
|
81
|
+
defaultOperator
|
|
82
|
+
} from '../utils/struct.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-config full (slim) profile for libADLMIDI-JS
|
|
3
|
+
*
|
|
4
|
+
* Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
|
|
5
|
+
* Slim builds require loading a WOPL bank at runtime.
|
|
6
|
+
*
|
|
7
|
+
* @module profiles/full.slim
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AdlMidi as BaseAdlMidi } from '../libadlmidi.js';
|
|
11
|
+
import { AdlMidiCore as BaseAdlMidiCore } from '../core.js';
|
|
12
|
+
|
|
13
|
+
// Resolve paths relative to this module
|
|
14
|
+
const PROCESSOR_URL = new URL('../../dist/libadlmidi.full.slim.processor.js', import.meta.url).href;
|
|
15
|
+
const WASM_URL = new URL('../../dist/libadlmidi.full.slim.core.wasm', import.meta.url).href;
|
|
16
|
+
const CORE_PATH = new URL('../../dist/libadlmidi.full.slim.core.js', import.meta.url).href;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pre-configured AdlMidi for full slim profile.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* import { AdlMidi } from 'libadlmidi-js/full.slim';
|
|
24
|
+
*
|
|
25
|
+
* const synth = new AdlMidi();
|
|
26
|
+
* await synth.init(); // No paths needed!
|
|
27
|
+
* synth.noteOn(0, 60, 100);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class AdlMidi extends BaseAdlMidi {
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the synthesizer with this profile's WASM.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [processorUrl] - Override processor URL (optional)
|
|
35
|
+
* @param {string} [wasmUrl] - Override WASM URL (optional)
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
38
|
+
async init(processorUrl, wasmUrl) {
|
|
39
|
+
return super.init(
|
|
40
|
+
processorUrl || PROCESSOR_URL,
|
|
41
|
+
wasmUrl || WASM_URL
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pre-configured AdlMidiCore for full slim profile.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* import { AdlMidiCore } from 'libadlmidi-js/full.slim/core';
|
|
52
|
+
*
|
|
53
|
+
* const synth = await AdlMidiCore.create(); // No paths needed!
|
|
54
|
+
* synth.init(44100);
|
|
55
|
+
* synth.noteOn(0, 60, 100);
|
|
56
|
+
* const samples = synth.generate(4096);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export class AdlMidiCore {
|
|
60
|
+
/**
|
|
61
|
+
* Create a new AdlMidiCore instance with this profile's WASM.
|
|
62
|
+
*
|
|
63
|
+
* @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
|
|
64
|
+
* @returns {Promise<BaseAdlMidiCore>}
|
|
65
|
+
*/
|
|
66
|
+
static async create(options = {}) {
|
|
67
|
+
return BaseAdlMidiCore.create({
|
|
68
|
+
...options,
|
|
69
|
+
corePath: options.corePath || CORE_PATH
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Re-export struct utilities for convenience
|
|
75
|
+
export {
|
|
76
|
+
encodeInstrument,
|
|
77
|
+
decodeInstrument,
|
|
78
|
+
defaultInstrument,
|
|
79
|
+
encodeOperator,
|
|
80
|
+
decodeOperator,
|
|
81
|
+
defaultOperator
|
|
82
|
+
} from '../utils/struct.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-config light profile for libADLMIDI-JS
|
|
3
|
+
*
|
|
4
|
+
* Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @module profiles/light
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AdlMidi as BaseAdlMidi } from '../libadlmidi.js';
|
|
11
|
+
import { AdlMidiCore as BaseAdlMidiCore } from '../core.js';
|
|
12
|
+
|
|
13
|
+
// Resolve paths relative to this module
|
|
14
|
+
const PROCESSOR_URL = new URL('../../dist/libadlmidi.light.processor.js', import.meta.url).href;
|
|
15
|
+
const WASM_URL = new URL('../../dist/libadlmidi.light.core.wasm', import.meta.url).href;
|
|
16
|
+
const CORE_PATH = new URL('../../dist/libadlmidi.light.core.js', import.meta.url).href;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pre-configured AdlMidi for light profile.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* import { AdlMidi } from 'libadlmidi-js/light';
|
|
24
|
+
*
|
|
25
|
+
* const synth = new AdlMidi();
|
|
26
|
+
* await synth.init(); // No paths needed!
|
|
27
|
+
* synth.noteOn(0, 60, 100);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class AdlMidi extends BaseAdlMidi {
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the synthesizer with this profile's WASM.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [processorUrl] - Override processor URL (optional)
|
|
35
|
+
* @param {string} [wasmUrl] - Override WASM URL (optional)
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
38
|
+
async init(processorUrl, wasmUrl) {
|
|
39
|
+
return super.init(
|
|
40
|
+
processorUrl || PROCESSOR_URL,
|
|
41
|
+
wasmUrl || WASM_URL
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pre-configured AdlMidiCore for light profile.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* import { AdlMidiCore } from 'libadlmidi-js/light/core';
|
|
52
|
+
*
|
|
53
|
+
* const synth = await AdlMidiCore.create(); // No paths needed!
|
|
54
|
+
* synth.init(44100);
|
|
55
|
+
* synth.noteOn(0, 60, 100);
|
|
56
|
+
* const samples = synth.generate(4096);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export class AdlMidiCore {
|
|
60
|
+
/**
|
|
61
|
+
* Create a new AdlMidiCore instance with this profile's WASM.
|
|
62
|
+
*
|
|
63
|
+
* @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
|
|
64
|
+
* @returns {Promise<BaseAdlMidiCore>}
|
|
65
|
+
*/
|
|
66
|
+
static async create(options = {}) {
|
|
67
|
+
return BaseAdlMidiCore.create({
|
|
68
|
+
...options,
|
|
69
|
+
corePath: options.corePath || CORE_PATH
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Re-export struct utilities for convenience
|
|
75
|
+
export {
|
|
76
|
+
encodeInstrument,
|
|
77
|
+
decodeInstrument,
|
|
78
|
+
defaultInstrument,
|
|
79
|
+
encodeOperator,
|
|
80
|
+
decodeOperator,
|
|
81
|
+
defaultOperator
|
|
82
|
+
} from '../utils/struct.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-config light (slim) profile for libADLMIDI-JS
|
|
3
|
+
*
|
|
4
|
+
* Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
|
|
5
|
+
* Slim builds require loading a WOPL bank at runtime.
|
|
6
|
+
*
|
|
7
|
+
* @module profiles/light.slim
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AdlMidi as BaseAdlMidi } from '../libadlmidi.js';
|
|
11
|
+
import { AdlMidiCore as BaseAdlMidiCore } from '../core.js';
|
|
12
|
+
|
|
13
|
+
// Resolve paths relative to this module
|
|
14
|
+
const PROCESSOR_URL = new URL('../../dist/libadlmidi.light.slim.processor.js', import.meta.url).href;
|
|
15
|
+
const WASM_URL = new URL('../../dist/libadlmidi.light.slim.core.wasm', import.meta.url).href;
|
|
16
|
+
const CORE_PATH = new URL('../../dist/libadlmidi.light.slim.core.js', import.meta.url).href;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pre-configured AdlMidi for light slim profile.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* import { AdlMidi } from 'libadlmidi-js/light.slim';
|
|
24
|
+
*
|
|
25
|
+
* const synth = new AdlMidi();
|
|
26
|
+
* await synth.init(); // No paths needed!
|
|
27
|
+
* synth.noteOn(0, 60, 100);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class AdlMidi extends BaseAdlMidi {
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the synthesizer with this profile's WASM.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [processorUrl] - Override processor URL (optional)
|
|
35
|
+
* @param {string} [wasmUrl] - Override WASM URL (optional)
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
38
|
+
async init(processorUrl, wasmUrl) {
|
|
39
|
+
return super.init(
|
|
40
|
+
processorUrl || PROCESSOR_URL,
|
|
41
|
+
wasmUrl || WASM_URL
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pre-configured AdlMidiCore for light slim profile.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* import { AdlMidiCore } from 'libadlmidi-js/light.slim/core';
|
|
52
|
+
*
|
|
53
|
+
* const synth = await AdlMidiCore.create(); // No paths needed!
|
|
54
|
+
* synth.init(44100);
|
|
55
|
+
* synth.noteOn(0, 60, 100);
|
|
56
|
+
* const samples = synth.generate(4096);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export class AdlMidiCore {
|
|
60
|
+
/**
|
|
61
|
+
* Create a new AdlMidiCore instance with this profile's WASM.
|
|
62
|
+
*
|
|
63
|
+
* @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
|
|
64
|
+
* @returns {Promise<BaseAdlMidiCore>}
|
|
65
|
+
*/
|
|
66
|
+
static async create(options = {}) {
|
|
67
|
+
return BaseAdlMidiCore.create({
|
|
68
|
+
...options,
|
|
69
|
+
corePath: options.corePath || CORE_PATH
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Re-export struct utilities for convenience
|
|
75
|
+
export {
|
|
76
|
+
encodeInstrument,
|
|
77
|
+
decodeInstrument,
|
|
78
|
+
defaultInstrument,
|
|
79
|
+
encodeOperator,
|
|
80
|
+
decodeOperator,
|
|
81
|
+
defaultOperator
|
|
82
|
+
} from '../utils/struct.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-config nuked profile for libADLMIDI-JS
|
|
3
|
+
*
|
|
4
|
+
* Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @module profiles/nuked
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AdlMidi as BaseAdlMidi } from '../libadlmidi.js';
|
|
11
|
+
import { AdlMidiCore as BaseAdlMidiCore } from '../core.js';
|
|
12
|
+
|
|
13
|
+
// Resolve paths relative to this module
|
|
14
|
+
const PROCESSOR_URL = new URL('../../dist/libadlmidi.nuked.processor.js', import.meta.url).href;
|
|
15
|
+
const WASM_URL = new URL('../../dist/libadlmidi.nuked.core.wasm', import.meta.url).href;
|
|
16
|
+
const CORE_PATH = new URL('../../dist/libadlmidi.nuked.core.js', import.meta.url).href;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pre-configured AdlMidi for nuked profile.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* import { AdlMidi } from 'libadlmidi-js/nuked';
|
|
24
|
+
*
|
|
25
|
+
* const synth = new AdlMidi();
|
|
26
|
+
* await synth.init(); // No paths needed!
|
|
27
|
+
* synth.noteOn(0, 60, 100);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class AdlMidi extends BaseAdlMidi {
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the synthesizer with this profile's WASM.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [processorUrl] - Override processor URL (optional)
|
|
35
|
+
* @param {string} [wasmUrl] - Override WASM URL (optional)
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
38
|
+
async init(processorUrl, wasmUrl) {
|
|
39
|
+
return super.init(
|
|
40
|
+
processorUrl || PROCESSOR_URL,
|
|
41
|
+
wasmUrl || WASM_URL
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pre-configured AdlMidiCore for nuked profile.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* import { AdlMidiCore } from 'libadlmidi-js/nuked/core';
|
|
52
|
+
*
|
|
53
|
+
* const synth = await AdlMidiCore.create(); // No paths needed!
|
|
54
|
+
* synth.init(44100);
|
|
55
|
+
* synth.noteOn(0, 60, 100);
|
|
56
|
+
* const samples = synth.generate(4096);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export class AdlMidiCore {
|
|
60
|
+
/**
|
|
61
|
+
* Create a new AdlMidiCore instance with this profile's WASM.
|
|
62
|
+
*
|
|
63
|
+
* @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
|
|
64
|
+
* @returns {Promise<BaseAdlMidiCore>}
|
|
65
|
+
*/
|
|
66
|
+
static async create(options = {}) {
|
|
67
|
+
return BaseAdlMidiCore.create({
|
|
68
|
+
...options,
|
|
69
|
+
corePath: options.corePath || CORE_PATH
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Re-export struct utilities for convenience
|
|
75
|
+
export {
|
|
76
|
+
encodeInstrument,
|
|
77
|
+
decodeInstrument,
|
|
78
|
+
defaultInstrument,
|
|
79
|
+
encodeOperator,
|
|
80
|
+
decodeOperator,
|
|
81
|
+
defaultOperator
|
|
82
|
+
} from '../utils/struct.js';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zero-config nuked (slim) profile for libADLMIDI-JS
|
|
3
|
+
*
|
|
4
|
+
* Exports pre-configured AdlMidi and AdlMidiCore with this profile's WASM.
|
|
5
|
+
* Slim builds require loading a WOPL bank at runtime.
|
|
6
|
+
*
|
|
7
|
+
* @module profiles/nuked.slim
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { AdlMidi as BaseAdlMidi } from '../libadlmidi.js';
|
|
11
|
+
import { AdlMidiCore as BaseAdlMidiCore } from '../core.js';
|
|
12
|
+
|
|
13
|
+
// Resolve paths relative to this module
|
|
14
|
+
const PROCESSOR_URL = new URL('../../dist/libadlmidi.nuked.slim.processor.js', import.meta.url).href;
|
|
15
|
+
const WASM_URL = new URL('../../dist/libadlmidi.nuked.slim.core.wasm', import.meta.url).href;
|
|
16
|
+
const CORE_PATH = new URL('../../dist/libadlmidi.nuked.slim.core.js', import.meta.url).href;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Pre-configured AdlMidi for nuked slim profile.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```javascript
|
|
23
|
+
* import { AdlMidi } from 'libadlmidi-js/nuked.slim';
|
|
24
|
+
*
|
|
25
|
+
* const synth = new AdlMidi();
|
|
26
|
+
* await synth.init(); // No paths needed!
|
|
27
|
+
* synth.noteOn(0, 60, 100);
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export class AdlMidi extends BaseAdlMidi {
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the synthesizer with this profile's WASM.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} [processorUrl] - Override processor URL (optional)
|
|
35
|
+
* @param {string} [wasmUrl] - Override WASM URL (optional)
|
|
36
|
+
* @returns {Promise<void>}
|
|
37
|
+
*/
|
|
38
|
+
async init(processorUrl, wasmUrl) {
|
|
39
|
+
return super.init(
|
|
40
|
+
processorUrl || PROCESSOR_URL,
|
|
41
|
+
wasmUrl || WASM_URL
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Pre-configured AdlMidiCore for nuked slim profile.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```javascript
|
|
51
|
+
* import { AdlMidiCore } from 'libadlmidi-js/nuked.slim/core';
|
|
52
|
+
*
|
|
53
|
+
* const synth = await AdlMidiCore.create(); // No paths needed!
|
|
54
|
+
* synth.init(44100);
|
|
55
|
+
* synth.noteOn(0, 60, 100);
|
|
56
|
+
* const samples = synth.generate(4096);
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
export class AdlMidiCore {
|
|
60
|
+
/**
|
|
61
|
+
* Create a new AdlMidiCore instance with this profile's WASM.
|
|
62
|
+
*
|
|
63
|
+
* @param {{corePath?: string}} [options] - Options (corePath is pre-configured)
|
|
64
|
+
* @returns {Promise<BaseAdlMidiCore>}
|
|
65
|
+
*/
|
|
66
|
+
static async create(options = {}) {
|
|
67
|
+
return BaseAdlMidiCore.create({
|
|
68
|
+
...options,
|
|
69
|
+
corePath: options.corePath || CORE_PATH
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Re-export struct utilities for convenience
|
|
75
|
+
export {
|
|
76
|
+
encodeInstrument,
|
|
77
|
+
decodeInstrument,
|
|
78
|
+
defaultInstrument,
|
|
79
|
+
encodeOperator,
|
|
80
|
+
decodeOperator,
|
|
81
|
+
defaultOperator
|
|
82
|
+
} from '../utils/struct.js';
|