Skip to main content

CLI tool for working with the Mega Drive MIDI Interface (MDMI)

Project description

Mega Drive MIDI Interface CLI

PyPI PyPI - Python Version PyPI - License Build

CLI for controlling the Mega Drive MIDI Interface (MDMI). Helps you load presets from instrument files, clear presets, list WOPN instruments, and test connectivity.

Features

  • Load presets from instrument files:
    • DefleMask preset versions 8, 9 and 11
    • WOPN versions 1 and 2, as used by libOPNMIDI
    • TFI
  • Dump presets from MDMI to files (DMP or TFI format)
  • Dump FM channel parameters from MDMI to files (DMP or TFI format)
  • Clear presets. Individual user presets or all presets at once
  • List WOPN instruments
  • Connectivity testing: Ping/pong functionality to test MDMI connectivity

Installation

Latest version from PyPI:

pip install mdmi-cli

Usage

Load a preset

# Load TFI preset to program 0 (uses MDMI_MIDI_OUT if set)
mdmi load-preset example.tfi --program 0

# Load DMP preset to program 5 via specific MIDI port
mdmi load-preset example.dmp --program 5 --midi-out "IAC Driver Bus 1"

# Load specific WOPN instrument to program 10
mdmi load-preset soundbank.wopn --program 10 --bank 0 --instrument 5 --bank-type melody

# Test with fake interface (for development)
mdmi load-preset example.tfi --program 0 --dry-run

Dump presets

# Dump preset from program 5 to DMP file (uses MDMI_MIDI_OUT/IN if set)
mdmi dump-preset --program 5 --format dmp --filename my_preset.dmp

# Dump preset from program 10 to TFI file
mdmi dump-preset --program 10 --format tfi --filename my_preset.tfi

# Dump with auto-generated filename (preset_5.dmp)
mdmi dump-preset --program 5

# Test dump with fake interface
mdmi dump-preset --program 0 --dry-run

# Dump with custom timeout and specific ports
mdmi dump-preset --program 3 --timeout 10.0 --midi-out "IAC Driver Bus 1" --midi-in "IAC Driver Bus 2"

Dump FM channel parameters

# Dump FM channel parameters from MIDI channel 5 to DMP file
mdmi dump-channel --channel 5 --format dmp --filename channel_5.dmp

# Dump FM channel parameters from MIDI channel 3 to TFI file
mdmi dump-channel --channel 3 --format tfi --filename channel_3.tfi

# Dump with auto-generated filename (channel_05.dmp)
mdmi dump-channel --channel 5

# Test channel dump with fake interface
mdmi dump-channel --channel 0 --dry-run

# Dump with custom timeout and specific ports
mdmi dump-channel --channel 7 --timeout 10.0 --midi-out "IAC Driver Bus 1" --midi-in "IAC Driver Bus 2"

WOPN file management

# List contents of a WOPN file (first 10 instruments per bank)
mdmi list-wopn soundbank.wopn

# List all instruments in WOPN file
mdmi list-wopn soundbank.wopn --full

# Load percussion instrument from WOPN
mdmi load-preset soundbank.wopn --program 20 --bank 0 --instrument 3 --bank-type percussion

# Load from different melody bank
mdmi load-preset soundbank.wopn --program 15 --bank 1 --instrument 65 --bank-type melody

Clear presets

# Clear preset at program 5 (uses MDMI_MIDI_OUT if set)
mdmi clear-preset --program 5

# Clear all presets (with confirmation)
mdmi clear-all-presets

# Clear all presets (skip confirmation) with specific port
mdmi clear-all-presets --confirm --midi-out "IAC Driver Bus 1"

Test connectivity

# Test MDMI connectivity with ping/pong
mdmi ping

# Test with custom timeout
mdmi ping --timeout 10.0

# Test with specific ports
mdmi ping --midi-out "IAC Driver Bus 1" --midi-in "IAC Driver Bus 2"

List available MIDI ports

# List all available MIDI input and output ports
mdmi list-ports

Configuration

Environment Variables

  • MDMI_MIDI_OUT: Default MIDI output port name
  • MDMI_MIDI_IN: Default MIDI input port name
  • MDMI_MIDI_PORT: Legacy fallback for MIDI output port

Command-line Options

Most commands support:

  • --midi-out TEXT: MIDI output port name (overrides environment variables)

Commands with bidirectional communication (ping, dump-preset, dump-channel) also support:

  • --midi-in TEXT: MIDI input port name (overrides MDMI_MIDI_IN)

Development

Build

# Install cli (from source)
make install

# Run tests
make test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdmi_cli-0.6.0.tar.gz (29.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mdmi_cli-0.6.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file mdmi_cli-0.6.0.tar.gz.

File metadata

  • Download URL: mdmi_cli-0.6.0.tar.gz
  • Upload date:
  • Size: 29.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mdmi_cli-0.6.0.tar.gz
Algorithm Hash digest
SHA256 90939ec87b589c51775273bcf44cb556d8bb806e6f4416e26df11389c63ed511
MD5 ef912bafbeaaad1527f7dc3fe9dc5608
BLAKE2b-256 c8794a9d3085e24ec9c965f8ef16f96e4e02d4af9ef45e1df8ebde1987d4ee3e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdmi_cli-0.6.0.tar.gz:

Publisher: publish.yml on rhargreaves/mdmi-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mdmi_cli-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: mdmi_cli-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mdmi_cli-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f30f1d3b2138f72a3b35cb3036fecd609d0c0dd4fd816066b6322c027c8084a0
MD5 320bb5ef52b83f1c4c85a81131f76150
BLAKE2b-256 8ab926cd3e54d089b09c3db406a53b7698b9516524d676b9873e83d65d7cd305

See more details on using hashes here.

Provenance

The following attestation bundles were made for mdmi_cli-0.6.0-py3-none-any.whl:

Publisher: publish.yml on rhargreaves/mdmi-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page