0 purchases
pymmcoremidi 0.1.0
pymmcore-midi
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.)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.