Skip to main content

Midi control for microscopes using pymmcore

Project description

pymmcore-midi

License PyPI Python Version CI codecov

MIDI Device control for microscopes using pymmcore

Installation

pip install pymmcore-midi

Usage

Create a pymmcore_midi.DeviceMap object (can be done from a YAML/JSON file), then connect it to a pymmcore-plus CMMCorePlus object.

device_name: X-TOUCH MINI
mappings:
  - [button, 8, Camera, AllowMultiROI]
  - [button, 9, Camera, Binning]
  - [knob, 2, Camera, Gain]
  - [knob, 9, Camera, CCDTemperature]
  # can also use this form
  - message_type: control_change
    control_id: 1
    device_label: Camera
    property_name: Exposure
  - message_type: button
    control_id: 10
    core_method: snap
  - message_type: knob
    control_id: 17
    core_method: setAutoFocusOffset
core = CMMCorePlus()
core.loadSystemConfiguration()

dev_map = DeviceMap.from_file(f)
dev_map.connect_to_core(core)

Now when you move a knob or press a button on your MIDI device, the corresponding property/method will be updated/called on the CMMCorePlus object. :tada:

Debugging/Development

Use the environment variable PYMMCORE_MIDI_DEBUG=1 to print out the MIDI messages that are being received from your device. (This is useful to determine the appropriate message type and control ID for your device map.)

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

pymmcore_midi-0.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

pymmcore_midi-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pymmcore_midi-0.1.0.tar.gz.

File metadata

  • Download URL: pymmcore_midi-0.1.0.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pymmcore_midi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6444483b6ee1d56f7490688d761f6a0a4f8f678c6b9146377acfa607e28d71f0
MD5 1cd45fc5f9ec37163052d241c27c8b08
BLAKE2b-256 af72c74ffb32882bfae1466df260a6ee6b1a7d88dbdd07c45f500a6e37159f15

See more details on using hashes here.

File details

Details for the file pymmcore_midi-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymmcore_midi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a099eefc5ddb6212807a90b23e208186be8ea9b8f601d8233130eac741ea9819
MD5 4c0e82fecdc8ca51f1b9c2e0684306e6
BLAKE2b-256 c90fe7c5d97488348f0a4ab28e04f741fbe52867916b9927ae804659dbb634ab

See more details on using hashes here.

Supported by

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