@onjmin/dtm 1.0.2 → 1.0.4

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.d.mts CHANGED
@@ -2086,6 +2086,8 @@ type SoundFontInstance = {
2086
2086
  destination: AudioNode;
2087
2087
  pitch: number;
2088
2088
  volume: number;
2089
+ /** 元ノートのvelocity(0-127)。音量ではなく音色の明るさにだけ効く。 */
2090
+ velocity?: number;
2089
2091
  when: number;
2090
2092
  duration: number;
2091
2093
  }) => void;
package/dist/index.d.ts CHANGED
@@ -2086,6 +2086,8 @@ type SoundFontInstance = {
2086
2086
  destination: AudioNode;
2087
2087
  pitch: number;
2088
2088
  volume: number;
2089
+ /** 元ノートのvelocity(0-127)。音量ではなく音色の明るさにだけ効く。 */
2090
+ velocity?: number;
2089
2091
  when: number;
2090
2092
  duration: number;
2091
2093
  }) => void;
package/dist/index.js CHANGED
@@ -8850,8 +8850,8 @@ var mountMmlPlayer = (target, mml, options = {}) => {
8850
8850
  ...normalizeDrumPatterns(options.drumPatterns ?? {})
8851
8851
  };
8852
8852
  const drumPatternName = meta.drum ?? "none";
8853
- const trackVolume = meta.volume ?? options.volume ?? 100;
8854
- let masterVolume = options.masterVolume ?? 50;
8853
+ const trackVolume = options.volume ?? 100;
8854
+ let masterVolume = meta.volume ?? options.masterVolume ?? 50;
8855
8855
  const drumVolume = meta.drumVolume ?? 80;
8856
8856
  const colors = options.trackColors ?? DEFAULT_TRACK_COLORS;
8857
8857
  const useSynth = options.synth ?? !options.onPlayNote;
@@ -9157,6 +9157,9 @@ var mountMmlPlayer = (target, mml, options = {}) => {
9157
9157
  singingVoices: options.singingVoices,
9158
9158
  drumPatterns: options.drumPatterns,
9159
9159
  volume: trackVolume,
9160
+ // 解説モーダル内の試聴サンプルも親と同じマスタ音量で鳴らす
9161
+ // (サンプル側のMMLに `#volume=` があればそちらが優先される)。
9162
+ masterVolume,
9160
9163
  // 解説モーダル内の試聴サンプルは規約同意を要求しない。
9161
9164
  skipConsent: true,
9162
9165
  // 再帰的なモーダル生成を防ぐ。
@@ -9924,14 +9927,23 @@ var SoundFont = class _SoundFont {
9924
9927
  /** 発音ごとの音量微揺らぎ幅(比率、0.06 = ±6%の範囲で一様乱数)。 */
9925
9928
  static humanizeGainRatio = 0.06;
9926
9929
  // ── ベロシティ→明るさ連動フィルタ ──
9927
- // volume は音量にしか効かず音色(明るさ)が変わらないのを補うため、
9928
- // ローパスのカットオフを volume に連動させる(弱いほど丸く、強いほど明るく)。
9929
- /** volume=0 のときのローパスカットオフ(Hz)。 */
9930
- static brightnessMinHz = 1200;
9931
- /** volume=1 のときのローパスカットオフ(Hz)。サンプルの帯域を実質塞がない値。 */
9932
- static brightnessMaxHz = 18e3;
9930
+ // velocity は音量にしか効かず音色(明るさ)が変わらないのを補うため、
9931
+ // ローパスのカットオフを velocity に連動させる(弱いほど丸く、強いほど明るく)。
9932
+ // 連動元は必ず velocity であって volume ではない。volume には
9933
+ // 「トラック音量フェーダー×velocity」が既に畳み込まれている(sequencer.ts参照)ため、
9934
+ // volume を使うとフェーダーを下げただけで音色まで暗くなり、音量がゲインと音色へ
9935
+ // 二重に効いてしまう。音量フェーダーは音色を変えてはならない。
9936
+ /** velocity=0 のときのローパスカットオフ(Hz)。 */
9937
+ static brightnessMinHz = 2400;
9938
+ /** velocity=127 のときのローパスカットオフ(Hz)。サンプルの帯域を実質塞がない値。 */
9939
+ static brightnessMaxHz = 2e4;
9933
9940
  /** ベロシティ→明るさフィルタのQ値。共鳴が付かないButterworth特性。 */
9934
9941
  static brightnessQ = Math.SQRT1_2;
9942
+ /**
9943
+ * この明るさ比率以上ならフィルタ自体を挿入しない。最強ベロシティの音は改修前と
9944
+ * 完全に同一の信号経路を通り、余計な音痩せや位相変化が起きないようにするため。
9945
+ */
9946
+ static brightnessBypassAbove = 0.98;
9935
9947
  // ── ロングトーン用ビブラート(ピッチLFO) ──
9936
9948
  // 伸ばす音が完全に静止していると不自然に聞こえるため、一定長以上持続する
9937
9949
  // 音符にだけ、発音直後フェードインしつつ穏やかなピッチ揺れを掛ける。
@@ -9986,6 +9998,7 @@ var SoundFont = class _SoundFont {
9986
9998
  destination,
9987
9999
  pitch = 60,
9988
10000
  volume = 1,
10001
+ velocity,
9989
10002
  when = 0,
9990
10003
  duration = 1
9991
10004
  } = {}) {
@@ -9996,7 +10009,6 @@ var SoundFont = class _SoundFont {
9996
10009
  const zone = zones.get(pitch);
9997
10010
  if (!zone) return;
9998
10011
  const src = ctx.createBufferSource();
9999
- const filter = ctx.createBiquadFilter();
10000
10012
  const g = ctx.createGain();
10001
10013
  const _when = when + ctx.currentTime;
10002
10014
  const { buffer, _param } = zone;
@@ -10008,13 +10020,16 @@ var SoundFont = class _SoundFont {
10008
10020
  const humanizeGainMul = 1 + (Math.random() * 2 - 1) * _SoundFont.humanizeGainRatio;
10009
10021
  src.detune.setValueAtTime(humanizeCents, 0);
10010
10022
  const effectiveVolume = volume * humanizeGainMul;
10011
- filter.type = "lowpass";
10012
- const brightness = Math.max(0, Math.min(1, volume));
10013
- filter.frequency.setValueAtTime(
10014
- _SoundFont.brightnessMinHz + (_SoundFont.brightnessMaxHz - _SoundFont.brightnessMinHz) * brightness,
10015
- 0
10016
- );
10017
- filter.Q.setValueAtTime(_SoundFont.brightnessQ, 0);
10023
+ const brightness = velocity === void 0 ? 1 : Math.max(0, Math.min(1, velocity / 127));
10024
+ const filter = brightness >= _SoundFont.brightnessBypassAbove ? void 0 : ctx.createBiquadFilter();
10025
+ if (filter) {
10026
+ filter.type = "lowpass";
10027
+ filter.frequency.setValueAtTime(
10028
+ _SoundFont.brightnessMinHz + (_SoundFont.brightnessMaxHz - _SoundFont.brightnessMinHz) * brightness,
10029
+ 0
10030
+ );
10031
+ filter.Q.setValueAtTime(_SoundFont.brightnessQ, 0);
10032
+ }
10018
10033
  g.gain.setValueAtTime(0, ctx.currentTime);
10019
10034
  const attackTime = 5e-3;
10020
10035
  const startGainTime = Math.max(ctx.currentTime, _when);
@@ -10026,7 +10041,9 @@ var SoundFont = class _SoundFont {
10026
10041
  g.gain.setValueAtTime(effectiveVolume, startGainTime + attackTime);
10027
10042
  g.gain.linearRampToValueAtTime(0, end);
10028
10043
  }
10029
- src.connect(filter).connect(g).connect(destination);
10044
+ if (filter) src.connect(filter).connect(g);
10045
+ else src.connect(g);
10046
+ g.connect(destination);
10030
10047
  let vibratoOsc;
10031
10048
  let vibratoDepth;
10032
10049
  if (!isDrum && duration >= _SoundFont.longToneThresholdSec) {
@@ -10047,7 +10064,7 @@ var SoundFont = class _SoundFont {
10047
10064
  src.stop(end);
10048
10065
  src.onended = () => {
10049
10066
  src.disconnect();
10050
- filter.disconnect();
10067
+ filter?.disconnect();
10051
10068
  g.disconnect();
10052
10069
  vibratoOsc?.disconnect();
10053
10070
  vibratoDepth?.disconnect();
@@ -11141,6 +11158,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
11141
11158
  };
11142
11159
  const wafPlayDynamic = ({
11143
11160
  pitch,
11161
+ velocity,
11144
11162
  volume,
11145
11163
  when,
11146
11164
  duration,
@@ -11154,6 +11172,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
11154
11172
  destination,
11155
11173
  pitch,
11156
11174
  volume: volume * 0.85,
11175
+ velocity,
11157
11176
  when,
11158
11177
  duration
11159
11178
  });
@@ -19339,6 +19358,30 @@ var createDtmStudio = async (options = {}) => {
19339
19358
  }
19340
19359
  return strip;
19341
19360
  };
19361
+ const createTrackStripApplier = (meta) => {
19362
+ const applied = /* @__PURE__ */ new Set();
19363
+ return (stripId, trackIdx) => {
19364
+ if (applied.has(stripId)) return;
19365
+ applied.add(stripId);
19366
+ const strip = getChannelStrip(stripId);
19367
+ const comp = meta.trackCompression?.[trackIdx];
19368
+ if (comp !== void 0) strip.setCompression(comp);
19369
+ const width = meta.trackWidth?.[trackIdx];
19370
+ if (width !== void 0) strip.setWidth(width);
19371
+ const eqLow = meta.trackEqLow?.[trackIdx];
19372
+ if (eqLow !== void 0) strip.setEqLow(eqLow);
19373
+ const eqMid = meta.trackEqMid?.[trackIdx];
19374
+ if (eqMid !== void 0) strip.setEqMid(eqMid);
19375
+ const eqHigh = meta.trackEqHigh?.[trackIdx];
19376
+ if (eqHigh !== void 0) strip.setEqHigh(eqHigh);
19377
+ const reverbSend = meta.trackReverbSend?.[trackIdx];
19378
+ if (reverbSend !== void 0) strip.setReverbSend(reverbSend);
19379
+ const delaySend = meta.trackDelaySend?.[trackIdx];
19380
+ if (delaySend !== void 0) strip.setDelaySend(delaySend);
19381
+ const pan = meta.trackPan?.[trackIdx];
19382
+ if (pan !== void 0) strip.setPan(panToStereo(pan));
19383
+ };
19384
+ };
19342
19385
  const resumeAudio = () => {
19343
19386
  if (audioCtx.state === "closed") return Promise.resolve();
19344
19387
  return audioCtx.resume();
@@ -19612,6 +19655,7 @@ var createDtmStudio = async (options = {}) => {
19612
19655
  destination: getChannelStrip(e.trackId).input,
19613
19656
  pitch: e.pitch,
19614
19657
  volume: e.volume,
19658
+ velocity: e.velocity,
19615
19659
  when: e.when,
19616
19660
  duration: e.duration
19617
19661
  });
@@ -19905,8 +19949,10 @@ var createDtmStudio = async (options = {}) => {
19905
19949
  ),
19906
19950
  loadPlayerTrackInstruments()
19907
19951
  ]);
19952
+ const applyTrackStrip = createTrackStripApplier(meta);
19908
19953
  const playPlayerNote = (e) => {
19909
19954
  const idx = Number(e.trackId);
19955
+ applyTrackStrip(e.trackId, idx);
19910
19956
  const overrideKey = playerTrackInstKeys.get(idx);
19911
19957
  let sfInst;
19912
19958
  if (overrideKey) {
@@ -19928,6 +19974,7 @@ var createDtmStudio = async (options = {}) => {
19928
19974
  destination: getChannelStrip(e.trackId).input,
19929
19975
  pitch: e.pitch,
19930
19976
  volume: e.volume,
19977
+ velocity: e.velocity,
19931
19978
  when: e.when,
19932
19979
  duration: e.duration
19933
19980
  });
@@ -19991,8 +20038,10 @@ var createDtmStudio = async (options = {}) => {
19991
20038
  ),
19992
20039
  loadPlayerTrackInstruments()
19993
20040
  ]);
20041
+ const applyTrackStrip = createTrackStripApplier(meta);
19994
20042
  const playPlayerNote = (e) => {
19995
- const { trackIdx, role } = resolveTrackIdxAndRole(e.trackId);
20043
+ const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
20044
+ applyTrackStrip(e.trackId, trackIdx);
19996
20045
  const overrideKey = playerTrackInstKeys.get(trackIdx);
19997
20046
  let sfInst;
19998
20047
  if (overrideKey) {
@@ -20014,6 +20063,7 @@ var createDtmStudio = async (options = {}) => {
20014
20063
  destination: getChannelStrip(e.trackId).input,
20015
20064
  pitch: e.pitch,
20016
20065
  volume: e.volume,
20066
+ velocity: e.velocity,
20017
20067
  when: e.when,
20018
20068
  duration: e.duration
20019
20069
  });
@@ -20070,8 +20120,10 @@ var createDtmStudio = async (options = {}) => {
20070
20120
  ),
20071
20121
  loadPlayerTrackInstruments()
20072
20122
  ]);
20123
+ const applyTrackStrip = createTrackStripApplier(meta);
20073
20124
  const playPlayerNote = (e) => {
20074
- const { trackIdx, role } = resolveTrackIdxAndRole(e.trackId);
20125
+ const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
20126
+ applyTrackStrip(e.trackId, trackIdx);
20075
20127
  const overrideKey = playerTrackInstKeys.get(trackIdx);
20076
20128
  let sfInst;
20077
20129
  if (overrideKey) {
@@ -20093,6 +20145,7 @@ var createDtmStudio = async (options = {}) => {
20093
20145
  destination: getChannelStrip(e.trackId).input,
20094
20146
  pitch: e.pitch,
20095
20147
  volume: e.volume,
20148
+ velocity: e.velocity,
20096
20149
  when: e.when,
20097
20150
  duration: e.duration
20098
20151
  });
@@ -20132,6 +20185,7 @@ var createDtmStudio = async (options = {}) => {
20132
20185
  destination: getChannelStrip(e.trackId).input,
20133
20186
  pitch: e.pitch,
20134
20187
  volume: e.volume,
20188
+ velocity: e.velocity,
20135
20189
  when: e.when,
20136
20190
  duration: e.duration
20137
20191
  });
@@ -20188,6 +20242,7 @@ var createDtmStudio = async (options = {}) => {
20188
20242
  destination: getChannelStrip("chord").input,
20189
20243
  pitch: e.pitch,
20190
20244
  volume: e.volume,
20245
+ velocity: e.velocity,
20191
20246
  when: e.when,
20192
20247
  duration: e.duration
20193
20248
  });
package/dist/index.mjs CHANGED
@@ -8717,8 +8717,8 @@ var mountMmlPlayer = (target, mml, options = {}) => {
8717
8717
  ...normalizeDrumPatterns(options.drumPatterns ?? {})
8718
8718
  };
8719
8719
  const drumPatternName = meta.drum ?? "none";
8720
- const trackVolume = meta.volume ?? options.volume ?? 100;
8721
- let masterVolume = options.masterVolume ?? 50;
8720
+ const trackVolume = options.volume ?? 100;
8721
+ let masterVolume = meta.volume ?? options.masterVolume ?? 50;
8722
8722
  const drumVolume = meta.drumVolume ?? 80;
8723
8723
  const colors = options.trackColors ?? DEFAULT_TRACK_COLORS;
8724
8724
  const useSynth = options.synth ?? !options.onPlayNote;
@@ -9024,6 +9024,9 @@ var mountMmlPlayer = (target, mml, options = {}) => {
9024
9024
  singingVoices: options.singingVoices,
9025
9025
  drumPatterns: options.drumPatterns,
9026
9026
  volume: trackVolume,
9027
+ // 解説モーダル内の試聴サンプルも親と同じマスタ音量で鳴らす
9028
+ // (サンプル側のMMLに `#volume=` があればそちらが優先される)。
9029
+ masterVolume,
9027
9030
  // 解説モーダル内の試聴サンプルは規約同意を要求しない。
9028
9031
  skipConsent: true,
9029
9032
  // 再帰的なモーダル生成を防ぐ。
@@ -9791,14 +9794,23 @@ var SoundFont = class _SoundFont {
9791
9794
  /** 発音ごとの音量微揺らぎ幅(比率、0.06 = ±6%の範囲で一様乱数)。 */
9792
9795
  static humanizeGainRatio = 0.06;
9793
9796
  // ── ベロシティ→明るさ連動フィルタ ──
9794
- // volume は音量にしか効かず音色(明るさ)が変わらないのを補うため、
9795
- // ローパスのカットオフを volume に連動させる(弱いほど丸く、強いほど明るく)。
9796
- /** volume=0 のときのローパスカットオフ(Hz)。 */
9797
- static brightnessMinHz = 1200;
9798
- /** volume=1 のときのローパスカットオフ(Hz)。サンプルの帯域を実質塞がない値。 */
9799
- static brightnessMaxHz = 18e3;
9797
+ // velocity は音量にしか効かず音色(明るさ)が変わらないのを補うため、
9798
+ // ローパスのカットオフを velocity に連動させる(弱いほど丸く、強いほど明るく)。
9799
+ // 連動元は必ず velocity であって volume ではない。volume には
9800
+ // 「トラック音量フェーダー×velocity」が既に畳み込まれている(sequencer.ts参照)ため、
9801
+ // volume を使うとフェーダーを下げただけで音色まで暗くなり、音量がゲインと音色へ
9802
+ // 二重に効いてしまう。音量フェーダーは音色を変えてはならない。
9803
+ /** velocity=0 のときのローパスカットオフ(Hz)。 */
9804
+ static brightnessMinHz = 2400;
9805
+ /** velocity=127 のときのローパスカットオフ(Hz)。サンプルの帯域を実質塞がない値。 */
9806
+ static brightnessMaxHz = 2e4;
9800
9807
  /** ベロシティ→明るさフィルタのQ値。共鳴が付かないButterworth特性。 */
9801
9808
  static brightnessQ = Math.SQRT1_2;
9809
+ /**
9810
+ * この明るさ比率以上ならフィルタ自体を挿入しない。最強ベロシティの音は改修前と
9811
+ * 完全に同一の信号経路を通り、余計な音痩せや位相変化が起きないようにするため。
9812
+ */
9813
+ static brightnessBypassAbove = 0.98;
9802
9814
  // ── ロングトーン用ビブラート(ピッチLFO) ──
9803
9815
  // 伸ばす音が完全に静止していると不自然に聞こえるため、一定長以上持続する
9804
9816
  // 音符にだけ、発音直後フェードインしつつ穏やかなピッチ揺れを掛ける。
@@ -9853,6 +9865,7 @@ var SoundFont = class _SoundFont {
9853
9865
  destination,
9854
9866
  pitch = 60,
9855
9867
  volume = 1,
9868
+ velocity,
9856
9869
  when = 0,
9857
9870
  duration = 1
9858
9871
  } = {}) {
@@ -9863,7 +9876,6 @@ var SoundFont = class _SoundFont {
9863
9876
  const zone = zones.get(pitch);
9864
9877
  if (!zone) return;
9865
9878
  const src = ctx.createBufferSource();
9866
- const filter = ctx.createBiquadFilter();
9867
9879
  const g = ctx.createGain();
9868
9880
  const _when = when + ctx.currentTime;
9869
9881
  const { buffer, _param } = zone;
@@ -9875,13 +9887,16 @@ var SoundFont = class _SoundFont {
9875
9887
  const humanizeGainMul = 1 + (Math.random() * 2 - 1) * _SoundFont.humanizeGainRatio;
9876
9888
  src.detune.setValueAtTime(humanizeCents, 0);
9877
9889
  const effectiveVolume = volume * humanizeGainMul;
9878
- filter.type = "lowpass";
9879
- const brightness = Math.max(0, Math.min(1, volume));
9880
- filter.frequency.setValueAtTime(
9881
- _SoundFont.brightnessMinHz + (_SoundFont.brightnessMaxHz - _SoundFont.brightnessMinHz) * brightness,
9882
- 0
9883
- );
9884
- filter.Q.setValueAtTime(_SoundFont.brightnessQ, 0);
9890
+ const brightness = velocity === void 0 ? 1 : Math.max(0, Math.min(1, velocity / 127));
9891
+ const filter = brightness >= _SoundFont.brightnessBypassAbove ? void 0 : ctx.createBiquadFilter();
9892
+ if (filter) {
9893
+ filter.type = "lowpass";
9894
+ filter.frequency.setValueAtTime(
9895
+ _SoundFont.brightnessMinHz + (_SoundFont.brightnessMaxHz - _SoundFont.brightnessMinHz) * brightness,
9896
+ 0
9897
+ );
9898
+ filter.Q.setValueAtTime(_SoundFont.brightnessQ, 0);
9899
+ }
9885
9900
  g.gain.setValueAtTime(0, ctx.currentTime);
9886
9901
  const attackTime = 5e-3;
9887
9902
  const startGainTime = Math.max(ctx.currentTime, _when);
@@ -9893,7 +9908,9 @@ var SoundFont = class _SoundFont {
9893
9908
  g.gain.setValueAtTime(effectiveVolume, startGainTime + attackTime);
9894
9909
  g.gain.linearRampToValueAtTime(0, end);
9895
9910
  }
9896
- src.connect(filter).connect(g).connect(destination);
9911
+ if (filter) src.connect(filter).connect(g);
9912
+ else src.connect(g);
9913
+ g.connect(destination);
9897
9914
  let vibratoOsc;
9898
9915
  let vibratoDepth;
9899
9916
  if (!isDrum && duration >= _SoundFont.longToneThresholdSec) {
@@ -9914,7 +9931,7 @@ var SoundFont = class _SoundFont {
9914
9931
  src.stop(end);
9915
9932
  src.onended = () => {
9916
9933
  src.disconnect();
9917
- filter.disconnect();
9934
+ filter?.disconnect();
9918
9935
  g.disconnect();
9919
9936
  vibratoOsc?.disconnect();
9920
9937
  vibratoDepth?.disconnect();
@@ -11008,6 +11025,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
11008
11025
  };
11009
11026
  const wafPlayDynamic = ({
11010
11027
  pitch,
11028
+ velocity,
11011
11029
  volume,
11012
11030
  when,
11013
11031
  duration,
@@ -11021,6 +11039,7 @@ var mountChordPlayer = (target, chords, options = {}) => {
11021
11039
  destination,
11022
11040
  pitch,
11023
11041
  volume: volume * 0.85,
11042
+ velocity,
11024
11043
  when,
11025
11044
  duration
11026
11045
  });
@@ -19205,6 +19224,30 @@ var createDtmStudio = async (options = {}) => {
19205
19224
  }
19206
19225
  return strip;
19207
19226
  };
19227
+ const createTrackStripApplier = (meta) => {
19228
+ const applied = /* @__PURE__ */ new Set();
19229
+ return (stripId, trackIdx) => {
19230
+ if (applied.has(stripId)) return;
19231
+ applied.add(stripId);
19232
+ const strip = getChannelStrip(stripId);
19233
+ const comp = meta.trackCompression?.[trackIdx];
19234
+ if (comp !== void 0) strip.setCompression(comp);
19235
+ const width = meta.trackWidth?.[trackIdx];
19236
+ if (width !== void 0) strip.setWidth(width);
19237
+ const eqLow = meta.trackEqLow?.[trackIdx];
19238
+ if (eqLow !== void 0) strip.setEqLow(eqLow);
19239
+ const eqMid = meta.trackEqMid?.[trackIdx];
19240
+ if (eqMid !== void 0) strip.setEqMid(eqMid);
19241
+ const eqHigh = meta.trackEqHigh?.[trackIdx];
19242
+ if (eqHigh !== void 0) strip.setEqHigh(eqHigh);
19243
+ const reverbSend = meta.trackReverbSend?.[trackIdx];
19244
+ if (reverbSend !== void 0) strip.setReverbSend(reverbSend);
19245
+ const delaySend = meta.trackDelaySend?.[trackIdx];
19246
+ if (delaySend !== void 0) strip.setDelaySend(delaySend);
19247
+ const pan = meta.trackPan?.[trackIdx];
19248
+ if (pan !== void 0) strip.setPan(panToStereo(pan));
19249
+ };
19250
+ };
19208
19251
  const resumeAudio = () => {
19209
19252
  if (audioCtx.state === "closed") return Promise.resolve();
19210
19253
  return audioCtx.resume();
@@ -19478,6 +19521,7 @@ var createDtmStudio = async (options = {}) => {
19478
19521
  destination: getChannelStrip(e.trackId).input,
19479
19522
  pitch: e.pitch,
19480
19523
  volume: e.volume,
19524
+ velocity: e.velocity,
19481
19525
  when: e.when,
19482
19526
  duration: e.duration
19483
19527
  });
@@ -19771,8 +19815,10 @@ var createDtmStudio = async (options = {}) => {
19771
19815
  ),
19772
19816
  loadPlayerTrackInstruments()
19773
19817
  ]);
19818
+ const applyTrackStrip = createTrackStripApplier(meta);
19774
19819
  const playPlayerNote = (e) => {
19775
19820
  const idx = Number(e.trackId);
19821
+ applyTrackStrip(e.trackId, idx);
19776
19822
  const overrideKey = playerTrackInstKeys.get(idx);
19777
19823
  let sfInst;
19778
19824
  if (overrideKey) {
@@ -19794,6 +19840,7 @@ var createDtmStudio = async (options = {}) => {
19794
19840
  destination: getChannelStrip(e.trackId).input,
19795
19841
  pitch: e.pitch,
19796
19842
  volume: e.volume,
19843
+ velocity: e.velocity,
19797
19844
  when: e.when,
19798
19845
  duration: e.duration
19799
19846
  });
@@ -19857,8 +19904,10 @@ var createDtmStudio = async (options = {}) => {
19857
19904
  ),
19858
19905
  loadPlayerTrackInstruments()
19859
19906
  ]);
19907
+ const applyTrackStrip = createTrackStripApplier(meta);
19860
19908
  const playPlayerNote = (e) => {
19861
- const { trackIdx, role } = resolveTrackIdxAndRole(e.trackId);
19909
+ const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
19910
+ applyTrackStrip(e.trackId, trackIdx);
19862
19911
  const overrideKey = playerTrackInstKeys.get(trackIdx);
19863
19912
  let sfInst;
19864
19913
  if (overrideKey) {
@@ -19880,6 +19929,7 @@ var createDtmStudio = async (options = {}) => {
19880
19929
  destination: getChannelStrip(e.trackId).input,
19881
19930
  pitch: e.pitch,
19882
19931
  volume: e.volume,
19932
+ velocity: e.velocity,
19883
19933
  when: e.when,
19884
19934
  duration: e.duration
19885
19935
  });
@@ -19936,8 +19986,10 @@ var createDtmStudio = async (options = {}) => {
19936
19986
  ),
19937
19987
  loadPlayerTrackInstruments()
19938
19988
  ]);
19989
+ const applyTrackStrip = createTrackStripApplier(meta);
19939
19990
  const playPlayerNote = (e) => {
19940
- const { trackIdx, role } = resolveTrackIdxAndRole(e.trackId);
19991
+ const { trackIdx } = resolveTrackIdxAndRole(e.trackId);
19992
+ applyTrackStrip(e.trackId, trackIdx);
19941
19993
  const overrideKey = playerTrackInstKeys.get(trackIdx);
19942
19994
  let sfInst;
19943
19995
  if (overrideKey) {
@@ -19959,6 +20011,7 @@ var createDtmStudio = async (options = {}) => {
19959
20011
  destination: getChannelStrip(e.trackId).input,
19960
20012
  pitch: e.pitch,
19961
20013
  volume: e.volume,
20014
+ velocity: e.velocity,
19962
20015
  when: e.when,
19963
20016
  duration: e.duration
19964
20017
  });
@@ -19998,6 +20051,7 @@ var createDtmStudio = async (options = {}) => {
19998
20051
  destination: getChannelStrip(e.trackId).input,
19999
20052
  pitch: e.pitch,
20000
20053
  volume: e.volume,
20054
+ velocity: e.velocity,
20001
20055
  when: e.when,
20002
20056
  duration: e.duration
20003
20057
  });
@@ -20054,6 +20108,7 @@ var createDtmStudio = async (options = {}) => {
20054
20108
  destination: getChannelStrip("chord").input,
20055
20109
  pitch: e.pitch,
20056
20110
  volume: e.volume,
20111
+ velocity: e.velocity,
20057
20112
  when: e.when,
20058
20113
  duration: e.duration
20059
20114
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "onjmin",
3
3
  "license": "MIT",
4
4
  "name": "@onjmin/dtm",
5
- "version": "1.0.2",
5
+ "version": "1.0.4",
6
6
  "description": "MMLを中間言語に用いた、モバイルファーストなDAW / ピアノロール打ち込みコンポーネント",
7
7
  "homepage": "https://onjmin.github.io/dtm",
8
8
  "repository": {