midi file parsing with event-level granularity
Parses binary MIDI files into structured event objects (note-on, note-off, control change, tempo, time signature) by reading variable-length quantities and status bytes according to the MIDI 1.0 specification. Leverages Tone.js's MIDI parsing infrastructure to handle multiple tracks, timing divisions, and meta-events while preserving absolute and relative timing information for downstream manipulation.
Unique: Built on Tone.js's battle-tested MIDI parser rather than implementing from scratch, providing immediate compatibility with Tone.js synthesizers and effects while exposing parsed events via MCP protocol for LLM integration
vs alternatives: Tighter integration with Tone.js ecosystem than generic MIDI libraries, enabling direct synthesis of parsed events without intermediate format conversion
midi track isolation and filtering
Extracts and filters MIDI events by track index, channel, event type (note-on/off, CC, program change), or time range using in-memory array operations on the parsed event structure. Allows selective manipulation of multi-track MIDI files by creating new track subsets without modifying the original file, preserving timing relationships and metadata.
Unique: Operates on Tone.js-compatible event structures, allowing filtered results to be directly synthesized or re-exported without format conversion
vs alternatives: Simpler API than low-level MIDI libraries for common filtering tasks, but less performant than native C++ MIDI tools for large files
midi event creation and insertion
Constructs new MIDI events (note-on, note-off, control change, tempo, time signature) with specified parameters (pitch, velocity, duration, channel, timestamp) and inserts them into existing track structures at precise timing positions. Handles automatic delta-time recalculation when inserting events to maintain proper MIDI timing relationships and prevents timing conflicts through validation.
Unique: Integrates with Tone.js event model, allowing created events to be immediately synthesized or scheduled without intermediate serialization
vs alternatives: Higher-level API than raw MIDI byte manipulation, but less flexible than DAW scripting environments for complex musical transformations
midi file serialization and export
Converts in-memory MIDI event structures back into binary MIDI file format (.mid) by encoding events as status bytes, variable-length quantities, and delta-time values according to MIDI 1.0 specification. Handles track chunking, header generation with timing division metadata, and file I/O to produce valid, playable MIDI files that can be opened in any DAW or MIDI player.
Unique: Produces Tone.js-compatible MIDI files that can be immediately loaded back into Tone.js for playback or further manipulation, creating a closed-loop workflow
vs alternatives: Simpler API than low-level MIDI encoding libraries, but less control over binary optimization than hand-crafted MIDI writers
mcp protocol integration for midi operations
Exposes MIDI parsing, filtering, creation, and export capabilities as MCP tools that can be called by LLM agents and other MCP clients through standardized request/response protocol. Handles tool schema definition, parameter validation, error handling, and result serialization to enable natural language composition of MIDI workflows (e.g., 'extract the melody from this MIDI file and transpose it up a fifth').
Unique: Bridges Tone.js MIDI capabilities with MCP protocol, enabling LLM agents to reason about and manipulate music through natural language without requiring music theory knowledge
vs alternatives: First-class MCP integration vs. generic MIDI libraries that require custom wrapper code; enables LLM-driven workflows that would be difficult to orchestrate with traditional APIs
tempo and time signature extraction and modification
Identifies and extracts tempo (BPM) and time signature meta-events from MIDI files, exposing them as structured data with absolute timestamps. Supports insertion of new tempo/time signature changes at arbitrary positions, enabling tempo mapping, time signature analysis, and rhythmic transformation of MIDI compositions while preserving musical structure.
Unique: Extracts tempo/time signature as first-class data structures rather than opaque meta-events, enabling programmatic analysis and modification of rhythmic properties
vs alternatives: More accessible than raw MIDI meta-event parsing, but less feature-rich than dedicated music analysis libraries for complex rhythmic analysis
note pitch and velocity transformation
Applies transformations to note pitch (transposition, octave shifting, scale quantization) and velocity (scaling, randomization, humanization) across MIDI events using mathematical operations on note data. Supports batch transformations across entire tracks or filtered subsets, enabling algorithmic music generation, humanization, and harmonic manipulation without manual event iteration.
Unique: Operates on Tone.js note objects, enabling direct synthesis of transformed notes without re-serialization
vs alternatives: Higher-level API than raw MIDI byte manipulation, but less musically sophisticated than DAW plugins with music theory awareness