@onjmin/dtm 0.1.46 → 0.1.47

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
@@ -1186,6 +1186,8 @@ type MMLNotePlacement = {
1186
1186
  startStep: number;
1187
1187
  pitch: number;
1188
1188
  durationSteps: number;
1189
+ /** v コマンドで指定されたベロシティ(0-127、既定100) */
1190
+ velocity: number;
1189
1191
  };
1190
1192
  /** 再生ビュー用の表示トークン(mountMmlPlayer のノート列ハイライトに使う) */
1191
1193
  type MMLDisplayToken = {
package/dist/index.d.ts CHANGED
@@ -1186,6 +1186,8 @@ type MMLNotePlacement = {
1186
1186
  startStep: number;
1187
1187
  pitch: number;
1188
1188
  durationSteps: number;
1189
+ /** v コマンドで指定されたベロシティ(0-127、既定100) */
1190
+ velocity: number;
1189
1191
  };
1190
1192
  /** 再生ビュー用の表示トークン(mountMmlPlayer のノート列ハイライトに使う) */
1191
1193
  type MMLDisplayToken = {
package/dist/index.js CHANGED
@@ -4482,6 +4482,7 @@ var parseMML = (mml, options = {}) => {
4482
4482
  let octave = 4;
4483
4483
  let currentStep = 0;
4484
4484
  let baseLength = 16;
4485
+ let velocity = 100;
4485
4486
  const contributors = /* @__PURE__ */ new Map();
4486
4487
  const recordContributor = () => {
4487
4488
  let set = contributors.get(trackIndex);
@@ -4502,6 +4503,7 @@ var parseMML = (mml, options = {}) => {
4502
4503
  octave = 4;
4503
4504
  currentStep = 0;
4504
4505
  baseLength = 16;
4506
+ velocity = 100;
4505
4507
  continue;
4506
4508
  }
4507
4509
  const body = part.replace(/\s+/g, "").toLowerCase();
@@ -4580,6 +4582,8 @@ var parseMML = (mml, options = {}) => {
4580
4582
  if (bpm === null) {
4581
4583
  bpm = clamp2(Number.parseInt(numStr, 10), 1, 255);
4582
4584
  }
4585
+ } else if (ch === "v" && numStr) {
4586
+ velocity = clamp2(Number.parseInt(numStr, 10), 0, 127);
4583
4587
  }
4584
4588
  pushTok("ctrl", currentStep, 0, tokStart);
4585
4589
  } else if (ch === "[") {
@@ -4625,7 +4629,8 @@ var parseMML = (mml, options = {}) => {
4625
4629
  trackIndex,
4626
4630
  startStep: currentStep,
4627
4631
  pitch: p,
4628
- durationSteps: Math.max(1, steps)
4632
+ durationSteps: Math.max(1, steps),
4633
+ velocity
4629
4634
  });
4630
4635
  }
4631
4636
  pushTok("chord", currentStep, Math.max(1, steps), tokStart);
@@ -4648,7 +4653,8 @@ var parseMML = (mml, options = {}) => {
4648
4653
  trackIndex,
4649
4654
  startStep: currentStep,
4650
4655
  pitch: midiPitch,
4651
- durationSteps: Math.max(1, steps)
4656
+ durationSteps: Math.max(1, steps),
4657
+ velocity
4652
4658
  });
4653
4659
  pushTok("note", currentStep, Math.max(1, steps), tokStart);
4654
4660
  currentStep += steps;
@@ -6570,7 +6576,7 @@ var mountMmlPlayer = (target, mml, options = {}) => {
6570
6576
  startStep: p.startStep,
6571
6577
  durationSteps: p.durationSteps,
6572
6578
  pitch: p.pitch,
6573
- velocity: 100
6579
+ velocity: p.velocity
6574
6580
  }));
6575
6581
  return { id: String(index), volume: trackVolume, notes };
6576
6582
  });
@@ -9059,7 +9065,8 @@ var mountDAW = (target, options = {}) => {
9059
9065
  const t = trackStates[p.trackIndex];
9060
9066
  if (!t) continue;
9061
9067
  t.core.addNote(p.startStep, p.pitch, {
9062
- noteLengthSteps: p.durationSteps
9068
+ noteLengthSteps: p.durationSteps,
9069
+ velocity: p.velocity
9063
9070
  });
9064
9071
  }
9065
9072
  if (parsedBpm) setBpm(parsedBpm);
@@ -9795,7 +9802,7 @@ var playMML = (mml, options = {}) => {
9795
9802
  startStep: p.startStep,
9796
9803
  durationSteps: p.durationSteps,
9797
9804
  pitch: p.pitch,
9798
- velocity: 100
9805
+ velocity: p.velocity
9799
9806
  }));
9800
9807
  return { id: String(index), volume: masterVolume, notes };
9801
9808
  });
package/dist/index.mjs CHANGED
@@ -4370,6 +4370,7 @@ var parseMML = (mml, options = {}) => {
4370
4370
  let octave = 4;
4371
4371
  let currentStep = 0;
4372
4372
  let baseLength = 16;
4373
+ let velocity = 100;
4373
4374
  const contributors = /* @__PURE__ */ new Map();
4374
4375
  const recordContributor = () => {
4375
4376
  let set = contributors.get(trackIndex);
@@ -4390,6 +4391,7 @@ var parseMML = (mml, options = {}) => {
4390
4391
  octave = 4;
4391
4392
  currentStep = 0;
4392
4393
  baseLength = 16;
4394
+ velocity = 100;
4393
4395
  continue;
4394
4396
  }
4395
4397
  const body = part.replace(/\s+/g, "").toLowerCase();
@@ -4468,6 +4470,8 @@ var parseMML = (mml, options = {}) => {
4468
4470
  if (bpm === null) {
4469
4471
  bpm = clamp2(Number.parseInt(numStr, 10), 1, 255);
4470
4472
  }
4473
+ } else if (ch === "v" && numStr) {
4474
+ velocity = clamp2(Number.parseInt(numStr, 10), 0, 127);
4471
4475
  }
4472
4476
  pushTok("ctrl", currentStep, 0, tokStart);
4473
4477
  } else if (ch === "[") {
@@ -4513,7 +4517,8 @@ var parseMML = (mml, options = {}) => {
4513
4517
  trackIndex,
4514
4518
  startStep: currentStep,
4515
4519
  pitch: p,
4516
- durationSteps: Math.max(1, steps)
4520
+ durationSteps: Math.max(1, steps),
4521
+ velocity
4517
4522
  });
4518
4523
  }
4519
4524
  pushTok("chord", currentStep, Math.max(1, steps), tokStart);
@@ -4536,7 +4541,8 @@ var parseMML = (mml, options = {}) => {
4536
4541
  trackIndex,
4537
4542
  startStep: currentStep,
4538
4543
  pitch: midiPitch,
4539
- durationSteps: Math.max(1, steps)
4544
+ durationSteps: Math.max(1, steps),
4545
+ velocity
4540
4546
  });
4541
4547
  pushTok("note", currentStep, Math.max(1, steps), tokStart);
4542
4548
  currentStep += steps;
@@ -6458,7 +6464,7 @@ var mountMmlPlayer = (target, mml, options = {}) => {
6458
6464
  startStep: p.startStep,
6459
6465
  durationSteps: p.durationSteps,
6460
6466
  pitch: p.pitch,
6461
- velocity: 100
6467
+ velocity: p.velocity
6462
6468
  }));
6463
6469
  return { id: String(index), volume: trackVolume, notes };
6464
6470
  });
@@ -8947,7 +8953,8 @@ var mountDAW = (target, options = {}) => {
8947
8953
  const t = trackStates[p.trackIndex];
8948
8954
  if (!t) continue;
8949
8955
  t.core.addNote(p.startStep, p.pitch, {
8950
- noteLengthSteps: p.durationSteps
8956
+ noteLengthSteps: p.durationSteps,
8957
+ velocity: p.velocity
8951
8958
  });
8952
8959
  }
8953
8960
  if (parsedBpm) setBpm(parsedBpm);
@@ -9683,7 +9690,7 @@ var playMML = (mml, options = {}) => {
9683
9690
  startStep: p.startStep,
9684
9691
  durationSteps: p.durationSteps,
9685
9692
  pitch: p.pitch,
9686
- velocity: 100
9693
+ velocity: p.velocity
9687
9694
  }));
9688
9695
  return { id: String(index), volume: masterVolume, notes };
9689
9696
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "onjmin",
3
3
  "license": "MIT",
4
4
  "name": "@onjmin/dtm",
5
- "version": "0.1.46",
5
+ "version": "0.1.47",
6
6
  "description": "MMLを中間言語に用いた、モバイルファーストなDAW / ピアノロール打ち込みコンポーネント",
7
7
  "homepage": "https://onjmin.github.io/dtm",
8
8
  "repository": {