@sudobility/music_player 0.1.0 → 0.1.2
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/CLAUDE.md +335 -0
- package/dist/core.d.ts +33 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +33 -0
- package/dist/core.js.map +1 -0
- package/dist/engine.d.ts +103 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +2 -0
- package/dist/engine.js.map +1 -0
- package/dist/mocks/index.d.ts +46 -0
- package/dist/mocks/index.d.ts.map +1 -0
- package/dist/mocks/index.js +93 -0
- package/dist/mocks/index.js.map +1 -0
- package/dist/player.d.ts +81 -0
- package/dist/player.d.ts.map +1 -0
- package/dist/player.js +209 -0
- package/dist/player.js.map +1 -0
- package/dist/rn/audio/offline-render.d.ts +29 -0
- package/dist/rn/audio/offline-render.d.ts.map +1 -0
- package/dist/rn/audio/offline-render.js +134 -0
- package/dist/rn/audio/offline-render.js.map +1 -0
- package/dist/rn/index.d.ts +50 -0
- package/dist/rn/index.d.ts.map +1 -0
- package/dist/rn/index.js +39 -0
- package/dist/rn/index.js.map +1 -0
- package/dist/rn/playback/audio-api.d.ts +93 -0
- package/dist/rn/playback/audio-api.d.ts.map +1 -0
- package/dist/rn/playback/audio-api.js +24 -0
- package/dist/rn/playback/audio-api.js.map +1 -0
- package/dist/rn/playback/expression-table.d.ts +22 -0
- package/dist/rn/playback/expression-table.d.ts.map +1 -0
- package/dist/rn/playback/expression-table.js +926 -0
- package/dist/rn/playback/expression-table.js.map +1 -0
- package/dist/rn/playback/expression.d.ts +48 -0
- package/dist/rn/playback/expression.d.ts.map +1 -0
- package/dist/rn/playback/expression.js +120 -0
- package/dist/rn/playback/expression.js.map +1 -0
- package/dist/rn/playback/gm-pack-name.d.ts +40 -0
- package/dist/rn/playback/gm-pack-name.d.ts.map +1 -0
- package/dist/rn/playback/gm-pack-name.js +61 -0
- package/dist/rn/playback/gm-pack-name.js.map +1 -0
- package/dist/rn/playback/pack-library.d.ts +44 -0
- package/dist/rn/playback/pack-library.d.ts.map +1 -0
- package/dist/rn/playback/pack-library.js +85 -0
- package/dist/rn/playback/pack-library.js.map +1 -0
- package/dist/rn/playback/pack-names.json +130 -0
- package/dist/rn/playback/sample-engine.d.ts +216 -0
- package/dist/rn/playback/sample-engine.d.ts.map +1 -0
- package/dist/rn/playback/sample-engine.js +669 -0
- package/dist/rn/playback/sample-engine.js.map +1 -0
- package/dist/rn/playback/sample-pack.d.ts +71 -0
- package/dist/rn/playback/sample-pack.d.ts.map +1 -0
- package/dist/rn/playback/sample-pack.js +112 -0
- package/dist/rn/playback/sample-pack.js.map +1 -0
- package/dist/rn/playback/sustain-loop.d.ts +24 -0
- package/dist/rn/playback/sustain-loop.d.ts.map +1 -0
- package/dist/rn/playback/sustain-loop.js +111 -0
- package/dist/rn/playback/sustain-loop.js.map +1 -0
- package/dist/rn/playback/voice-plan.d.ts +60 -0
- package/dist/rn/playback/voice-plan.d.ts.map +1 -0
- package/dist/rn/playback/voice-plan.js +38 -0
- package/dist/rn/playback/voice-plan.js.map +1 -0
- package/dist/shared/bus.d.ts +73 -0
- package/dist/shared/bus.d.ts.map +1 -0
- package/dist/shared/bus.js +83 -0
- package/dist/shared/bus.js.map +1 -0
- package/dist/shared/midi.d.ts +18 -0
- package/dist/shared/midi.d.ts.map +1 -0
- package/dist/shared/midi.js +25 -0
- package/dist/shared/midi.js.map +1 -0
- package/dist/shared/mix.d.ts +75 -0
- package/dist/shared/mix.d.ts.map +1 -0
- package/dist/shared/mix.js +115 -0
- package/dist/shared/mix.js.map +1 -0
- package/dist/shared/note-queue.d.ts +43 -0
- package/dist/shared/note-queue.d.ts.map +1 -0
- package/dist/shared/note-queue.js +54 -0
- package/dist/shared/note-queue.js.map +1 -0
- package/dist/shared/plan.d.ts +34 -0
- package/dist/shared/plan.d.ts.map +1 -0
- package/dist/shared/plan.js +134 -0
- package/dist/shared/plan.js.map +1 -0
- package/dist/shared/pump-window.d.ts +38 -0
- package/dist/shared/pump-window.d.ts.map +1 -0
- package/dist/shared/pump-window.js +13 -0
- package/dist/shared/pump-window.js.map +1 -0
- package/dist/shared/render-events.d.ts +25 -0
- package/dist/shared/render-events.d.ts.map +1 -0
- package/dist/shared/render-events.js +79 -0
- package/dist/shared/render-events.js.map +1 -0
- package/dist/shared/sounding-set.d.ts +45 -0
- package/dist/shared/sounding-set.d.ts.map +1 -0
- package/dist/shared/sounding-set.js +81 -0
- package/dist/shared/sounding-set.js.map +1 -0
- package/dist/shared/test-plan.d.ts +36 -0
- package/dist/shared/test-plan.d.ts.map +1 -0
- package/dist/shared/test-plan.js +83 -0
- package/dist/shared/test-plan.js.map +1 -0
- package/dist/singleton.d.ts +23 -0
- package/dist/singleton.d.ts.map +1 -0
- package/dist/singleton.js +26 -0
- package/dist/singleton.js.map +1 -0
- package/dist/types.d.ts +84 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/web/audio/offline-synth.d.ts +24 -0
- package/dist/web/audio/offline-synth.d.ts.map +1 -0
- package/dist/web/audio/offline-synth.js +92 -0
- package/dist/web/audio/offline-synth.js.map +1 -0
- package/dist/web/audio/soundfont-render.d.ts +31 -0
- package/dist/web/audio/soundfont-render.d.ts.map +1 -0
- package/dist/web/audio/soundfont-render.js +130 -0
- package/dist/web/audio/soundfont-render.js.map +1 -0
- package/dist/web/audio/synth-types.d.ts +24 -0
- package/dist/web/audio/synth-types.d.ts.map +1 -0
- package/dist/web/audio/synth-types.js +2 -0
- package/dist/web/audio/synth-types.js.map +1 -0
- package/dist/web/index.d.ts +40 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +59 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/playback/channel-allocator.d.ts +54 -0
- package/dist/web/playback/channel-allocator.d.ts.map +1 -0
- package/dist/web/playback/channel-allocator.js +72 -0
- package/dist/web/playback/channel-allocator.js.map +1 -0
- package/dist/web/playback/click.d.ts +9 -0
- package/dist/web/playback/click.d.ts.map +1 -0
- package/dist/web/playback/click.js +61 -0
- package/dist/web/playback/click.js.map +1 -0
- package/dist/web/playback/clock.d.ts +36 -0
- package/dist/web/playback/clock.d.ts.map +1 -0
- package/dist/web/playback/clock.js +64 -0
- package/dist/web/playback/clock.js.map +1 -0
- package/dist/web/playback/governor.d.ts +45 -0
- package/dist/web/playback/governor.d.ts.map +1 -0
- package/dist/web/playback/governor.js +33 -0
- package/dist/web/playback/governor.js.map +1 -0
- package/dist/web/playback/quiet-stub-notices.d.ts +55 -0
- package/dist/web/playback/quiet-stub-notices.d.ts.map +1 -0
- package/dist/web/playback/quiet-stub-notices.js +93 -0
- package/dist/web/playback/quiet-stub-notices.js.map +1 -0
- package/dist/web/playback/soundfont-engine.d.ts +281 -0
- package/dist/web/playback/soundfont-engine.d.ts.map +1 -0
- package/dist/web/playback/soundfont-engine.js +735 -0
- package/dist/web/playback/soundfont-engine.js.map +1 -0
- package/dist/web/playback/soundfont-loader.d.ts +30 -0
- package/dist/web/playback/soundfont-loader.d.ts.map +1 -0
- package/dist/web/playback/soundfont-loader.js +68 -0
- package/dist/web/playback/soundfont-loader.js.map +1 -0
- package/dist/web/playback/synth-host.d.ts +142 -0
- package/dist/web/playback/synth-host.d.ts.map +1 -0
- package/dist/web/playback/synth-host.js +293 -0
- package/dist/web/playback/synth-host.js.map +1 -0
- package/package.json +18 -3
- package/dist/index.d.ts +0 -14
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression-table.js","sourceRoot":"","sources":["../../../src/rn/playback/expression-table.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,kEAAkE,CAAC;AAQvG,MAAM,CAAC,MAAM,gBAAgB,GAAoC;IAChE,GAAG,EAAE;QACJ,S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AClB,UAAU,EAAE,KAAK;KACjB;IACD,KAAK,EAAE;QACN,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;KAChB;IACD,KAAK,EAAE;QACN,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,KAAK;KACjB;IACD,KAAK,EAAE;QACN,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,GAAG;QACjB,UAAU,EAAE,KAAK;KACjB;IACD,KAAK,EAAE;QACN,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;KAChB;IACD,KAAK,EAAE;QACN,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,IAAI;KAChB;IACD,KAAK,EAAE;QACN,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,KAAK;KACjB;CACD,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Velocity -> linear gain, following SF2's default velocity-to-attenuation
|
|
3
|
+
* modulator (spec §8.4.1: 960cB, concave, descending).
|
|
4
|
+
*
|
|
5
|
+
* fluidsynth's concave table is `1 + (40/96)·log10(v/127)`, and feeding that
|
|
6
|
+
* through `attenuation = 960·(1 - concave)` then `amplitude = 10^(-att/200)`
|
|
7
|
+
* reduces exactly to **(v/127)²**. Measured renders agree within the accuracy
|
|
8
|
+
* of a peak reading.
|
|
9
|
+
*
|
|
10
|
+
* This is not a refinement. The engine previously used a linear `v/127`, which
|
|
11
|
+
* at velocity 32 plays 0.252 where the truth is 0.063 — **12dB too loud**. Every
|
|
12
|
+
* soft passage was wrong, and wrong in the direction that flattens dynamics.
|
|
13
|
+
*/
|
|
14
|
+
export declare function velocityGain(velocity: number): number;
|
|
15
|
+
/**
|
|
16
|
+
* The low-pass corner for `program` at `velocity`, or null where this
|
|
17
|
+
* instrument's timbre does not track velocity (71 of the 128 do not).
|
|
18
|
+
*
|
|
19
|
+
* Interpolated in log-frequency between the probed velocities, because pitch
|
|
20
|
+
* and filter corners are perceived logarithmically — a linear interpolation
|
|
21
|
+
* between 556Hz and 4989Hz puts the midpoint an octave and a half too high.
|
|
22
|
+
*
|
|
23
|
+
* Always a *reduction*: the packs were rendered at velocity 127, which the
|
|
24
|
+
* measurements confirm is the brightest the instrument gets, so a low-pass is
|
|
25
|
+
* always the correct direction and there is never a need to brighten — which a
|
|
26
|
+
* low-pass could not do anyway.
|
|
27
|
+
*/
|
|
28
|
+
export declare function cutoffFor(program: number, velocity: number): number | null;
|
|
29
|
+
/**
|
|
30
|
+
* How long this instrument takes to fall silent after note-off.
|
|
31
|
+
*
|
|
32
|
+
* The engine used one 80ms constant for everything, which is roughly seven
|
|
33
|
+
* times too short against the measured median of 0.56s — a piano chord released
|
|
34
|
+
* at the end of a phrase was chopped rather than allowed to ring.
|
|
35
|
+
*/
|
|
36
|
+
export declare function releaseFor(program: number): number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether a note longer than the recording may be held by looping its tail.
|
|
39
|
+
*
|
|
40
|
+
* The packs are 3.13 seconds each, so anything longer — a whole note under 60bpm,
|
|
41
|
+
* a tied pad across a phrase — simply stopped sounding partway through. Looping
|
|
42
|
+
* fixes that for the 79 instruments that hold their level while the key is down.
|
|
43
|
+
* The other 49 are already decaying (piano, marimba, pizzicato), and looping
|
|
44
|
+
* their tail would sustain a note that is supposed to die away, which is a worse
|
|
45
|
+
* error than the one being fixed.
|
|
46
|
+
*/
|
|
47
|
+
export declare function sustains(program: number): boolean;
|
|
48
|
+
//# sourceMappingURL=expression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../../../src/rn/playback/expression.ts"],"names":[],"mappings":"AAyCA;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CA6B1E;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEjD"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The part of a soundfont that a recording cannot carry.
|
|
3
|
+
*
|
|
4
|
+
* The FluidR3 sample packs are recordings taken at full velocity. Playing one
|
|
5
|
+
* back at lower gain is not what a synth does with a soft note: fluidsynth also
|
|
6
|
+
* darkens it, shapes its release per instrument, and sustains it for as long as
|
|
7
|
+
* the key is held. None of that survives pre-rendering, and it is what made the
|
|
8
|
+
* RN engine sound flat next to the web one.
|
|
9
|
+
*
|
|
10
|
+
* It is recoverable, though, because it is *parameters* rather than audio.
|
|
11
|
+
* `scripts/measure-expression.mjs` recovers them by rendering all 128 programs
|
|
12
|
+
* through fluidsynth and measuring what changes; this module applies them.
|
|
13
|
+
*
|
|
14
|
+
* Measured rather than read out of the soundfont's generators, deliberately —
|
|
15
|
+
* see that script's header. Reading `initialFilterFc` gave Grand Piano a 300Hz
|
|
16
|
+
* low-pass, because FluidR3's piano preset layers two instruments and the
|
|
17
|
+
* recording is their sum. No single layer's generators describe a layered
|
|
18
|
+
* preset. The rendered sound does.
|
|
19
|
+
*/
|
|
20
|
+
import { EXPRESSION_TABLE } from './expression-table.js';
|
|
21
|
+
const EXPRESSION = EXPRESSION_TABLE;
|
|
22
|
+
/** The velocities `measure-expression.mjs` probes, descending. 127 is the reference. */
|
|
23
|
+
const PROBES = [127, 96, 64, 32, 16];
|
|
24
|
+
/**
|
|
25
|
+
* Treated as "no filter". Matches the script's own guard, and sits above
|
|
26
|
+
* anything a phone speaker reproduces anyway.
|
|
27
|
+
*/
|
|
28
|
+
const NO_FILTER_HZ = 18000;
|
|
29
|
+
/**
|
|
30
|
+
* Below this a biquad is worth building; above it, skip the node entirely.
|
|
31
|
+
* One node per voice matters when a dense passage has forty voices running.
|
|
32
|
+
*/
|
|
33
|
+
const FILTER_WORTH_IT_HZ = 16000;
|
|
34
|
+
/** Used where the probe never saw the tail reach -40dB. Longer than most, short enough not to smear a run. */
|
|
35
|
+
const DEFAULT_RELEASE_SECONDS = 0.6;
|
|
36
|
+
/**
|
|
37
|
+
* Velocity -> linear gain, following SF2's default velocity-to-attenuation
|
|
38
|
+
* modulator (spec §8.4.1: 960cB, concave, descending).
|
|
39
|
+
*
|
|
40
|
+
* fluidsynth's concave table is `1 + (40/96)·log10(v/127)`, and feeding that
|
|
41
|
+
* through `attenuation = 960·(1 - concave)` then `amplitude = 10^(-att/200)`
|
|
42
|
+
* reduces exactly to **(v/127)²**. Measured renders agree within the accuracy
|
|
43
|
+
* of a peak reading.
|
|
44
|
+
*
|
|
45
|
+
* This is not a refinement. The engine previously used a linear `v/127`, which
|
|
46
|
+
* at velocity 32 plays 0.252 where the truth is 0.063 — **12dB too loud**. Every
|
|
47
|
+
* soft passage was wrong, and wrong in the direction that flattens dynamics.
|
|
48
|
+
*/
|
|
49
|
+
export function velocityGain(velocity) {
|
|
50
|
+
const clamped = Math.min(127, Math.max(0, velocity));
|
|
51
|
+
return (clamped / 127) ** 2;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The low-pass corner for `program` at `velocity`, or null where this
|
|
55
|
+
* instrument's timbre does not track velocity (71 of the 128 do not).
|
|
56
|
+
*
|
|
57
|
+
* Interpolated in log-frequency between the probed velocities, because pitch
|
|
58
|
+
* and filter corners are perceived logarithmically — a linear interpolation
|
|
59
|
+
* between 556Hz and 4989Hz puts the midpoint an octave and a half too high.
|
|
60
|
+
*
|
|
61
|
+
* Always a *reduction*: the packs were rendered at velocity 127, which the
|
|
62
|
+
* measurements confirm is the brightest the instrument gets, so a low-pass is
|
|
63
|
+
* always the correct direction and there is never a need to brighten — which a
|
|
64
|
+
* low-pass could not do anyway.
|
|
65
|
+
*/
|
|
66
|
+
export function cutoffFor(program, velocity) {
|
|
67
|
+
const entry = EXPRESSION[String(program)];
|
|
68
|
+
if (!entry)
|
|
69
|
+
return null;
|
|
70
|
+
const at = (probe) => {
|
|
71
|
+
if (probe === 127)
|
|
72
|
+
return NO_FILTER_HZ;
|
|
73
|
+
return entry.cutoffs[String(probe)] ?? NO_FILTER_HZ;
|
|
74
|
+
};
|
|
75
|
+
const v = Math.min(127, Math.max(1, velocity));
|
|
76
|
+
let hz;
|
|
77
|
+
if (v >= 127)
|
|
78
|
+
hz = NO_FILTER_HZ;
|
|
79
|
+
else if (v <= 16)
|
|
80
|
+
hz = at(16);
|
|
81
|
+
else {
|
|
82
|
+
// PROBES descends, so walk until v sits between two of them.
|
|
83
|
+
let upper = 127;
|
|
84
|
+
let lower = 16;
|
|
85
|
+
for (let i = 0; i < PROBES.length - 1; i += 1) {
|
|
86
|
+
if (v <= PROBES[i] && v >= PROBES[i + 1]) {
|
|
87
|
+
upper = PROBES[i];
|
|
88
|
+
lower = PROBES[i + 1];
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const t = (v - lower) / (upper - lower);
|
|
93
|
+
hz = 2 ** (Math.log2(at(lower)) + t * (Math.log2(at(upper)) - Math.log2(at(lower))));
|
|
94
|
+
}
|
|
95
|
+
return hz >= FILTER_WORTH_IT_HZ ? null : hz;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* How long this instrument takes to fall silent after note-off.
|
|
99
|
+
*
|
|
100
|
+
* The engine used one 80ms constant for everything, which is roughly seven
|
|
101
|
+
* times too short against the measured median of 0.56s — a piano chord released
|
|
102
|
+
* at the end of a phrase was chopped rather than allowed to ring.
|
|
103
|
+
*/
|
|
104
|
+
export function releaseFor(program) {
|
|
105
|
+
return EXPRESSION[String(program)]?.releaseSec ?? DEFAULT_RELEASE_SECONDS;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Whether a note longer than the recording may be held by looping its tail.
|
|
109
|
+
*
|
|
110
|
+
* The packs are 3.13 seconds each, so anything longer — a whole note under 60bpm,
|
|
111
|
+
* a tied pad across a phrase — simply stopped sounding partway through. Looping
|
|
112
|
+
* fixes that for the 79 instruments that hold their level while the key is down.
|
|
113
|
+
* The other 49 are already decaying (piano, marimba, pizzicato), and looping
|
|
114
|
+
* their tail would sustain a note that is supposed to die away, which is a worse
|
|
115
|
+
* error than the one being fixed.
|
|
116
|
+
*/
|
|
117
|
+
export function sustains(program) {
|
|
118
|
+
return EXPRESSION[String(program)]?.sustains ?? false;
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=expression.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expression.js","sourceRoot":"","sources":["../../../src/rn/playback/expression.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC,wFAAwF;AACxF,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;AAErC;;;GAGG;AACH,MAAM,YAAY,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,8GAA8G;AAC9G,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,YAAY,CAAC,QAAgB;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,OAAO,GAAG,GAAG,CAAC,IAAI,CAA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,CAAC,GAAG,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;QACxC,EAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,OAAO,EAAE,IAAI,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,IAAI,uBAAuB,CAAC;AAC5E,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,OAAO,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,QAAQ,IAAI,KAAK,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GM program -> FluidR3 sample-pack name.
|
|
3
|
+
*
|
|
4
|
+
* The packs are named after the General MIDI instrument names, but not by the
|
|
5
|
+
* slug rule you would guess. Punctuation is **removed** rather than turned into
|
|
6
|
+
* a separator, which is why `Honky-tonk Piano` is `honkytonk_piano` and not
|
|
7
|
+
* `honky_tonk_piano`, and why `Lead 8 (bass + lead)` keeps a double underscore
|
|
8
|
+
* where the `+` used to be — the `+` vanishes and both spaces around it become
|
|
9
|
+
* separators.
|
|
10
|
+
*
|
|
11
|
+
* That one rule covers 127 of the 128 programs. Program 54 is the exception,
|
|
12
|
+
* and it is a real disagreement rather than a formatting one: the GM standard
|
|
13
|
+
* calls it "Voice Oohs" and this catalogue calls it "Synth Voice". Both names
|
|
14
|
+
* are in circulation for that program.
|
|
15
|
+
*
|
|
16
|
+
* `gm-pack-name.test.ts` checks all 128 against the manifest the CDN actually
|
|
17
|
+
* serves, so a wrong name here cannot ship as a silent instrument.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The pack holding a GM drum kit, named by the program that selects it.
|
|
21
|
+
*
|
|
22
|
+
* Not a slug of the kit's name, unlike the melodic packs: these are rendered by
|
|
23
|
+
* `scripts/build-percussion-packs.mjs` rather than fetched from a CDN whose
|
|
24
|
+
* naming we have to match, so the address can be the thing that actually
|
|
25
|
+
* identifies a kit. `gmKitAt` in music_lib resolves any program to the kit
|
|
26
|
+
* whose region contains it, so the caller passes a real kit program.
|
|
27
|
+
*/
|
|
28
|
+
export declare function percussionPackName(kitProgram: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Every pack the CDN serves, vendored.
|
|
31
|
+
*
|
|
32
|
+
* Exported so the "every GM program resolves to a pack that exists" sweep can
|
|
33
|
+
* live in music_lib, which owns the catalogue the mapping starts from. That
|
|
34
|
+
* check spans both packages, so it cannot sit wholly in either — and it is the
|
|
35
|
+
* one that matters: a name that misses resolves to a 404, which parses to no
|
|
36
|
+
* samples, which is an instrument that plays nothing.
|
|
37
|
+
*/
|
|
38
|
+
export declare const PACK_NAMES: readonly string[];
|
|
39
|
+
export declare function gmPackName(program: number, instrumentName: string): string;
|
|
40
|
+
//# sourceMappingURL=gm-pack-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gm-pack-name.d.ts","sourceRoot":"","sources":["../../../src/rn/playback/gm-pack-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE7D;AAeD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,MAAM,EAAoB,CAAC;AAE7D,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAO1E"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GM program -> FluidR3 sample-pack name.
|
|
3
|
+
*
|
|
4
|
+
* The packs are named after the General MIDI instrument names, but not by the
|
|
5
|
+
* slug rule you would guess. Punctuation is **removed** rather than turned into
|
|
6
|
+
* a separator, which is why `Honky-tonk Piano` is `honkytonk_piano` and not
|
|
7
|
+
* `honky_tonk_piano`, and why `Lead 8 (bass + lead)` keeps a double underscore
|
|
8
|
+
* where the `+` used to be — the `+` vanishes and both spaces around it become
|
|
9
|
+
* separators.
|
|
10
|
+
*
|
|
11
|
+
* That one rule covers 127 of the 128 programs. Program 54 is the exception,
|
|
12
|
+
* and it is a real disagreement rather than a formatting one: the GM standard
|
|
13
|
+
* calls it "Voice Oohs" and this catalogue calls it "Synth Voice". Both names
|
|
14
|
+
* are in circulation for that program.
|
|
15
|
+
*
|
|
16
|
+
* `gm-pack-name.test.ts` checks all 128 against the manifest the CDN actually
|
|
17
|
+
* serves, so a wrong name here cannot ship as a silent instrument.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The pack holding a GM drum kit, named by the program that selects it.
|
|
21
|
+
*
|
|
22
|
+
* Not a slug of the kit's name, unlike the melodic packs: these are rendered by
|
|
23
|
+
* `scripts/build-percussion-packs.mjs` rather than fetched from a CDN whose
|
|
24
|
+
* naming we have to match, so the address can be the thing that actually
|
|
25
|
+
* identifies a kit. `gmKitAt` in music_lib resolves any program to the kit
|
|
26
|
+
* whose region contains it, so the caller passes a real kit program.
|
|
27
|
+
*/
|
|
28
|
+
export function percussionPackName(kitProgram) {
|
|
29
|
+
return `percussion_${kitProgram}`;
|
|
30
|
+
}
|
|
31
|
+
/** Programs whose catalogue name is not the name the packs use. */
|
|
32
|
+
const RENAMED = {
|
|
33
|
+
54: 'voice_oohs',
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The pack name for a GM program with catalogue name `instrumentName`.
|
|
37
|
+
*
|
|
38
|
+
* Takes the name rather than looking it up, so this module stays free of
|
|
39
|
+
* music_lib's catalogue and the mapping rule can be tested on its own.
|
|
40
|
+
*/
|
|
41
|
+
import PACK_NAMES_JSON from './pack-names.json' with { type: 'json' };
|
|
42
|
+
/**
|
|
43
|
+
* Every pack the CDN serves, vendored.
|
|
44
|
+
*
|
|
45
|
+
* Exported so the "every GM program resolves to a pack that exists" sweep can
|
|
46
|
+
* live in music_lib, which owns the catalogue the mapping starts from. That
|
|
47
|
+
* check spans both packages, so it cannot sit wholly in either — and it is the
|
|
48
|
+
* one that matters: a name that misses resolves to a 404, which parses to no
|
|
49
|
+
* samples, which is an instrument that plays nothing.
|
|
50
|
+
*/
|
|
51
|
+
export const PACK_NAMES = PACK_NAMES_JSON;
|
|
52
|
+
export function gmPackName(program, instrumentName) {
|
|
53
|
+
const renamed = RENAMED[program];
|
|
54
|
+
if (renamed)
|
|
55
|
+
return renamed;
|
|
56
|
+
return instrumentName
|
|
57
|
+
.toLowerCase()
|
|
58
|
+
.replace(/[^a-z0-9 ]/g, '')
|
|
59
|
+
.replace(/ /g, '_');
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=gm-pack-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gm-pack-name.js","sourceRoot":"","sources":["../../../src/rn/playback/gm-pack-name.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,OAAO,cAAc,UAAU,EAAE,CAAC;AACpC,CAAC;AAED,mEAAmE;AACnE,MAAM,OAAO,GAA2B;IACtC,EAAE,EAAE,YAAY;CACjB,CAAC;AAEF;;;;;GAKG;AACH,OAAO,eAAe,MAAM,mBAAmB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,eAAe,CAAC;AAE7D,MAAM,UAAU,UAAU,CAAC,OAAe,EAAE,cAAsB;IAChE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,OAAO;QAAE,OAAO,OAAO,CAAC;IAC5B,OAAO,cAAc;SAClB,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;SAC1B,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { SampleChoice } from './sample-pack.js';
|
|
2
|
+
import type { RNAudioBuffer } from './audio-api.js';
|
|
3
|
+
import { base64ToBytes } from '@sudobility/music_types';
|
|
4
|
+
export type PackLibraryDeps = {
|
|
5
|
+
fetchPack: (url: string) => Promise<string>;
|
|
6
|
+
decodeAudioData: (bytes: ArrayBuffer) => Promise<RNAudioBuffer>;
|
|
7
|
+
/** Melodic packs. Defaults to the pre-rendered FluidR3 collection's own host. */
|
|
8
|
+
packBase?: string;
|
|
9
|
+
/** Drum kits. No default: these are app-hosted, since no CDN publishes usably-licensed GM percussion. */
|
|
10
|
+
percussionBase?: string;
|
|
11
|
+
};
|
|
12
|
+
export type Voicing = {
|
|
13
|
+
choice: SampleChoice;
|
|
14
|
+
buffer: RNAudioBuffer;
|
|
15
|
+
};
|
|
16
|
+
export declare class PackLibrary {
|
|
17
|
+
private readonly deps;
|
|
18
|
+
private readonly packs;
|
|
19
|
+
private readonly buffers;
|
|
20
|
+
private readonly inFlight;
|
|
21
|
+
constructor(deps: PackLibraryDeps);
|
|
22
|
+
/** True once `name` is decoded and ready to voice notes from. */
|
|
23
|
+
has(name: string): boolean;
|
|
24
|
+
/** Where a pack lives. Kits and instruments come from different places. */
|
|
25
|
+
urlFor(name: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Fetches, parses and decodes one pack, at most once.
|
|
28
|
+
*
|
|
29
|
+
* De-duplicated by name *and* in flight: a score with two violin parts, or a
|
|
30
|
+
* play racing an audition of the same instrument, must not each start their
|
|
31
|
+
* own download of the same 2.7MB.
|
|
32
|
+
*/
|
|
33
|
+
ensure(name: string): Promise<void>;
|
|
34
|
+
/** The sample and buffer that sound `midi` from `name`, or null if nothing does. */
|
|
35
|
+
voice(name: string, midi: number, isPercussion: boolean): Voicing | null;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* `data:audio/mp3;base64,...` -> bytes, without `atob` or `Buffer`.
|
|
39
|
+
*
|
|
40
|
+
* Hermes has neither reliably, and the decoder needs an ArrayBuffer regardless.
|
|
41
|
+
*/
|
|
42
|
+
export declare function dataUriToBytes(uri: string): ArrayBuffer;
|
|
43
|
+
export { base64ToBytes };
|
|
44
|
+
//# sourceMappingURL=pack-library.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-library.d.ts","sourceRoot":"","sources":["../../../src/rn/playback/pack-library.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,eAAe,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAChE,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yGAAyG;IACzG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC;AAEtE,qBAAa,WAAW;IAKV,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJjC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiD;IACzE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoC;gBAEhC,IAAI,EAAE,eAAe;IAElD,iEAAiE;IACjE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,2EAA2E;IAC3E,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAW5B;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBnC,oFAAoF;IACpF,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,GAAG,IAAI;CAUzE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAIvD;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetching, decoding and caching sample packs — shared by live playback and
|
|
3
|
+
* offline rendering, so an exported file cannot be voiced differently from what
|
|
4
|
+
* was heard.
|
|
5
|
+
*
|
|
6
|
+
* Holds the two rules that decide *which* sample sounds:
|
|
7
|
+
*
|
|
8
|
+
* - a pitched note takes the nearest sample and bends it (normally by nothing,
|
|
9
|
+
* since the FluidR3 packs cover every key);
|
|
10
|
+
* - a drum takes its exact slot or nothing, because a note number in a kit
|
|
11
|
+
* names an instrument rather than a pitch.
|
|
12
|
+
*/
|
|
13
|
+
import { exactSample, nearestSample, parseSamplePack, sampleUrlFor } from './sample-pack.js';
|
|
14
|
+
import { base64ToBytes } from '@sudobility/music_types';
|
|
15
|
+
export class PackLibrary {
|
|
16
|
+
deps;
|
|
17
|
+
packs = new Map();
|
|
18
|
+
buffers = new Map();
|
|
19
|
+
inFlight = new Map();
|
|
20
|
+
constructor(deps) {
|
|
21
|
+
this.deps = deps;
|
|
22
|
+
}
|
|
23
|
+
/** True once `name` is decoded and ready to voice notes from. */
|
|
24
|
+
has(name) {
|
|
25
|
+
return this.buffers.has(name);
|
|
26
|
+
}
|
|
27
|
+
/** Where a pack lives. Kits and instruments come from different places. */
|
|
28
|
+
urlFor(name) {
|
|
29
|
+
if (!name.startsWith('percussion_'))
|
|
30
|
+
return sampleUrlFor(name, this.deps.packBase);
|
|
31
|
+
if (!this.deps.percussionBase) {
|
|
32
|
+
throw new Error('Percussion needs `percussionBase`: drum kits are app-hosted, since no CDN publishes ' +
|
|
33
|
+
'usably-licensed GM percussion. Build them with music_io/scripts/build-percussion-packs.mjs.');
|
|
34
|
+
}
|
|
35
|
+
return sampleUrlFor(name, this.deps.percussionBase);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fetches, parses and decodes one pack, at most once.
|
|
39
|
+
*
|
|
40
|
+
* De-duplicated by name *and* in flight: a score with two violin parts, or a
|
|
41
|
+
* play racing an audition of the same instrument, must not each start their
|
|
42
|
+
* own download of the same 2.7MB.
|
|
43
|
+
*/
|
|
44
|
+
ensure(name) {
|
|
45
|
+
const existing = this.inFlight.get(name);
|
|
46
|
+
if (existing)
|
|
47
|
+
return existing;
|
|
48
|
+
const work = (async () => {
|
|
49
|
+
const pack = parseSamplePack(await this.deps.fetchPack(this.urlFor(name)));
|
|
50
|
+
const decoded = new Map();
|
|
51
|
+
for (const [midi, uri] of pack.samples) {
|
|
52
|
+
decoded.set(midi, await this.deps.decodeAudioData(dataUriToBytes(uri)));
|
|
53
|
+
}
|
|
54
|
+
this.packs.set(name, pack);
|
|
55
|
+
this.buffers.set(name, decoded);
|
|
56
|
+
})();
|
|
57
|
+
this.inFlight.set(name, work);
|
|
58
|
+
return work;
|
|
59
|
+
}
|
|
60
|
+
/** The sample and buffer that sound `midi` from `name`, or null if nothing does. */
|
|
61
|
+
voice(name, midi, isPercussion) {
|
|
62
|
+
const pack = this.packs.get(name);
|
|
63
|
+
const decoded = this.buffers.get(name);
|
|
64
|
+
if (!pack || !decoded)
|
|
65
|
+
return null;
|
|
66
|
+
const choice = isPercussion ? exactSample(pack, midi) : nearestSample(pack, midi);
|
|
67
|
+
if (!choice)
|
|
68
|
+
return null;
|
|
69
|
+
const buffer = decoded.get(choice.midi);
|
|
70
|
+
return buffer ? { choice, buffer } : null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* `data:audio/mp3;base64,...` -> bytes, without `atob` or `Buffer`.
|
|
75
|
+
*
|
|
76
|
+
* Hermes has neither reliably, and the decoder needs an ArrayBuffer regardless.
|
|
77
|
+
*/
|
|
78
|
+
export function dataUriToBytes(uri) {
|
|
79
|
+
const comma = uri.indexOf(',');
|
|
80
|
+
if (comma < 0)
|
|
81
|
+
throw new Error('Malformed data URI in sample pack.');
|
|
82
|
+
return base64ToBytes(uri.slice(comma + 1));
|
|
83
|
+
}
|
|
84
|
+
export { base64ToBytes };
|
|
85
|
+
//# sourceMappingURL=pack-library.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-library.js","sourceRoot":"","sources":["../../../src/rn/playback/pack-library.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAG7F,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAaxD,MAAM,OAAO,WAAW;IAKO;IAJZ,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IACtC,OAAO,GAAG,IAAI,GAAG,EAAsC,CAAC;IACxD,QAAQ,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE7D,YAA6B,IAAqB;QAArB,SAAI,GAAJ,IAAI,CAAiB;IAAG,CAAC;IAEtD,iEAAiE;IACjE,GAAG,CAAC,IAAY;QACd,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right_acoustic_piano",
|
|
4
|
+
"electric_grand_piano",
|
|
5
|
+
"honkytonk_piano",
|
|
6
|
+
"electric_piano_1",
|
|
7
|
+
"electric_piano_2",
|
|
8
|
+
"harpsichord",
|
|
9
|
+
"clavinet",
|
|
10
|
+
"celesta",
|
|
11
|
+
"glockenspiel",
|
|
12
|
+
"music_box",
|
|
13
|
+
"vibraphone",
|
|
14
|
+
"marimba",
|
|
15
|
+
"xylophone",
|
|
16
|
+
"tubular_bells",
|
|
17
|
+
"dulcimer",
|
|
18
|
+
"drawbar_organ",
|
|
19
|
+
"percussive_organ",
|
|
20
|
+
"rock_organ",
|
|
21
|
+
"church_organ",
|
|
22
|
+
"reed_organ",
|
|
23
|
+
"accordion",
|
|
24
|
+
"harmonica",
|
|
25
|
+
"tango_accordion",
|
|
26
|
+
"acoustic_guitar_nylon",
|
|
27
|
+
"acoustic_guitar_steel",
|
|
28
|
+
"electric_guitar_jazz",
|
|
29
|
+
"electric_guitar_clean",
|
|
30
|
+
"electric_guitar_muted",
|
|
31
|
+
"overdriven_guitar",
|
|
32
|
+
"distortion_guitar",
|
|
33
|
+
"guitar_harmonics",
|
|
34
|
+
"acoustic_bass",
|
|
35
|
+
"electric_bass_finger",
|
|
36
|
+
"electric_bass_pick",
|
|
37
|
+
"fretless_bass",
|
|
38
|
+
"slap_bass_1",
|
|
39
|
+
"slap_bass_2",
|
|
40
|
+
"synth_bass_1",
|
|
41
|
+
"synth_bass_2",
|
|
42
|
+
"violin",
|
|
43
|
+
"viola",
|
|
44
|
+
"cello",
|
|
45
|
+
"contrabass",
|
|
46
|
+
"tremolo_strings",
|
|
47
|
+
"pizzicato_strings",
|
|
48
|
+
"orchestral_harp",
|
|
49
|
+
"timpani",
|
|
50
|
+
"string_ensemble_1",
|
|
51
|
+
"string_ensemble_2",
|
|
52
|
+
"synth_strings_1",
|
|
53
|
+
"synth_strings_2",
|
|
54
|
+
"choir_aahs",
|
|
55
|
+
"voice_oohs",
|
|
56
|
+
"synth_choir",
|
|
57
|
+
"orchestra_hit",
|
|
58
|
+
"trumpet",
|
|
59
|
+
"trombone",
|
|
60
|
+
"tuba",
|
|
61
|
+
"muted_trumpet",
|
|
62
|
+
"french_horn",
|
|
63
|
+
"brass_section",
|
|
64
|
+
"synth_brass_1",
|
|
65
|
+
"synth_brass_2",
|
|
66
|
+
"soprano_sax",
|
|
67
|
+
"alto_sax",
|
|
68
|
+
"tenor_sax",
|
|
69
|
+
"baritone_sax",
|
|
70
|
+
"oboe",
|
|
71
|
+
"english_horn",
|
|
72
|
+
"bassoon",
|
|
73
|
+
"clarinet",
|
|
74
|
+
"piccolo",
|
|
75
|
+
"flute",
|
|
76
|
+
"recorder",
|
|
77
|
+
"pan_flute",
|
|
78
|
+
"blown_bottle",
|
|
79
|
+
"shakuhachi",
|
|
80
|
+
"whistle",
|
|
81
|
+
"ocarina",
|
|
82
|
+
"lead_1_square",
|
|
83
|
+
"lead_2_sawtooth",
|
|
84
|
+
"lead_3_calliope",
|
|
85
|
+
"lead_4_chiff",
|
|
86
|
+
"lead_5_charang",
|
|
87
|
+
"lead_6_voice",
|
|
88
|
+
"lead_7_fifths",
|
|
89
|
+
"lead_8_bass__lead",
|
|
90
|
+
"pad_1_new_age",
|
|
91
|
+
"pad_2_warm",
|
|
92
|
+
"pad_3_polysynth",
|
|
93
|
+
"pad_4_choir",
|
|
94
|
+
"pad_5_bowed",
|
|
95
|
+
"pad_6_metallic",
|
|
96
|
+
"pad_7_halo",
|
|
97
|
+
"pad_8_sweep",
|
|
98
|
+
"fx_1_rain",
|
|
99
|
+
"fx_2_soundtrack",
|
|
100
|
+
"fx_3_crystal",
|
|
101
|
+
"fx_4_atmosphere",
|
|
102
|
+
"fx_5_brightness",
|
|
103
|
+
"fx_6_goblins",
|
|
104
|
+
"fx_7_echoes",
|
|
105
|
+
"fx_8_scifi",
|
|
106
|
+
"sitar",
|
|
107
|
+
"banjo",
|
|
108
|
+
"shamisen",
|
|
109
|
+
"koto",
|
|
110
|
+
"kalimba",
|
|
111
|
+
"bagpipe",
|
|
112
|
+
"fiddle",
|
|
113
|
+
"shanai",
|
|
114
|
+
"tinkle_bell",
|
|
115
|
+
"agogo",
|
|
116
|
+
"steel_drums",
|
|
117
|
+
"woodblock",
|
|
118
|
+
"taiko_drum",
|
|
119
|
+
"melodic_tom",
|
|
120
|
+
"synth_drum",
|
|
121
|
+
"reverse_cymbal",
|
|
122
|
+
"guitar_fret_noise",
|
|
123
|
+
"breath_noise",
|
|
124
|
+
"seashore",
|
|
125
|
+
"bird_tweet",
|
|
126
|
+
"telephone_ring",
|
|
127
|
+
"helicopter",
|
|
128
|
+
"applause",
|
|
129
|
+
"gunshot"
|
|
130
|
+
]
|