MML を中間言語に用いたピアノロール打ち込みモジュール
ピアノロール形式での編集
操作機能
開発中 / TBD
おんJ民が作っている
質問や相談はフォーラムで: 質問フォーラム
npm i @onjmin/dtm
import * as DTM from "@onjmin/dtm";
const mountTarget = document.getElementById("piano-roll");
if (!mountTarget) throw new Error("mount target not found");
const renderConfig = {
bars: 8,
stepsPerBar: 16,
keyCount: 49, // C1〜C5
pitchRangeStart: 0,
keyHeight: 15,
stepWidth: 10,
};
const pianoRoll = DTM.createPianoRoll(
{ mountTarget, width: 640, height: 360, config: renderConfig },
{
onMMLGenerated: (mml) => console.log(mml),
onNotesChanged: (notes) => console.log(notes),
},
);
pianoRoll.setVolume(80);
const DTM = await import("https://cdn.jsdelivr.net/npm/@onjmin/dtm/dist/index.min.mjs");
const wrapper = document.createElement("div");
document.body.append(wrapper);
const renderConfig = {
bars: 8,
stepsPerBar: 16,
keyCount: 49,
pitchRangeStart: 0,
keyHeight: 15,
stepWidth: 10,
};
const pianoRoll = DTM.createPianoRoll(
{ mountTarget: wrapper, width: 640, height: 360, config: renderConfig },
{
onMMLGenerated: (mml) => console.log(mml),
onNotesChanged: (notes) => console.log(notes),
},
);
pnpm run dev: http://localhost:40298 から動作確認可能npm i @kazuprog/mml-player などで MMLPlayer を別途インストールすることで、DTM の再生機能が利用可能になります。