smplr 0.24.0 → 0.25.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/README.md +167 -117
- package/dist/index.d.mts +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +487 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +480 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -74,6 +74,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
74
74
|
var index_exports = {};
|
|
75
75
|
__export(index_exports, {
|
|
76
76
|
CacheStorage: () => CacheStorage,
|
|
77
|
+
DRUM_ABUSE_PACKS: () => DRUM_ABUSE_PACKS,
|
|
78
|
+
DrumAbuse: () => DrumAbuse,
|
|
77
79
|
DrumMachine: () => DrumMachine,
|
|
78
80
|
ElectricPiano: () => ElectricPiano,
|
|
79
81
|
HttpStorage: () => HttpStorage,
|
|
@@ -95,7 +97,12 @@ __export(index_exports, {
|
|
|
95
97
|
Versilian: () => Versilian,
|
|
96
98
|
audioBufferToWav: () => audioBufferToWav,
|
|
97
99
|
audioBufferToWav16: () => audioBufferToWav16,
|
|
100
|
+
drumAbuseSampleUrl: () => drumAbuseSampleUrl,
|
|
98
101
|
drumMachineToPreset: () => drumMachineToPreset,
|
|
102
|
+
getDrumAbuseMachineNames: () => getDrumAbuseMachineNames,
|
|
103
|
+
getDrumAbuseMachinePack: () => getDrumAbuseMachinePack,
|
|
104
|
+
getDrumAbuseMachinesForPack: () => getDrumAbuseMachinesForPack,
|
|
105
|
+
getDrumAbusePackNames: () => getDrumAbusePackNames,
|
|
99
106
|
getDrumMachineNames: () => getDrumMachineNames,
|
|
100
107
|
getElectricPianoNames: () => getElectricPianoNames,
|
|
101
108
|
getMalletNames: () => getMalletNames,
|
|
@@ -1461,6 +1468,465 @@ function drumMachineToPreset(instrument) {
|
|
|
1461
1468
|
};
|
|
1462
1469
|
}
|
|
1463
1470
|
|
|
1471
|
+
// src/drum-abuse/index.ts
|
|
1472
|
+
var DEFAULT_BASE_URL = "https://smpldsnds.github.io";
|
|
1473
|
+
var MIDI_BASE = 36;
|
|
1474
|
+
var DRUM_ABUSE_PACKS = [
|
|
1475
|
+
"vol1",
|
|
1476
|
+
"vol2",
|
|
1477
|
+
"vol3",
|
|
1478
|
+
"vol4",
|
|
1479
|
+
"vol5"
|
|
1480
|
+
];
|
|
1481
|
+
var MACHINES_BY_PACK = {
|
|
1482
|
+
vol1: [
|
|
1483
|
+
"4-inthefloor-percussioncombo",
|
|
1484
|
+
"ace-tone-rhythm-ace-fr-1",
|
|
1485
|
+
"ace-tone-rhythm-ace-fr-7l",
|
|
1486
|
+
"ace-tone-rhythm-ace-fr6",
|
|
1487
|
+
"ace-tone-rhythm-king",
|
|
1488
|
+
"ace-tone-rhythm-master",
|
|
1489
|
+
"antonelli-2377",
|
|
1490
|
+
"arp-axxe",
|
|
1491
|
+
"conn-min-o-matic",
|
|
1492
|
+
"eko-compu-rhythm",
|
|
1493
|
+
"eko-ritmo-12",
|
|
1494
|
+
"eko-ritmo-20",
|
|
1495
|
+
"elgam-carousel",
|
|
1496
|
+
"emu-modular",
|
|
1497
|
+
"farfisa-pro",
|
|
1498
|
+
"farfisa-rhythm-10",
|
|
1499
|
+
"farfisa-rhythm-maker-16",
|
|
1500
|
+
"gibson-maestro-g-2",
|
|
1501
|
+
"gibson-maestro-rhythm-jester",
|
|
1502
|
+
"gibson-maestro-rhythm-king-mrk-1",
|
|
1503
|
+
"gulbransen-organ",
|
|
1504
|
+
"hammond-rhythm",
|
|
1505
|
+
"hammond-rhythm-ii",
|
|
1506
|
+
"hohner-automatic-rhythm-player",
|
|
1507
|
+
"jen-sx-1000",
|
|
1508
|
+
"kay-r-8",
|
|
1509
|
+
"keio-checkmate",
|
|
1510
|
+
"kent-k-200",
|
|
1511
|
+
"kent-rhythm-master",
|
|
1512
|
+
"korg-kr-33",
|
|
1513
|
+
"korg-krz",
|
|
1514
|
+
"korg-minipops-series",
|
|
1515
|
+
"korg-s-3",
|
|
1516
|
+
"korg-univox-micro-rhythmer-12",
|
|
1517
|
+
"korg-univox-sr-120",
|
|
1518
|
+
"korg-univox-sr-95",
|
|
1519
|
+
"luxor-passat",
|
|
1520
|
+
"moog-modular-55",
|
|
1521
|
+
"roland-arr",
|
|
1522
|
+
"roland-edp-1",
|
|
1523
|
+
"roland-sh-3a",
|
|
1524
|
+
"roland-system-100",
|
|
1525
|
+
"roland-tr-1-prototype",
|
|
1526
|
+
"roland-tr-33",
|
|
1527
|
+
"roland-tr-41-prototype",
|
|
1528
|
+
"roland-tr-66",
|
|
1529
|
+
"roland-tr-77",
|
|
1530
|
+
"seeburg-rhythm-prince",
|
|
1531
|
+
"seeburg-select-a-rhythm",
|
|
1532
|
+
"solton-disco-64",
|
|
1533
|
+
"sonor-mini-mammut-module",
|
|
1534
|
+
"video-tech-rythmic-10",
|
|
1535
|
+
"vox-percussion-king",
|
|
1536
|
+
"whippany-melo-sonic-350",
|
|
1537
|
+
"wurlitzer-swinging-rhythm",
|
|
1538
|
+
"yamaha-cs-15d",
|
|
1539
|
+
"yamaha-cs-5",
|
|
1540
|
+
"yamaha-cs-6",
|
|
1541
|
+
"yamaha-ps-1",
|
|
1542
|
+
"yamaha-ps-2",
|
|
1543
|
+
"yamaha-ps-3"
|
|
1544
|
+
],
|
|
1545
|
+
vol2: [
|
|
1546
|
+
"bontempi-hf222",
|
|
1547
|
+
"boss-dr-55",
|
|
1548
|
+
"casio-mt-18",
|
|
1549
|
+
"casio-pt-30",
|
|
1550
|
+
"casio-vl-1",
|
|
1551
|
+
"chaser-computer-drum-pr-80",
|
|
1552
|
+
"crb-rhythmboy-480",
|
|
1553
|
+
"eko-musicbox-12",
|
|
1554
|
+
"electro-harmonix-drm-15",
|
|
1555
|
+
"electro-harmonix-drm-16",
|
|
1556
|
+
"electro-harmonix-spacedrum",
|
|
1557
|
+
"elka-drumstar-80",
|
|
1558
|
+
"elka-x-1000",
|
|
1559
|
+
"emu-e-drum",
|
|
1560
|
+
"gem-drum-15",
|
|
1561
|
+
"hammond-autovari-64",
|
|
1562
|
+
"hohner-rhythm-80k",
|
|
1563
|
+
"korg-kpr-77",
|
|
1564
|
+
"korg-kr-55",
|
|
1565
|
+
"korg-kr-mini",
|
|
1566
|
+
"korg-monopoly",
|
|
1567
|
+
"korg-ms-10",
|
|
1568
|
+
"korg-trident",
|
|
1569
|
+
"linn-lm-1",
|
|
1570
|
+
"monacor-rhythmical-choice",
|
|
1571
|
+
"mti-auto-orchestra-ao-1",
|
|
1572
|
+
"multi-moog",
|
|
1573
|
+
"mxr-185",
|
|
1574
|
+
"new-england-digital-synclavier",
|
|
1575
|
+
"oberheim-dmx",
|
|
1576
|
+
"pearl-drum-x",
|
|
1577
|
+
"pollard-syndrum-178",
|
|
1578
|
+
"roland-cr-1000",
|
|
1579
|
+
"roland-cr-68",
|
|
1580
|
+
"roland-cr-78",
|
|
1581
|
+
"roland-cr-80",
|
|
1582
|
+
"roland-cr-8000",
|
|
1583
|
+
"roland-dr-55",
|
|
1584
|
+
"roland-jupiter-8",
|
|
1585
|
+
"roland-pb-300-rhythm-plus",
|
|
1586
|
+
"roland-rhy-33",
|
|
1587
|
+
"roland-rhy-55",
|
|
1588
|
+
"roland-sh-09",
|
|
1589
|
+
"roland-tr-55",
|
|
1590
|
+
"roland-tr-606",
|
|
1591
|
+
"roland-tr-808",
|
|
1592
|
+
"simmons-drum",
|
|
1593
|
+
"simmons-sds-1",
|
|
1594
|
+
"simmons-sds-5",
|
|
1595
|
+
"solton-programmer-24",
|
|
1596
|
+
"star-instruments-synare-3",
|
|
1597
|
+
"star-instruments-synare-ps-1",
|
|
1598
|
+
"visco-space-drum",
|
|
1599
|
+
"watford-electronics-rhythm-generator",
|
|
1600
|
+
"yamaha-cs-40m",
|
|
1601
|
+
"yamaha-mr-10",
|
|
1602
|
+
"yamaha-ps-55"
|
|
1603
|
+
],
|
|
1604
|
+
vol3: [
|
|
1605
|
+
"amdek-pck-100",
|
|
1606
|
+
"austin-arb-6",
|
|
1607
|
+
"bme-rattlesnake-parametric-percussion-system",
|
|
1608
|
+
"boss-dr-110",
|
|
1609
|
+
"casio-mt-100",
|
|
1610
|
+
"coron-drumsynce-ds-7",
|
|
1611
|
+
"coron-rds",
|
|
1612
|
+
"denon-crb-90",
|
|
1613
|
+
"drumfire-df-2000",
|
|
1614
|
+
"drumfire-df-500",
|
|
1615
|
+
"electro-harmonix-drm-32",
|
|
1616
|
+
"emu-drumulator",
|
|
1617
|
+
"kay-drm-1",
|
|
1618
|
+
"korg-ddm-110",
|
|
1619
|
+
"korg-ddm-220",
|
|
1620
|
+
"korg-poly-800",
|
|
1621
|
+
"linn-linndrum-lm-1-vinyl",
|
|
1622
|
+
"linn-lm-2",
|
|
1623
|
+
"mattel-electronics-synsonics-drm",
|
|
1624
|
+
"mattel-electronics-synsonics-pro",
|
|
1625
|
+
"panasonic-rd-9844",
|
|
1626
|
+
"pearl-drx-1",
|
|
1627
|
+
"roland-ddr-30",
|
|
1628
|
+
"roland-mc-202",
|
|
1629
|
+
"roland-rhy-77",
|
|
1630
|
+
"roland-tr-909",
|
|
1631
|
+
"rsf-dd-30",
|
|
1632
|
+
"sakata-dpm-48",
|
|
1633
|
+
"sequential-circuits-drumtraks",
|
|
1634
|
+
"simmons-clap-trap",
|
|
1635
|
+
"simmons-sds-200",
|
|
1636
|
+
"simmons-sds-400",
|
|
1637
|
+
"soundmaster-sm-8",
|
|
1638
|
+
"soundmaster-sr-88",
|
|
1639
|
+
"tama-ts-206",
|
|
1640
|
+
"tama-ts-305",
|
|
1641
|
+
"wersi-wm-24",
|
|
1642
|
+
"yamaha-dx7"
|
|
1643
|
+
],
|
|
1644
|
+
vol4: [
|
|
1645
|
+
"atlantex-mpc-1",
|
|
1646
|
+
"boss-hc-2",
|
|
1647
|
+
"boss-pc-2",
|
|
1648
|
+
"casio-ct-310",
|
|
1649
|
+
"casio-mt-500",
|
|
1650
|
+
"casio-mt-800",
|
|
1651
|
+
"casio-pt-68",
|
|
1652
|
+
"casio-pt-82",
|
|
1653
|
+
"casio-sk-1",
|
|
1654
|
+
"dr-b-hm-digital-drums",
|
|
1655
|
+
"emu-sp-12",
|
|
1656
|
+
"ensoniq-mirage",
|
|
1657
|
+
"hing-hon-ek-001",
|
|
1658
|
+
"kawai-acr-20",
|
|
1659
|
+
"kawai-sx-240",
|
|
1660
|
+
"klone-dual-percussion-synthesiser",
|
|
1661
|
+
"korg-ddd-1",
|
|
1662
|
+
"korg-pss-50",
|
|
1663
|
+
"kurzweil-electrodrum-prototype",
|
|
1664
|
+
"linn-9000",
|
|
1665
|
+
"linn-linndrum-lm-2-vinyl",
|
|
1666
|
+
"nasta-hitstix-2",
|
|
1667
|
+
"oberheim-dx",
|
|
1668
|
+
"pearl-sc-40",
|
|
1669
|
+
"rhodes-polaris",
|
|
1670
|
+
"roland-juno-106",
|
|
1671
|
+
"roland-super-quartet-mks-7",
|
|
1672
|
+
"roland-tr-707",
|
|
1673
|
+
"roland-tr-727",
|
|
1674
|
+
"siel-mdp-40",
|
|
1675
|
+
"simmons-sds-1000",
|
|
1676
|
+
"simmons-sds-7",
|
|
1677
|
+
"simmons-sds-8",
|
|
1678
|
+
"simmons-sds-9",
|
|
1679
|
+
"sony-drp-1",
|
|
1680
|
+
"soundmaster-stix-st-305",
|
|
1681
|
+
"suzuki-rpm-40",
|
|
1682
|
+
"tama-ts-500",
|
|
1683
|
+
"technics-ax-5",
|
|
1684
|
+
"technics-pcm-dp-50",
|
|
1685
|
+
"wersi-prisma-dx-5",
|
|
1686
|
+
"yamaha-dd-5",
|
|
1687
|
+
"yamaha-rx-11",
|
|
1688
|
+
"yamaha-rx-15",
|
|
1689
|
+
"yamaha-rx-21",
|
|
1690
|
+
"yamaha-rx-5"
|
|
1691
|
+
],
|
|
1692
|
+
vol5: [
|
|
1693
|
+
"boss-dr-pad-drp-i",
|
|
1694
|
+
"casio-ct-403",
|
|
1695
|
+
"casio-cz-230s",
|
|
1696
|
+
"casio-ht-700",
|
|
1697
|
+
"casio-rz-1",
|
|
1698
|
+
"cheetah-spec-drum",
|
|
1699
|
+
"forat-f-9000",
|
|
1700
|
+
"korg-ddd-5",
|
|
1701
|
+
"korg-dss-1",
|
|
1702
|
+
"m-p-c-electronics-dsm-1",
|
|
1703
|
+
"pearl-sy-1",
|
|
1704
|
+
"roland-tr-505",
|
|
1705
|
+
"sequential-circuits-studio-440",
|
|
1706
|
+
"simmons-sds-2000",
|
|
1707
|
+
"simmons-sdx",
|
|
1708
|
+
"yamaha-pss-130",
|
|
1709
|
+
"yamaha-ptx8",
|
|
1710
|
+
"yamaha-rx-21l"
|
|
1711
|
+
]
|
|
1712
|
+
};
|
|
1713
|
+
var machineToPack = (() => {
|
|
1714
|
+
const m = /* @__PURE__ */ new Map();
|
|
1715
|
+
for (const pack of DRUM_ABUSE_PACKS) {
|
|
1716
|
+
for (const id of MACHINES_BY_PACK[pack]) m.set(id, pack);
|
|
1717
|
+
}
|
|
1718
|
+
return m;
|
|
1719
|
+
})();
|
|
1720
|
+
function getDrumAbuseMachineNames() {
|
|
1721
|
+
return [...machineToPack.keys()];
|
|
1722
|
+
}
|
|
1723
|
+
function getDrumAbuseMachinesForPack(pack) {
|
|
1724
|
+
return MACHINES_BY_PACK[pack];
|
|
1725
|
+
}
|
|
1726
|
+
function getDrumAbusePackNames() {
|
|
1727
|
+
return DRUM_ABUSE_PACKS;
|
|
1728
|
+
}
|
|
1729
|
+
function getDrumAbuseMachinePack(id) {
|
|
1730
|
+
return machineToPack.get(id);
|
|
1731
|
+
}
|
|
1732
|
+
var encSeg = (s) => s.split("/").map(encodeURIComponent).join("/");
|
|
1733
|
+
function packBase(baseUrl, pack) {
|
|
1734
|
+
return `${baseUrl}/drum-abuse-${pack}`;
|
|
1735
|
+
}
|
|
1736
|
+
function sampleBaseUrl(baseUrl, pack, urlPath) {
|
|
1737
|
+
return `${packBase(baseUrl, pack)}/samples/${encSeg(urlPath)}/`;
|
|
1738
|
+
}
|
|
1739
|
+
function drumAbuseSampleUrl(pack, urlPath, fileNoExt, format = "wav", baseUrl = DEFAULT_BASE_URL) {
|
|
1740
|
+
return `${sampleBaseUrl(baseUrl, pack, urlPath)}${encodeURIComponent(fileNoExt)}.${format}`;
|
|
1741
|
+
}
|
|
1742
|
+
function stripExt(filename) {
|
|
1743
|
+
return filename.replace(/\.[^.]+$/, "");
|
|
1744
|
+
}
|
|
1745
|
+
var jsonCache = /* @__PURE__ */ new Map();
|
|
1746
|
+
function fetchJSON(url, storage) {
|
|
1747
|
+
let p = jsonCache.get(url);
|
|
1748
|
+
if (!p) {
|
|
1749
|
+
p = storage.fetch(url).then((r) => {
|
|
1750
|
+
if (r.status >= 400) throw new Error(`DrumAbuse: ${r.status} ${url}`);
|
|
1751
|
+
return r.json();
|
|
1752
|
+
});
|
|
1753
|
+
jsonCache.set(url, p);
|
|
1754
|
+
}
|
|
1755
|
+
return p;
|
|
1756
|
+
}
|
|
1757
|
+
function buildMachinePreset(machine, setPath, baseUrl, pack) {
|
|
1758
|
+
if (machine.sample_sets.length === 0) {
|
|
1759
|
+
throw new Error(`DrumAbuse: machine "${machine.id}" has no sample sets`);
|
|
1760
|
+
}
|
|
1761
|
+
const set = setPath ? machine.sample_sets.find((s) => s.path === setPath) : machine.sample_sets[0];
|
|
1762
|
+
if (!set) {
|
|
1763
|
+
throw new Error(`DrumAbuse: set "${setPath}" not found on "${machine.id}"`);
|
|
1764
|
+
}
|
|
1765
|
+
if (set.samples.length === 0) {
|
|
1766
|
+
throw new Error(
|
|
1767
|
+
`DrumAbuse: set "${set.path}" of "${machine.id}" has no samples`
|
|
1768
|
+
);
|
|
1769
|
+
}
|
|
1770
|
+
const sampleNames = [];
|
|
1771
|
+
const groupNames = [];
|
|
1772
|
+
const sampleNamesForGroup = {};
|
|
1773
|
+
const aliases = {};
|
|
1774
|
+
const regions = set.samples.map((file, i) => {
|
|
1775
|
+
const key = stripExt(file);
|
|
1776
|
+
const midi = MIDI_BASE + i;
|
|
1777
|
+
sampleNames.push(key);
|
|
1778
|
+
aliases[key] = midi;
|
|
1779
|
+
const group = set.sample_instruments[i] || "";
|
|
1780
|
+
if (group) {
|
|
1781
|
+
if (!sampleNamesForGroup[group]) {
|
|
1782
|
+
sampleNamesForGroup[group] = [];
|
|
1783
|
+
groupNames.push(group);
|
|
1784
|
+
aliases[group] = midi;
|
|
1785
|
+
}
|
|
1786
|
+
sampleNamesForGroup[group].push(key);
|
|
1787
|
+
}
|
|
1788
|
+
return {
|
|
1789
|
+
sample: key,
|
|
1790
|
+
keyRange: [midi, midi],
|
|
1791
|
+
pitch: midi
|
|
1792
|
+
};
|
|
1793
|
+
});
|
|
1794
|
+
return {
|
|
1795
|
+
preset: {
|
|
1796
|
+
samples: {
|
|
1797
|
+
baseUrl: sampleBaseUrl(baseUrl, pack, set.url_path),
|
|
1798
|
+
formats: ["wav"]
|
|
1799
|
+
},
|
|
1800
|
+
groups: [{ regions }],
|
|
1801
|
+
aliases
|
|
1802
|
+
},
|
|
1803
|
+
sampleNames,
|
|
1804
|
+
groupNames,
|
|
1805
|
+
sampleNamesForGroup,
|
|
1806
|
+
setPath: set.path
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
function buildPackPreset(list, baseUrl, pack) {
|
|
1810
|
+
var _a;
|
|
1811
|
+
if (list.length === 0) {
|
|
1812
|
+
throw new Error(`DrumAbuse: empty pack-instrument list for pack "${pack}"`);
|
|
1813
|
+
}
|
|
1814
|
+
const fileCount = {};
|
|
1815
|
+
for (const s of list) {
|
|
1816
|
+
const f = stripExt(s.file);
|
|
1817
|
+
fileCount[f] = ((_a = fileCount[f]) != null ? _a : 0) + 1;
|
|
1818
|
+
}
|
|
1819
|
+
const sampleNames = [];
|
|
1820
|
+
const groupNames = [];
|
|
1821
|
+
const sampleNamesForGroup = {};
|
|
1822
|
+
const map = {};
|
|
1823
|
+
const aliases = {};
|
|
1824
|
+
const regions = list.map((s, i) => {
|
|
1825
|
+
const fileKey = stripExt(s.file);
|
|
1826
|
+
const uniqueKey = `${s.machine_id}/${fileKey}`;
|
|
1827
|
+
const midi = MIDI_BASE + i;
|
|
1828
|
+
sampleNames.push(uniqueKey);
|
|
1829
|
+
aliases[uniqueKey] = midi;
|
|
1830
|
+
if (fileCount[fileKey] === 1) aliases[fileKey] = midi;
|
|
1831
|
+
map[uniqueKey] = `${packBase(baseUrl, pack)}/samples/${encSeg(s.url_path)}/${encodeURIComponent(s.file)}`;
|
|
1832
|
+
if (!sampleNamesForGroup[s.machine_id]) {
|
|
1833
|
+
sampleNamesForGroup[s.machine_id] = [];
|
|
1834
|
+
groupNames.push(s.machine_id);
|
|
1835
|
+
aliases[s.machine_id] = midi;
|
|
1836
|
+
}
|
|
1837
|
+
sampleNamesForGroup[s.machine_id].push(uniqueKey);
|
|
1838
|
+
return {
|
|
1839
|
+
sample: uniqueKey,
|
|
1840
|
+
keyRange: [midi, midi],
|
|
1841
|
+
pitch: midi
|
|
1842
|
+
};
|
|
1843
|
+
});
|
|
1844
|
+
return {
|
|
1845
|
+
preset: {
|
|
1846
|
+
samples: { baseUrl: "", formats: ["wav"], map },
|
|
1847
|
+
groups: [{ regions }],
|
|
1848
|
+
aliases
|
|
1849
|
+
},
|
|
1850
|
+
sampleNames,
|
|
1851
|
+
groupNames,
|
|
1852
|
+
sampleNamesForGroup,
|
|
1853
|
+
setPath: null
|
|
1854
|
+
};
|
|
1855
|
+
}
|
|
1856
|
+
var DrumAbuse = Instrument(
|
|
1857
|
+
(_ctx, options = {}, smplr) => {
|
|
1858
|
+
var _a, _b;
|
|
1859
|
+
const source = options.source;
|
|
1860
|
+
if (!source) {
|
|
1861
|
+
throw new Error("DrumAbuse: options.source is required");
|
|
1862
|
+
}
|
|
1863
|
+
const baseUrl = (_a = options.baseUrl) != null ? _a : DEFAULT_BASE_URL;
|
|
1864
|
+
const storage = (_b = options.storage) != null ? _b : HttpStorage;
|
|
1865
|
+
let sampleNames = [];
|
|
1866
|
+
let groupNames = [];
|
|
1867
|
+
let sampleNamesForGroup = {};
|
|
1868
|
+
let machineId = null;
|
|
1869
|
+
let setPath = null;
|
|
1870
|
+
let packId;
|
|
1871
|
+
let mode;
|
|
1872
|
+
let presetPromise;
|
|
1873
|
+
if (source.kind === "machine") {
|
|
1874
|
+
mode = "machine";
|
|
1875
|
+
const pack = getDrumAbuseMachinePack(source.machine);
|
|
1876
|
+
if (!pack) {
|
|
1877
|
+
throw new Error(`DrumAbuse: unknown machine "${source.machine}"`);
|
|
1878
|
+
}
|
|
1879
|
+
packId = pack;
|
|
1880
|
+
machineId = source.machine;
|
|
1881
|
+
const url = `${packBase(baseUrl, pack)}/machines/${encodeURIComponent(source.machine)}.json`;
|
|
1882
|
+
presetPromise = fetchJSON(url, storage).then((machine) => {
|
|
1883
|
+
const built = buildMachinePreset(machine, source.set, baseUrl, pack);
|
|
1884
|
+
sampleNames = built.sampleNames;
|
|
1885
|
+
groupNames = built.groupNames;
|
|
1886
|
+
sampleNamesForGroup = built.sampleNamesForGroup;
|
|
1887
|
+
setPath = built.setPath;
|
|
1888
|
+
return built.preset;
|
|
1889
|
+
});
|
|
1890
|
+
} else {
|
|
1891
|
+
mode = "pack";
|
|
1892
|
+
if (!DRUM_ABUSE_PACKS.includes(source.pack)) {
|
|
1893
|
+
throw new Error(`DrumAbuse: unknown pack "${source.pack}"`);
|
|
1894
|
+
}
|
|
1895
|
+
packId = source.pack;
|
|
1896
|
+
const url = `${packBase(baseUrl, source.pack)}/instruments/${encodeURIComponent(source.instrument)}.json`;
|
|
1897
|
+
presetPromise = fetchJSON(url, storage).then((list) => {
|
|
1898
|
+
const built = buildPackPreset(list, baseUrl, source.pack);
|
|
1899
|
+
sampleNames = built.sampleNames;
|
|
1900
|
+
groupNames = built.groupNames;
|
|
1901
|
+
sampleNamesForGroup = built.sampleNamesForGroup;
|
|
1902
|
+
return built.preset;
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
const baseStart = smplr.start.bind(smplr);
|
|
1906
|
+
const extras = {
|
|
1907
|
+
get mode() {
|
|
1908
|
+
return mode;
|
|
1909
|
+
},
|
|
1910
|
+
getSampleNames: () => sampleNames.slice(),
|
|
1911
|
+
getGroupNames: () => groupNames.slice(),
|
|
1912
|
+
getSampleNamesForGroup: (g) => {
|
|
1913
|
+
var _a2;
|
|
1914
|
+
return ((_a2 = sampleNamesForGroup[g]) != null ? _a2 : []).slice();
|
|
1915
|
+
},
|
|
1916
|
+
getMachineId: () => machineId,
|
|
1917
|
+
getSetPath: () => setPath,
|
|
1918
|
+
getPackId: () => packId,
|
|
1919
|
+
start: (event) => {
|
|
1920
|
+
var _a2;
|
|
1921
|
+
const ev = typeof event === "object" ? event : { note: event };
|
|
1922
|
+
return baseStart(__spreadProps(__spreadValues({}, ev), { stopId: (_a2 = ev.stopId) != null ? _a2 : ev.note }));
|
|
1923
|
+
}
|
|
1924
|
+
};
|
|
1925
|
+
const ready = presetPromise.then((preset) => smplr.loadInstrument(preset));
|
|
1926
|
+
return { extras, ready };
|
|
1927
|
+
}
|
|
1928
|
+
);
|
|
1929
|
+
|
|
1464
1930
|
// src/offline/wav-encoder.ts
|
|
1465
1931
|
function audioBufferToWav(buffer) {
|
|
1466
1932
|
return encodeWav(buffer, 32);
|
|
@@ -1754,6 +2220,11 @@ var TransportClock = class {
|
|
|
1754
2220
|
*
|
|
1755
2221
|
* Any checkpoints at or after `audioTime` are removed and replaced with this
|
|
1756
2222
|
* new anchor, preserving the BPM that was in effect at that time.
|
|
2223
|
+
*
|
|
2224
|
+
* @internal Leaks checkpoint-list semantics; only called by `Sequencer._flush`
|
|
2225
|
+
* for loop-boundary re-anchoring. Not safe to share between Sequencers — see
|
|
2226
|
+
* thoughts/research/2026-05-17_20-18-43_shared-transport.md §3. Must not be
|
|
2227
|
+
* exported from any barrel.
|
|
1757
2228
|
*/
|
|
1758
2229
|
seekAt(tick, audioTime) {
|
|
1759
2230
|
let bpm = this._bpm;
|
|
@@ -1807,9 +2278,13 @@ var TransportClock = class {
|
|
|
1807
2278
|
return cp.tick + (audioTime - cp.audioTime) / this._secondsPerTick(cp.bpm);
|
|
1808
2279
|
}
|
|
1809
2280
|
/**
|
|
1810
|
-
*
|
|
2281
|
+
* Convert a tick count to seconds at the current (snapshot) BPM.
|
|
2282
|
+
*
|
|
2283
|
+
* Uses `this._bpm` directly, not the checkpoint history — so after a
|
|
2284
|
+
* mid-play BPM change this returns a value based on the *latest* BPM only.
|
|
2285
|
+
* For checkpoint-aware durations, use `tickToAudioTime(end) - tickToAudioTime(start)`.
|
|
1811
2286
|
*/
|
|
1812
|
-
|
|
2287
|
+
ticksToSeconds(ticks) {
|
|
1813
2288
|
return ticks * this._secondsPerTick(this._bpm);
|
|
1814
2289
|
}
|
|
1815
2290
|
// ---------------------------------------------------------------------------
|
|
@@ -2362,7 +2837,7 @@ var SequencerImpl = class {
|
|
|
2362
2837
|
if (Math.random() * 100 >= note.chance) continue;
|
|
2363
2838
|
}
|
|
2364
2839
|
const audioTime = this._clock.tickToAudioTime(noteTick);
|
|
2365
|
-
const durationSec = note.duration !== void 0 ? this._clock.
|
|
2840
|
+
const durationSec = note.duration !== void 0 ? this._clock.ticksToSeconds(
|
|
2366
2841
|
parseTicks(note.duration, this._ppq, this._timeSignature)
|
|
2367
2842
|
) : void 0;
|
|
2368
2843
|
const timingOffset = trackHumanize.timing ? (Math.random() * 2 - 1) * trackHumanize.timing / 1e3 : 0;
|
|
@@ -2823,11 +3298,11 @@ function loadVersilianInstrument(smplr, options) {
|
|
|
2823
3298
|
const instrument = (_a = options.instrument) != null ? _a : "Strings/Violin/Violin - Arco";
|
|
2824
3299
|
const sfzUrl = `${VCSL_BASE_URL}/${instrument}.sfz`;
|
|
2825
3300
|
const base = instrument.slice(0, instrument.lastIndexOf("/") + 1);
|
|
2826
|
-
const
|
|
3301
|
+
const sampleBaseUrl2 = `${VCSL_BASE_URL}/${base}`;
|
|
2827
3302
|
return fetch(sfzUrl).then((r) => r.text()).then(
|
|
2828
3303
|
(sfzText) => smplr.loadInstrument(
|
|
2829
3304
|
sfzToPreset(sfzText, {
|
|
2830
|
-
baseUrl:
|
|
3305
|
+
baseUrl: sampleBaseUrl2,
|
|
2831
3306
|
pathFromSampleName: (name) => name.replace(/\.wav$/i, ""),
|
|
2832
3307
|
formats: ["ogg", "m4a"]
|
|
2833
3308
|
})
|
|
@@ -3976,6 +4451,8 @@ var LAYERS = [
|
|
|
3976
4451
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3977
4452
|
0 && (module.exports = {
|
|
3978
4453
|
CacheStorage,
|
|
4454
|
+
DRUM_ABUSE_PACKS,
|
|
4455
|
+
DrumAbuse,
|
|
3979
4456
|
DrumMachine,
|
|
3980
4457
|
ElectricPiano,
|
|
3981
4458
|
HttpStorage,
|
|
@@ -3997,7 +4474,12 @@ var LAYERS = [
|
|
|
3997
4474
|
Versilian,
|
|
3998
4475
|
audioBufferToWav,
|
|
3999
4476
|
audioBufferToWav16,
|
|
4477
|
+
drumAbuseSampleUrl,
|
|
4000
4478
|
drumMachineToPreset,
|
|
4479
|
+
getDrumAbuseMachineNames,
|
|
4480
|
+
getDrumAbuseMachinePack,
|
|
4481
|
+
getDrumAbuseMachinesForPack,
|
|
4482
|
+
getDrumAbusePackNames,
|
|
4001
4483
|
getDrumMachineNames,
|
|
4002
4484
|
getElectricPianoNames,
|
|
4003
4485
|
getMalletNames,
|