Maestro - Midi Player Tool Kit for Unity Version 2.18.2
Loading...
Searching...
No Matches
MPTKWriter Authoring Workflow (Pro)

Build, import, edit, and export MIDI event streams from script.

MPTKWriter is the script-driven MIDI authoring API in Maestro MPTK. It lets you create and manipulate MIDI content as MPTKEvent lists, then export to MIDI files or reuse the generated content in playback workflows.

Note
MPTKWriter is available in Maestro Pro only.

Core Model

MPTKWriter manages:

  • sequence header values (MIDI file type, DTPQN, tempo),
  • event list storage (MPTK_MidiEvents),
  • timing maps (tempo and time-signature),
  • conversion between ticks and milliseconds,
  • export to NAudio MIDI objects and file outputs.

Typical Workflow

Common workflow:

Event Authoring API

MPTKWriter provides high-level creation helpers:

  • notes and note lifecycle (AddNote(), AddOff()),
  • chords from scale/library,
  • controller/program/pitch-wheel events,
  • tempo and time-signature meta events,
  • text/meta insertion.

Loading and Merging Content

You can:

  • load MIDI from OS file paths,
  • load from MidiDB,
  • import event lists and merge them at specific positions.

During imports, DTPQN conversion can be applied automatically. Re-run timing calculation after major edits/imports.

Timing Best Practices

Recommended:

  • use ticks for precise musical placement,
  • use conversion helpers when you must interface with milliseconds,
  • recalculate timing maps after changing tempo/signature or after large imports.

Export and Validation

Export options:

Validation/logging helpers:

See also
Maestro Pro Features
Workflows
MPTKEvent Concept and Data Model
MidiFilePlayer Pro Extensions
MidiPlayerTK.MPTKWriter