@onjmin/dtm 0.1.94 → 0.1.95
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/dist/index.js +49 -1
- package/dist/index.mjs +49 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11534,7 +11534,7 @@ var buildUI = (target, options) => {
|
|
|
11534
11534
|
<span class="dtm-label" data-dtm="master-volume-label">50%</span>
|
|
11535
11535
|
</div>
|
|
11536
11536
|
<div class="dtm-row">
|
|
11537
|
-
<button class="dtm-btn dtm-btn--ghost dtm-btn--xs" data-dtm="auto-master" title="\u97F3\u5727\u30FB\u30B9\u30C6\u30EC\u30AA\u5E45\u30FB\u30EA\u30D0\u30FC\u30D6\
|
|
11537
|
+
<button class="dtm-btn dtm-btn--ghost dtm-btn--xs" data-dtm="auto-master" title="\u97F3\u5727\u30FB\u30B9\u30C6\u30EC\u30AA\u5E45\u30FB\u30EA\u30D0\u30FC\u30D6\u306B\u52A0\u3048\u3001\u5404\u30C8\u30E9\u30C3\u30AF\u306E\u697D\u5668\u30FB\u97F3\u91CF\u3082\u81EA\u52D5\u63A8\u5B9A\u3057\u3066\u4E00\u62EC\u8A2D\u5B9A\u3057\u307E\u3059">\u304A\u307E\u304B\u305B\u30DE\u30B9\u30BF\u30EA\u30F3\u30B0</button>
|
|
11538
11538
|
<button class="dtm-infobtn" data-dtm="auto-master-info" title="\u304A\u307E\u304B\u305B\u30DE\u30B9\u30BF\u30EA\u30F3\u30B0\u306E\u89E3\u8AAC">${icon("info", 12)}</button>
|
|
11539
11539
|
<span class="dtm-grow"></span>
|
|
11540
11540
|
</div>
|
|
@@ -13655,6 +13655,15 @@ var AUTO_MASTER_INFO_HTML = `
|
|
|
13655
13655
|
<li>\u5168\u30C8\u30E9\u30C3\u30AF\u306E\u30B9\u30C6\u30EC\u30AA\u5E45: 115%\uFF08\u308F\u305A\u304B\u306B\u5E83\u3052\u308B\uFF09</li>
|
|
13656
13656
|
<li>\u6B4C\u8A5E\u306E\u3042\u308B\u30C8\u30E9\u30C3\u30AF: \u81EA\u52D5\u30D3\u30D6\u30E9\u30FC\u30C8ON</li>
|
|
13657
13657
|
</ul>
|
|
13658
|
+
<h4>\u697D\u5668\u30FB\u97F3\u91CF\u306E\u81EA\u52D5\u5272\u308A\u5F53\u3066</h4>
|
|
13659
|
+
<p>\u6B4C\u8A5E\u306E\u306A\u3044\u30C8\u30E9\u30C3\u30AF\u306F\u3001\u7F6E\u304B\u308C\u3066\u3044\u308B\u30CE\u30FC\u30C8\u306E\u97F3\u9AD8\u30FB\u30BF\u30A4\u30DF\u30F3\u30B0\u30FB\u548C\u97F3\u306E\u539A\u307F\u304B\u3089\u5F79\u5272\u3092\u63A8\u5B9A\u3057\u3001\u697D\u5668\u3068\u97F3\u91CF\u3092\u81EA\u52D5\u3067\u5F53\u3066\u307E\u3059\u3002</p>
|
|
13660
|
+
<ul>
|
|
13661
|
+
<li><strong>\u4F4E\u97F3\u57DF\uFF08C3\u672A\u6E80\uFF09\u304C\u4E2D\u5FC3</strong> \u2192 \u30D9\u30FC\u30B9\u697D\u5668\u30FB\u97F3\u91CF85</li>
|
|
13662
|
+
<li><strong>\u548C\u97F3\uFF08\u540C\u6642\u767A\u97F3\uFF09\u304C\u591A\u304F\u97F3\u4FA1\u3082\u9577\u3044</strong> \u2192 \u4F34\u594F\uFF08\u30B3\u30FC\u30C9/\u30D1\u30C3\u30C9\uFF09\u697D\u5668\u30FB\u97F3\u91CF72</li>
|
|
13663
|
+
<li><strong>\u5358\u97F3\u3067\u97F3\u6570\u304C\u5C11\u306A\u304F\u97F3\u4FA1\u304C\u9577\u3044</strong> \u2192 \u30B5\u30D6\u30E1\u30ED\uFF08\u30AA\u30D6\u30EA\u30AC\u30FC\u30C8\u5BC4\u308A\uFF09\u697D\u5668\u30FB\u97F3\u91CF92</li>
|
|
13664
|
+
<li><strong>\u305D\u308C\u4EE5\u5916\uFF08\u5358\u97F3\u3067\u52D5\u304D\u304C\u591A\u3044\uFF09</strong> \u2192 \u30E1\u30ED\u30C7\u30A3\u697D\u5668\u30FB\u97F3\u91CF100</li>
|
|
13665
|
+
</ul>
|
|
13666
|
+
<p style="margin-top:4px;"><small>\u697D\u5668\u540D\u306F\u73FE\u5728\u9078\u629E\u4E2D\u306E\u697D\u5668\u30D7\u30EA\u30BB\u30C3\u30C8\uFF08\u672A\u9078\u629E\u306A\u3089\u30B0\u30E9\u30F3\u30C9\u30D4\u30A2\u30CE\uFF09\u304B\u3089\u5F79\u5272\u306B\u5BFE\u5FDC\u3059\u308B\u3082\u306E\u3092\u5F15\u304D\u307E\u3059\u3002\u97F3\u306E\u5C11\u306A\u3044\u30C8\u30E9\u30C3\u30AF\uFF08\u7121\u97F3\uFF09\u306F\u5224\u5B9A\u3067\u304D\u306A\u3044\u305F\u3081\u5BFE\u8C61\u5916\u3067\u3059\u3002\u3042\u304F\u307E\u3067\u81EA\u52D5\u63A8\u5B9A\u306A\u306E\u3067\u3001\u610F\u56F3\u3068\u9055\u3046\u5834\u5408\u306F\u5404\u30C8\u30E9\u30C3\u30AF\u306E\u300C\u697D\u5668\u300D\u6B04\u304B\u3089\u500B\u5225\u306B\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002</small></p>
|
|
13658
13667
|
<h4>\u30E1\u30A4\u30F3\u30DC\u30FC\u30AB\u30EB\u306E\u81EA\u52D5\u5224\u5B9A</h4>
|
|
13659
13668
|
<p>\u6B4C\u8A5E\u306E\u3042\u308B\u30C8\u30E9\u30C3\u30AF\u304C\u8907\u6570\u3042\u308B\u5834\u5408\uFF08\u30CF\u30E2\u30EA\u30FB\u30B3\u30FC\u30E9\u30B9\u30FB\u639B\u3051\u58F0\u7B49\uFF09\u3001\u767A\u97F3\u6642\u9593\u304C\u6700\u3082\u9577\u3044\u30C8\u30E9\u30C3\u30AF\u3092\u300C\u30E1\u30A4\u30F3\u30DC\u30FC\u30AB\u30EB\u300D\u3068\u307F\u306A\u3057\u3001\u4ED6\u3068\u306F\u9055\u3046\u6271\u3044\u306B\u3057\u307E\u3059\u3002</p>
|
|
13660
13669
|
<ul>
|
|
@@ -13905,6 +13914,31 @@ var normalizeInstrumentName = (name) => {
|
|
|
13905
13914
|
(n) => n.replace(/\s+/g, "").toLowerCase() === stripped
|
|
13906
13915
|
) ?? name;
|
|
13907
13916
|
};
|
|
13917
|
+
var AUTO_ROLE_STEPS_PER_BEAT = 48;
|
|
13918
|
+
var AUTO_ROLE_VOLUME = {
|
|
13919
|
+
melody: 100,
|
|
13920
|
+
submelody: 92,
|
|
13921
|
+
bass: 85,
|
|
13922
|
+
chord: 72
|
|
13923
|
+
};
|
|
13924
|
+
var classifyTrackRole = (notes) => {
|
|
13925
|
+
const avgPitch = notes.reduce((s, n) => s + n.pitch, 0) / notes.length;
|
|
13926
|
+
if (avgPitch < 48) return "bass";
|
|
13927
|
+
const avgDur = notes.reduce((s, n) => s + n.durationSteps, 0) / notes.length;
|
|
13928
|
+
const byStart = /* @__PURE__ */ new Map();
|
|
13929
|
+
for (const n of notes)
|
|
13930
|
+
byStart.set(n.startStep, (byStart.get(n.startStep) ?? 0) + 1);
|
|
13931
|
+
let maxPoly = 0;
|
|
13932
|
+
for (const c of byStart.values()) if (c > maxPoly) maxPoly = c;
|
|
13933
|
+
if (maxPoly >= 2 && avgDur >= AUTO_ROLE_STEPS_PER_BEAT) return "chord";
|
|
13934
|
+
const minStart = Math.min(...notes.map((n) => n.startStep));
|
|
13935
|
+
const maxEnd = Math.max(...notes.map((n) => n.startStep + n.durationSteps));
|
|
13936
|
+
const spanBeats = Math.max(1, (maxEnd - minStart) / AUTO_ROLE_STEPS_PER_BEAT);
|
|
13937
|
+
const notesPerBeat = notes.length / spanBeats;
|
|
13938
|
+
if (notesPerBeat < 1.2 && avgDur >= AUTO_ROLE_STEPS_PER_BEAT * 1.5)
|
|
13939
|
+
return "submelody";
|
|
13940
|
+
return "melody";
|
|
13941
|
+
};
|
|
13908
13942
|
var mountDAW = (target, options = {}) => {
|
|
13909
13943
|
injectStyles();
|
|
13910
13944
|
const getAudioTime = options.getAudioTime ?? (() => performance.now() / 1e3);
|
|
@@ -16681,6 +16715,20 @@ var mountDAW = (target, options = {}) => {
|
|
|
16681
16715
|
mainVocalId = t.config.id;
|
|
16682
16716
|
}
|
|
16683
16717
|
}
|
|
16718
|
+
const autoPreset = INSTRUMENT_PRESETS[currentInstrument] ?? INSTRUMENT_PRESETS.piano;
|
|
16719
|
+
for (const t of trackStates) {
|
|
16720
|
+
if (t.lyricModel) continue;
|
|
16721
|
+
const notes = t.core.getNotes();
|
|
16722
|
+
if (notes.length === 0) continue;
|
|
16723
|
+
const role = classifyTrackRole(notes);
|
|
16724
|
+
const instName = autoPreset[role];
|
|
16725
|
+
t.trackInstrument = instName;
|
|
16726
|
+
const trackIndex = trackStates.indexOf(t);
|
|
16727
|
+
options.onTrackInstrumentChange?.(trackIndex, instName);
|
|
16728
|
+
const vol = AUTO_ROLE_VOLUME[role];
|
|
16729
|
+
t.volume = vol;
|
|
16730
|
+
t.core.setVolume(vol);
|
|
16731
|
+
}
|
|
16684
16732
|
for (const t of trackStates) {
|
|
16685
16733
|
const isMainVocal = !!t.lyricModel && t.config.id === mainVocalId;
|
|
16686
16734
|
const comp = !t.lyricModel ? 35 : isMainVocal ? 30 : 25;
|
package/dist/index.mjs
CHANGED
|
@@ -11403,7 +11403,7 @@ var buildUI = (target, options) => {
|
|
|
11403
11403
|
<span class="dtm-label" data-dtm="master-volume-label">50%</span>
|
|
11404
11404
|
</div>
|
|
11405
11405
|
<div class="dtm-row">
|
|
11406
|
-
<button class="dtm-btn dtm-btn--ghost dtm-btn--xs" data-dtm="auto-master" title="\u97F3\u5727\u30FB\u30B9\u30C6\u30EC\u30AA\u5E45\u30FB\u30EA\u30D0\u30FC\u30D6\
|
|
11406
|
+
<button class="dtm-btn dtm-btn--ghost dtm-btn--xs" data-dtm="auto-master" title="\u97F3\u5727\u30FB\u30B9\u30C6\u30EC\u30AA\u5E45\u30FB\u30EA\u30D0\u30FC\u30D6\u306B\u52A0\u3048\u3001\u5404\u30C8\u30E9\u30C3\u30AF\u306E\u697D\u5668\u30FB\u97F3\u91CF\u3082\u81EA\u52D5\u63A8\u5B9A\u3057\u3066\u4E00\u62EC\u8A2D\u5B9A\u3057\u307E\u3059">\u304A\u307E\u304B\u305B\u30DE\u30B9\u30BF\u30EA\u30F3\u30B0</button>
|
|
11407
11407
|
<button class="dtm-infobtn" data-dtm="auto-master-info" title="\u304A\u307E\u304B\u305B\u30DE\u30B9\u30BF\u30EA\u30F3\u30B0\u306E\u89E3\u8AAC">${icon("info", 12)}</button>
|
|
11408
11408
|
<span class="dtm-grow"></span>
|
|
11409
11409
|
</div>
|
|
@@ -13524,6 +13524,15 @@ var AUTO_MASTER_INFO_HTML = `
|
|
|
13524
13524
|
<li>\u5168\u30C8\u30E9\u30C3\u30AF\u306E\u30B9\u30C6\u30EC\u30AA\u5E45: 115%\uFF08\u308F\u305A\u304B\u306B\u5E83\u3052\u308B\uFF09</li>
|
|
13525
13525
|
<li>\u6B4C\u8A5E\u306E\u3042\u308B\u30C8\u30E9\u30C3\u30AF: \u81EA\u52D5\u30D3\u30D6\u30E9\u30FC\u30C8ON</li>
|
|
13526
13526
|
</ul>
|
|
13527
|
+
<h4>\u697D\u5668\u30FB\u97F3\u91CF\u306E\u81EA\u52D5\u5272\u308A\u5F53\u3066</h4>
|
|
13528
|
+
<p>\u6B4C\u8A5E\u306E\u306A\u3044\u30C8\u30E9\u30C3\u30AF\u306F\u3001\u7F6E\u304B\u308C\u3066\u3044\u308B\u30CE\u30FC\u30C8\u306E\u97F3\u9AD8\u30FB\u30BF\u30A4\u30DF\u30F3\u30B0\u30FB\u548C\u97F3\u306E\u539A\u307F\u304B\u3089\u5F79\u5272\u3092\u63A8\u5B9A\u3057\u3001\u697D\u5668\u3068\u97F3\u91CF\u3092\u81EA\u52D5\u3067\u5F53\u3066\u307E\u3059\u3002</p>
|
|
13529
|
+
<ul>
|
|
13530
|
+
<li><strong>\u4F4E\u97F3\u57DF\uFF08C3\u672A\u6E80\uFF09\u304C\u4E2D\u5FC3</strong> \u2192 \u30D9\u30FC\u30B9\u697D\u5668\u30FB\u97F3\u91CF85</li>
|
|
13531
|
+
<li><strong>\u548C\u97F3\uFF08\u540C\u6642\u767A\u97F3\uFF09\u304C\u591A\u304F\u97F3\u4FA1\u3082\u9577\u3044</strong> \u2192 \u4F34\u594F\uFF08\u30B3\u30FC\u30C9/\u30D1\u30C3\u30C9\uFF09\u697D\u5668\u30FB\u97F3\u91CF72</li>
|
|
13532
|
+
<li><strong>\u5358\u97F3\u3067\u97F3\u6570\u304C\u5C11\u306A\u304F\u97F3\u4FA1\u304C\u9577\u3044</strong> \u2192 \u30B5\u30D6\u30E1\u30ED\uFF08\u30AA\u30D6\u30EA\u30AC\u30FC\u30C8\u5BC4\u308A\uFF09\u697D\u5668\u30FB\u97F3\u91CF92</li>
|
|
13533
|
+
<li><strong>\u305D\u308C\u4EE5\u5916\uFF08\u5358\u97F3\u3067\u52D5\u304D\u304C\u591A\u3044\uFF09</strong> \u2192 \u30E1\u30ED\u30C7\u30A3\u697D\u5668\u30FB\u97F3\u91CF100</li>
|
|
13534
|
+
</ul>
|
|
13535
|
+
<p style="margin-top:4px;"><small>\u697D\u5668\u540D\u306F\u73FE\u5728\u9078\u629E\u4E2D\u306E\u697D\u5668\u30D7\u30EA\u30BB\u30C3\u30C8\uFF08\u672A\u9078\u629E\u306A\u3089\u30B0\u30E9\u30F3\u30C9\u30D4\u30A2\u30CE\uFF09\u304B\u3089\u5F79\u5272\u306B\u5BFE\u5FDC\u3059\u308B\u3082\u306E\u3092\u5F15\u304D\u307E\u3059\u3002\u97F3\u306E\u5C11\u306A\u3044\u30C8\u30E9\u30C3\u30AF\uFF08\u7121\u97F3\uFF09\u306F\u5224\u5B9A\u3067\u304D\u306A\u3044\u305F\u3081\u5BFE\u8C61\u5916\u3067\u3059\u3002\u3042\u304F\u307E\u3067\u81EA\u52D5\u63A8\u5B9A\u306A\u306E\u3067\u3001\u610F\u56F3\u3068\u9055\u3046\u5834\u5408\u306F\u5404\u30C8\u30E9\u30C3\u30AF\u306E\u300C\u697D\u5668\u300D\u6B04\u304B\u3089\u500B\u5225\u306B\u9078\u3073\u76F4\u3057\u3066\u304F\u3060\u3055\u3044\u3002</small></p>
|
|
13527
13536
|
<h4>\u30E1\u30A4\u30F3\u30DC\u30FC\u30AB\u30EB\u306E\u81EA\u52D5\u5224\u5B9A</h4>
|
|
13528
13537
|
<p>\u6B4C\u8A5E\u306E\u3042\u308B\u30C8\u30E9\u30C3\u30AF\u304C\u8907\u6570\u3042\u308B\u5834\u5408\uFF08\u30CF\u30E2\u30EA\u30FB\u30B3\u30FC\u30E9\u30B9\u30FB\u639B\u3051\u58F0\u7B49\uFF09\u3001\u767A\u97F3\u6642\u9593\u304C\u6700\u3082\u9577\u3044\u30C8\u30E9\u30C3\u30AF\u3092\u300C\u30E1\u30A4\u30F3\u30DC\u30FC\u30AB\u30EB\u300D\u3068\u307F\u306A\u3057\u3001\u4ED6\u3068\u306F\u9055\u3046\u6271\u3044\u306B\u3057\u307E\u3059\u3002</p>
|
|
13529
13538
|
<ul>
|
|
@@ -13774,6 +13783,31 @@ var normalizeInstrumentName = (name) => {
|
|
|
13774
13783
|
(n) => n.replace(/\s+/g, "").toLowerCase() === stripped
|
|
13775
13784
|
) ?? name;
|
|
13776
13785
|
};
|
|
13786
|
+
var AUTO_ROLE_STEPS_PER_BEAT = 48;
|
|
13787
|
+
var AUTO_ROLE_VOLUME = {
|
|
13788
|
+
melody: 100,
|
|
13789
|
+
submelody: 92,
|
|
13790
|
+
bass: 85,
|
|
13791
|
+
chord: 72
|
|
13792
|
+
};
|
|
13793
|
+
var classifyTrackRole = (notes) => {
|
|
13794
|
+
const avgPitch = notes.reduce((s, n) => s + n.pitch, 0) / notes.length;
|
|
13795
|
+
if (avgPitch < 48) return "bass";
|
|
13796
|
+
const avgDur = notes.reduce((s, n) => s + n.durationSteps, 0) / notes.length;
|
|
13797
|
+
const byStart = /* @__PURE__ */ new Map();
|
|
13798
|
+
for (const n of notes)
|
|
13799
|
+
byStart.set(n.startStep, (byStart.get(n.startStep) ?? 0) + 1);
|
|
13800
|
+
let maxPoly = 0;
|
|
13801
|
+
for (const c of byStart.values()) if (c > maxPoly) maxPoly = c;
|
|
13802
|
+
if (maxPoly >= 2 && avgDur >= AUTO_ROLE_STEPS_PER_BEAT) return "chord";
|
|
13803
|
+
const minStart = Math.min(...notes.map((n) => n.startStep));
|
|
13804
|
+
const maxEnd = Math.max(...notes.map((n) => n.startStep + n.durationSteps));
|
|
13805
|
+
const spanBeats = Math.max(1, (maxEnd - minStart) / AUTO_ROLE_STEPS_PER_BEAT);
|
|
13806
|
+
const notesPerBeat = notes.length / spanBeats;
|
|
13807
|
+
if (notesPerBeat < 1.2 && avgDur >= AUTO_ROLE_STEPS_PER_BEAT * 1.5)
|
|
13808
|
+
return "submelody";
|
|
13809
|
+
return "melody";
|
|
13810
|
+
};
|
|
13777
13811
|
var mountDAW = (target, options = {}) => {
|
|
13778
13812
|
injectStyles();
|
|
13779
13813
|
const getAudioTime = options.getAudioTime ?? (() => performance.now() / 1e3);
|
|
@@ -16550,6 +16584,20 @@ var mountDAW = (target, options = {}) => {
|
|
|
16550
16584
|
mainVocalId = t.config.id;
|
|
16551
16585
|
}
|
|
16552
16586
|
}
|
|
16587
|
+
const autoPreset = INSTRUMENT_PRESETS[currentInstrument] ?? INSTRUMENT_PRESETS.piano;
|
|
16588
|
+
for (const t of trackStates) {
|
|
16589
|
+
if (t.lyricModel) continue;
|
|
16590
|
+
const notes = t.core.getNotes();
|
|
16591
|
+
if (notes.length === 0) continue;
|
|
16592
|
+
const role = classifyTrackRole(notes);
|
|
16593
|
+
const instName = autoPreset[role];
|
|
16594
|
+
t.trackInstrument = instName;
|
|
16595
|
+
const trackIndex = trackStates.indexOf(t);
|
|
16596
|
+
options.onTrackInstrumentChange?.(trackIndex, instName);
|
|
16597
|
+
const vol = AUTO_ROLE_VOLUME[role];
|
|
16598
|
+
t.volume = vol;
|
|
16599
|
+
t.core.setVolume(vol);
|
|
16600
|
+
}
|
|
16553
16601
|
for (const t of trackStates) {
|
|
16554
16602
|
const isMainVocal = !!t.lyricModel && t.config.id === mainVocalId;
|
|
16555
16603
|
const comp = !t.lyricModel ? 35 : isMainVocal ? 30 : 25;
|
package/package.json
CHANGED