New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

mdmi-cli

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdmi-cli - pypi Package Compare versions

Comparing version
0.4.0
to
0.4.1
+54
-103
mdmi_cli.egg-info/PKG-INFO
Metadata-Version: 2.4
Name: mdmi-cli
Version: 0.4.0
Version: 0.4.1
Summary: CLI tool for working with the Mega Drive MIDI Interface (MDMI)

@@ -40,17 +40,18 @@ Author: rhargreaves

Python CLI for controlling the Mega Drive MIDI Interface (MDMI). Supports loading presets in WOPN, DMP, and TFI formats with instrument selection for WOPN files.
CLI for controlling the [Mega Drive MIDI Interface (MDMI)](https://github.com/rhargreaves/mega-drive-midi-interface). Helps you load presets from instrument files, clear presets, list WOPN instruments, and test connectivity.
## Features
- **Multi-format preset support**: Load presets in WOPN, DMP, and TFI formats to MDMI user presets (programs 0-127)
- **Advanced WOPN support**: Choose specific bank, instrument, and bank type (melody/percussion) from WOPN files
- **Intelligent format detection**: Automatic detection of preset formats based on file headers and structure
- **Environment variable support**: Set `MDMI_MIDI_PORT` once to avoid specifying `--port` repeatedly
- **Preset management**: Clear individual user presets or all presets at once
- **WOPN browsing**: List WOPN file contents to explore available banks and instruments
- **Hardware MIDI support**: Works with MIDI hardware for real-time preset loading
- **Comprehensive testing**: Full test coverage including real-world data validation
* Load presets from instrument files:
* DefleMask preset versions 8, 9 and 11
* [WOPN](https://github.com/Wohlstand/libOPNMIDI/blob/master/fm_banks/wopn%20specification.txt) versions 1 and 2, as used by libOPNMIDI
* [TFI](https://vgmrips.net/wiki/TFI_File_Format)
* Clear presets. Individual user presets or all presets at once
* List WOPN instruments
* Connectivity testing: Ping/pong functionality to test MDMI connectivity
## Installation (from PyPI)
## Installation
Latest version from PyPI:
```bash

@@ -60,46 +61,12 @@ pip install mdmi-cli

## Installation (from source)
```bash
make install
```
## Build
### Add Requirements
```bash
pip install -r requirements.txt
```
## Usage
### Environment Variable Setup (Optional)
Set the `MDMI_MIDI_PORT` environment variable to avoid specifying `--port` in every command:
```bash
# Set for current session
export MDMI_MIDI_PORT="USB MIDI Interface"
# Or add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
echo 'export MDMI_MIDI_PORT="USB MIDI Interface"' >> ~/.bashrc
```
With the environment variable set, you can omit `--port` from all commands:
```bash
# These commands will automatically use MDMI_MIDI_PORT
mdmi load-preset example.tfi --program 0
mdmi clear-preset --program 5
mdmi clear-all-presets --confirm
```
### Load a preset
```bash
# Load TFI preset to program 0 (uses MDMI_MIDI_PORT if set)
# 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 --port "USB MIDI Interface"
mdmi load-preset example.dmp --program 5 --midi-out "IAC Driver Bus 1"

@@ -109,4 +76,4 @@ # Load specific WOPN instrument to program 10

# List available MIDI ports
mdmi list-ports
# Test with fake interface (for development)
mdmi load-preset example.tfi --program 0 --fake
```

@@ -117,5 +84,8 @@

```bash
# List contents of a WOPN file
# 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

@@ -131,3 +101,3 @@ mdmi load-preset soundbank.wopn --program 20 --bank 0 --instrument 3 --bank-type percussion

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

@@ -139,5 +109,25 @@

# Clear all presets (skip confirmation) with specific port
mdmi clear-all-presets --confirm --port "My MIDI Device"
mdmi clear-all-presets --confirm --midi-out "IAC Driver Bus 1"
```
### Test connectivity
```bash
# 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
```bash
# List all available MIDI input and output ports
mdmi list-ports
```
## Configuration

@@ -147,63 +137,24 @@

- **`MDMI_MIDI_PORT`**: Default MIDI output port name
- Used automatically when `--port` is not specified
- Can be overridden by the `--port` option for individual commands
- Improves workflow efficiency when consistently using the same MIDI device
- **`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
All commands support:
- `--port TEXT`: MIDI output port name (overrides `MDMI_MIDI_PORT`)
Most commands support:
- `--midi-out TEXT`: MIDI output port name (overrides environment variables)
## Supported Formats
Commands with bidirectional communication (ping) also support:
- `--midi-in TEXT`: MIDI input port name (overrides `MDMI_MIDI_IN`)
### TFI (42 bytes)
- Direct YM2612 FM parameter files
- Algorithm and feedback as separate bytes
- 4 operators with 10 bytes each
- Commonly used with Deflemask and other trackers
### DMP (DefleMask preset format)
- **Version 8**: Basic FM parameters with operator data
- **Version 9**: Enhanced format with additional features
- **Version 11**: Full format with system type specification
- Automatic version detection and proper parsing
- Support for both `.DMP` signature and direct version byte formats
### WOPN (libOPNMIDI bank format)
- Multi-bank instrument collections with proper `WOPN2-B2NK` header support
- Separate melody and percussion banks
- Advanced instrument selection by bank index and instrument index
- Bank type selection (melody/percussion)
- Comprehensive bank browsing with `list-wopn` command
- Support for multiple banks per type
## Development
### Running Tests
### Build
```bash
# Run all tests
# Install cli (from source)
make install
# Run tests
make test
# Run specific test file
pytest tests/test_cli.py -v
# Run with coverage
pytest --cov=mdmi tests/
```
## Dependencies
- **click**: Command-line interface framework for robust CLI development
- **mido**: MIDI library for hardware communication and SysEx handling
- **bitstruct**: Binary data parsing library for efficient preset format parsing
### Development Dependencies
- **pytest**: Testing framework for comprehensive test coverage
- **pytest-mock**: Mocking library for isolated testing
- **ruff**: Fast Python linter and formatter
## License
This project is open source. Please check the license file for details.
"""MDMI CLI package."""
__version__ = "0.4.0"
__version__ = "0.4.1"
+54
-103
Metadata-Version: 2.4
Name: mdmi-cli
Version: 0.4.0
Version: 0.4.1
Summary: CLI tool for working with the Mega Drive MIDI Interface (MDMI)

@@ -40,17 +40,18 @@ Author: rhargreaves

Python CLI for controlling the Mega Drive MIDI Interface (MDMI). Supports loading presets in WOPN, DMP, and TFI formats with instrument selection for WOPN files.
CLI for controlling the [Mega Drive MIDI Interface (MDMI)](https://github.com/rhargreaves/mega-drive-midi-interface). Helps you load presets from instrument files, clear presets, list WOPN instruments, and test connectivity.
## Features
- **Multi-format preset support**: Load presets in WOPN, DMP, and TFI formats to MDMI user presets (programs 0-127)
- **Advanced WOPN support**: Choose specific bank, instrument, and bank type (melody/percussion) from WOPN files
- **Intelligent format detection**: Automatic detection of preset formats based on file headers and structure
- **Environment variable support**: Set `MDMI_MIDI_PORT` once to avoid specifying `--port` repeatedly
- **Preset management**: Clear individual user presets or all presets at once
- **WOPN browsing**: List WOPN file contents to explore available banks and instruments
- **Hardware MIDI support**: Works with MIDI hardware for real-time preset loading
- **Comprehensive testing**: Full test coverage including real-world data validation
* Load presets from instrument files:
* DefleMask preset versions 8, 9 and 11
* [WOPN](https://github.com/Wohlstand/libOPNMIDI/blob/master/fm_banks/wopn%20specification.txt) versions 1 and 2, as used by libOPNMIDI
* [TFI](https://vgmrips.net/wiki/TFI_File_Format)
* Clear presets. Individual user presets or all presets at once
* List WOPN instruments
* Connectivity testing: Ping/pong functionality to test MDMI connectivity
## Installation (from PyPI)
## Installation
Latest version from PyPI:
```bash

@@ -60,46 +61,12 @@ pip install mdmi-cli

## Installation (from source)
```bash
make install
```
## Build
### Add Requirements
```bash
pip install -r requirements.txt
```
## Usage
### Environment Variable Setup (Optional)
Set the `MDMI_MIDI_PORT` environment variable to avoid specifying `--port` in every command:
```bash
# Set for current session
export MDMI_MIDI_PORT="USB MIDI Interface"
# Or add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
echo 'export MDMI_MIDI_PORT="USB MIDI Interface"' >> ~/.bashrc
```
With the environment variable set, you can omit `--port` from all commands:
```bash
# These commands will automatically use MDMI_MIDI_PORT
mdmi load-preset example.tfi --program 0
mdmi clear-preset --program 5
mdmi clear-all-presets --confirm
```
### Load a preset
```bash
# Load TFI preset to program 0 (uses MDMI_MIDI_PORT if set)
# 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 --port "USB MIDI Interface"
mdmi load-preset example.dmp --program 5 --midi-out "IAC Driver Bus 1"

@@ -109,4 +76,4 @@ # Load specific WOPN instrument to program 10

# List available MIDI ports
mdmi list-ports
# Test with fake interface (for development)
mdmi load-preset example.tfi --program 0 --fake
```

@@ -117,5 +84,8 @@

```bash
# List contents of a WOPN file
# 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

@@ -131,3 +101,3 @@ mdmi load-preset soundbank.wopn --program 20 --bank 0 --instrument 3 --bank-type percussion

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

@@ -139,5 +109,25 @@

# Clear all presets (skip confirmation) with specific port
mdmi clear-all-presets --confirm --port "My MIDI Device"
mdmi clear-all-presets --confirm --midi-out "IAC Driver Bus 1"
```
### Test connectivity
```bash
# 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
```bash
# List all available MIDI input and output ports
mdmi list-ports
```
## Configuration

@@ -147,63 +137,24 @@

- **`MDMI_MIDI_PORT`**: Default MIDI output port name
- Used automatically when `--port` is not specified
- Can be overridden by the `--port` option for individual commands
- Improves workflow efficiency when consistently using the same MIDI device
- **`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
All commands support:
- `--port TEXT`: MIDI output port name (overrides `MDMI_MIDI_PORT`)
Most commands support:
- `--midi-out TEXT`: MIDI output port name (overrides environment variables)
## Supported Formats
Commands with bidirectional communication (ping) also support:
- `--midi-in TEXT`: MIDI input port name (overrides `MDMI_MIDI_IN`)
### TFI (42 bytes)
- Direct YM2612 FM parameter files
- Algorithm and feedback as separate bytes
- 4 operators with 10 bytes each
- Commonly used with Deflemask and other trackers
### DMP (DefleMask preset format)
- **Version 8**: Basic FM parameters with operator data
- **Version 9**: Enhanced format with additional features
- **Version 11**: Full format with system type specification
- Automatic version detection and proper parsing
- Support for both `.DMP` signature and direct version byte formats
### WOPN (libOPNMIDI bank format)
- Multi-bank instrument collections with proper `WOPN2-B2NK` header support
- Separate melody and percussion banks
- Advanced instrument selection by bank index and instrument index
- Bank type selection (melody/percussion)
- Comprehensive bank browsing with `list-wopn` command
- Support for multiple banks per type
## Development
### Running Tests
### Build
```bash
# Run all tests
# Install cli (from source)
make install
# Run tests
make test
# Run specific test file
pytest tests/test_cli.py -v
# Run with coverage
pytest --cov=mdmi tests/
```
## Dependencies
- **click**: Command-line interface framework for robust CLI development
- **mido**: MIDI library for hardware communication and SysEx handling
- **bitstruct**: Binary data parsing library for efficient preset format parsing
### Development Dependencies
- **pytest**: Testing framework for comprehensive test coverage
- **pytest-mock**: Mocking library for isolated testing
- **ruff**: Fast Python linter and formatter
## License
This project is open source. Please check the license file for details.
+53
-102

@@ -8,17 +8,18 @@ # Mega Drive MIDI Interface CLI

Python CLI for controlling the Mega Drive MIDI Interface (MDMI). Supports loading presets in WOPN, DMP, and TFI formats with instrument selection for WOPN files.
CLI for controlling the [Mega Drive MIDI Interface (MDMI)](https://github.com/rhargreaves/mega-drive-midi-interface). Helps you load presets from instrument files, clear presets, list WOPN instruments, and test connectivity.
## Features
- **Multi-format preset support**: Load presets in WOPN, DMP, and TFI formats to MDMI user presets (programs 0-127)
- **Advanced WOPN support**: Choose specific bank, instrument, and bank type (melody/percussion) from WOPN files
- **Intelligent format detection**: Automatic detection of preset formats based on file headers and structure
- **Environment variable support**: Set `MDMI_MIDI_PORT` once to avoid specifying `--port` repeatedly
- **Preset management**: Clear individual user presets or all presets at once
- **WOPN browsing**: List WOPN file contents to explore available banks and instruments
- **Hardware MIDI support**: Works with MIDI hardware for real-time preset loading
- **Comprehensive testing**: Full test coverage including real-world data validation
* Load presets from instrument files:
* DefleMask preset versions 8, 9 and 11
* [WOPN](https://github.com/Wohlstand/libOPNMIDI/blob/master/fm_banks/wopn%20specification.txt) versions 1 and 2, as used by libOPNMIDI
* [TFI](https://vgmrips.net/wiki/TFI_File_Format)
* Clear presets. Individual user presets or all presets at once
* List WOPN instruments
* Connectivity testing: Ping/pong functionality to test MDMI connectivity
## Installation (from PyPI)
## Installation
Latest version from PyPI:
```bash

@@ -28,46 +29,12 @@ pip install mdmi-cli

## Installation (from source)
```bash
make install
```
## Build
### Add Requirements
```bash
pip install -r requirements.txt
```
## Usage
### Environment Variable Setup (Optional)
Set the `MDMI_MIDI_PORT` environment variable to avoid specifying `--port` in every command:
```bash
# Set for current session
export MDMI_MIDI_PORT="USB MIDI Interface"
# Or add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
echo 'export MDMI_MIDI_PORT="USB MIDI Interface"' >> ~/.bashrc
```
With the environment variable set, you can omit `--port` from all commands:
```bash
# These commands will automatically use MDMI_MIDI_PORT
mdmi load-preset example.tfi --program 0
mdmi clear-preset --program 5
mdmi clear-all-presets --confirm
```
### Load a preset
```bash
# Load TFI preset to program 0 (uses MDMI_MIDI_PORT if set)
# 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 --port "USB MIDI Interface"
mdmi load-preset example.dmp --program 5 --midi-out "IAC Driver Bus 1"

@@ -77,4 +44,4 @@ # Load specific WOPN instrument to program 10

# List available MIDI ports
mdmi list-ports
# Test with fake interface (for development)
mdmi load-preset example.tfi --program 0 --fake
```

@@ -85,5 +52,8 @@

```bash
# List contents of a WOPN file
# 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

@@ -99,3 +69,3 @@ mdmi load-preset soundbank.wopn --program 20 --bank 0 --instrument 3 --bank-type percussion

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

@@ -107,5 +77,25 @@

# Clear all presets (skip confirmation) with specific port
mdmi clear-all-presets --confirm --port "My MIDI Device"
mdmi clear-all-presets --confirm --midi-out "IAC Driver Bus 1"
```
### Test connectivity
```bash
# 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
```bash
# List all available MIDI input and output ports
mdmi list-ports
```
## Configuration

@@ -115,63 +105,24 @@

- **`MDMI_MIDI_PORT`**: Default MIDI output port name
- Used automatically when `--port` is not specified
- Can be overridden by the `--port` option for individual commands
- Improves workflow efficiency when consistently using the same MIDI device
- **`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
All commands support:
- `--port TEXT`: MIDI output port name (overrides `MDMI_MIDI_PORT`)
Most commands support:
- `--midi-out TEXT`: MIDI output port name (overrides environment variables)
## Supported Formats
Commands with bidirectional communication (ping) also support:
- `--midi-in TEXT`: MIDI input port name (overrides `MDMI_MIDI_IN`)
### TFI (42 bytes)
- Direct YM2612 FM parameter files
- Algorithm and feedback as separate bytes
- 4 operators with 10 bytes each
- Commonly used with Deflemask and other trackers
### DMP (DefleMask preset format)
- **Version 8**: Basic FM parameters with operator data
- **Version 9**: Enhanced format with additional features
- **Version 11**: Full format with system type specification
- Automatic version detection and proper parsing
- Support for both `.DMP` signature and direct version byte formats
### WOPN (libOPNMIDI bank format)
- Multi-bank instrument collections with proper `WOPN2-B2NK` header support
- Separate melody and percussion banks
- Advanced instrument selection by bank index and instrument index
- Bank type selection (melody/percussion)
- Comprehensive bank browsing with `list-wopn` command
- Support for multiple banks per type
## Development
### Running Tests
### Build
```bash
# Run all tests
# Install cli (from source)
make install
# Run tests
make test
# Run specific test file
pytest tests/test_cli.py -v
# Run with coverage
pytest --cov=mdmi tests/
```
## Dependencies
- **click**: Command-line interface framework for robust CLI development
- **mido**: MIDI library for hardware communication and SysEx handling
- **bitstruct**: Binary data parsing library for efficient preset format parsing
### Development Dependencies
- **pytest**: Testing framework for comprehensive test coverage
- **pytest-mock**: Mocking library for isolated testing
- **ruff**: Fast Python linter and formatter
## License
This project is open source. Please check the license file for details.