MOD tracker-style MIDI editor with XG support using ncurses in C
  • C 97.6%
  • Makefile 2.4%
Find a file
2026-07-19 23:34:38 +00:00
docs Add XG format documentation 2026-07-18 23:43:01 +00:00
src Fix build: declare cols in draw_pattern_view, remove CH_COLORS warnings 2026-07-19 23:34:38 +00:00
tests Add sample MIDI generator test 2026-07-18 23:52:50 +00:00
Makefile Fix all build errors: struct member accesses, pointer types, mvaddstr, undefined functions, add main.c, proper event allocation 2026-07-19 01:02:18 +00:00
README.md Add README.md with project documentation 2026-07-18 23:31:39 +00:00
UPLOAD_INSTRUCTIONS.md Add upload instructions documentation 2026-07-18 23:55:31 +00:00

MOD Tracker - XG MIDI Editor

A command-line MOD tracker-style MIDI editor with XG (Extended XG) support, built with ncurses in C.

Features

  • Tracker-style interface - Navigate events in a grid similar to tracker software
  • Multi-track editing - Edit events across multiple MIDI channels
  • XG Extended support - Parse and edit XG++ extended instruments and effects
  • Real-time playback - Preview your edits as you work
  • Keyboard navigation - Full keyboard control for efficient editing
  • Event manipulation - Add, delete, duplicate, and modify MIDI events

Building

make

Or build with debug symbols:

make debug

Usage

./mod-tracker <midi_file>

Keyboard Controls

Navigation

  • / - Move to previous/next event
  • / - Switch MIDI channels
  • F1 - Edit delta time
  • F2 - Edit status byte
  • F3 - Edit data1
  • F4 - Edit data2
  • e - Toggle edit mode for status byte

Editing

  • 1 - Edit delta time (numeric)
  • 2 - Edit status byte (numeric)
  • 3 - Edit data1 (numeric)
  • 4 - Edit data2 (numeric)
  • Enter - Enter edit mode for current field

Event Actions

  • k / K - Delete current event
  • c / C - Duplicate current event
  • i / I - Select XG instrument
  • x - Toggle XG extended mode

Playback

  • p / P - Play/stop playback

Quit

  • q / Q - Quit editor
  • Esc - Quit editor

Supported MIDI Features

Standard MIDI

  • Delta time editing
  • Status byte editing (note on/off, control change, etc.)
  • Data bytes editing (note number, velocity, controller values)
  • Multi-track support
  • Event search and navigation

XG Extended Instruments

  • Global ID parsing
  • Instrument ID mapping
  • Effect parameters (16-bit values)
  • Parameter values (16-bit values)
  • Extended effect headers
  • Extended parameter headers

XG Effects

  • Delay and rate settings
  • Effect type parsing
  • Variable-length effect arrays
  • Effect value editing

Project Structure

mod-editor/
├── src/
│   ├── midi.h      # MIDI parser header
│   ├── midi.c      # MIDI parser implementation
│   ├── ui.h        # UI header
│   └── ui.c        # ncurses UI implementation
├── tests/          # Test cases
├── docs/           # Documentation
├── Makefile        # Build configuration
└── README.md       # This file

Technical Details

MIDI File Format

The parser supports:

  • MIDI version 0-3
  • Division types (0-3)
  • Standard MIDI tracks
  • Chunk-based structure

Event Storage

  • Maximum events: 100,000
  • Maximum tracks: 128
  • Event structure: delta_time, status, data1, data2

XG Extended Support

The editor can handle:

  • Extended instrument headers
  • Effect arrays (up to 128 entries)
  • Parameter arrays (up to 128 entries)
  • Global ID and instrument ID mapping

ncurses UI

  • Full-screen ncurses interface
  • Attribute support (bold, reverse, etc.)
  • Keyboard event handling
  • Scrollable event display
  • Status bar for feedback

Limitations

  • Maximum events per file: 100,000
  • Maximum tracks: 128
  • Maximum XG instruments: 64
  • No undo/redo support yet
  • No visual waveform display
  • Limited XG effect types supported

Future Enhancements

  • Undo/redo functionality
  • Visual waveform display
  • More XG effect types
  • Sample-based editing
  • Pattern-based navigation
  • Batch operations
  • Import/export formats
  • Multi-track mixing
  • Automation curves
  • Piano roll editor

Examples

Basic Usage

# Open a MIDI file
./mod-tracker song.mid

# Navigate events with arrow keys
# Edit data with F1-F4
# Toggle playback with 'p'
# Quit with 'q'

XG Instrument Editing

# Load XG file
./mod-tracker xg_song.mid

# Select instrument with 'i'
# Navigate to effects/params
# Edit values with F1-F4

License

MIT License - feel free to modify and distribute.

Credits

  • Built with ncurses for terminal UI
  • MIDI parsing based on standard MIDI format
  • XG support for Extended XG instruments
  • Design inspired by tracker software

Author

Lucky Robitz - Created for fun and utility

Contact

For issues or suggestions, please open an issue or submit a pull request.

Dependencies

  • GCC (GNU Compiler Collection)
  • ncurses library
  • Standard POSIX utilities

Quick Build & Test

# Build
make

# Run with sample (if available)
make run

Happy editing! 🐱