midiscripter


Namemidiscripter JSON
Version 0.8 PyPI version JSON
download
home_pageNone
SummaryFramework for scripting MIDI, Open Sound Control, keyboard and mouse input and output
upload_time2025-08-16 13:21:34
maintainerNone
docs_urlNone
authorMaboroshy
requires_python>=3.11
licenseNone
keywords midi osc automation input script
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# <img src="https://raw.githubusercontent.com/Maboroshy/midi-scripter/master/docs/icon.svg" width="23"/> MIDI Scripter ‣ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/midiscripter?style=flat-square&logo=python&logoColor=yellow)](https://pypi.org/project/midiscripter/) ![GitHub License](https://img.shields.io/github/license/maboroshy/midi-scripter?style=flat-square&color=darkgreen) ![For](https://img.shields.io/badge/for-Windows%20|%20macOS%20|%20Linux-darkmagenta?style=flat-square)

MIDI Scripter is a Python framework for filtering, modifying, routing and any other
handling of MIDI, Open Sound Control (OSC), keyboard and mouse input and output.

It works on Windows and Linux and should work on macOS.

MIDI Scripter listens input ports and send incoming messages to subscribed callables such as functions or methods. 
These callables, along with any other Python code, can send out modified or newly created messages through output ports. 
MIDI Scripter can serve as a proxy that filters, transforms, and converts incoming messages.

In addition, MIDI Scripter features a customizable graphical user interface (GUI) 
that provides logging, coding assistance, various controls and indicators to use in the script.

All that with no boilerplate and only a few lines of code.

An octave transposer with GUI controls in 10 lines of code:

``` python
from midiscripter import *

midi_keyboard = MidiIn('MIDI Keyboard')  # GUI will provide you the port names
proxy_output = MidiOut('To DAW', virtual=True)  # virtual proxy port for output

# GUI widget in a single line
octave_selector = GuiButtonSelectorH(('-2', '-1', '0', '+1', '+2'), select='0')

@midi_keyboard.subscribe  # decorated function will receive port's messages
def transpose(msg: MidiMsg) -> None:
	if msg.type == MidiType.NOTE_ON or msg.type == MidiType.NOTE_OFF:  # filter
		msg.data1 += 12 * int(octave_selector.selected_item_text)  # modify
	proxy_output.send(msg)  # route

if __name__ == '__main__':
	start_gui()  # opens helpful customizable GUI
```

Screenshot with only `octave_selector` widget enabled:

![Screenshot with only octave_selector widget enabled](
https://github.com/Maboroshy/midi-scripter/blob/master/examples/octave_transposer/screenshot_widget.png?raw=true)

Screenshot with service Ports and Log and Message Sender widgets:

![Screenshot with all the widget visible](
https://github.com/Maboroshy/midi-scripter/blob/master/examples/octave_transposer/screenshot_full.png?raw=true)

The average latency for the script above is less than 0.25 milliseconds.

Currently MIDI Scripter is at "beta" development stage. 
It's fully functional but needs more user feedback. 

## Use cases

- Programming MIDI input/output handling scripts 
  that may also use OSC, keyboard and mouse input/output.
- Mapping your MIDI controller in your own custom way, 
  from simple MIDI message filtering or conversion to mostly anything you can imagine.
- Controlling Ableton Live with Python, without diving into 
  it's complex MIDI remote scripting or Max for Live.

## Examples 
- [Add extra banks for the MIDI controllers.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/controls_banks)
- [Launch an app or run any Python code with a MIDI message.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/start_daw_by_midi)
- [Show pressed chord description.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/chord_info)
- Control Ableton Live with [remote script](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_select_armed_track_with_remote_script) or [AbletonOSC.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_select_armed_track_with_osc)
- [Make custom mapping overlay on top of Ableton Live built-in MIDI controller integration.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/launchpad_overlay)
- [Run Python code with Ableton Live clips.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_clips_launch_code)
- [Save and load global presets for Ableton Live devices.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_global_preset)

## Documentation

MIDI Scripter has fully documented and type hinted API.  
[Overview and API documentation is available here.](https://maboroshy.github.io/midi-scripter)

## Installation

1. Install [Python 3.11+](https://www.python.org/downloads/) including pip.
2. Run `pip install midiscripter`.

Extra steps for Windows:

1. Enable `Add python .exe to PATH` option in Python installer.
2. Install [loopMIDI](https://www.tobias-erichsen.de/software/loopmidi.html) for virtual MIDI port support.

## Quick Start Guide

1. Paste the [script template](examples/script_template.py) into your Python IDE or a plain text editor. Using IDE is recommended.
2. Run the template script directly from the IDE or by `python your_script.py`. 
   This will open the GUI, providing information about available ports and incoming input.
3. Ensure that the “Show Unused Ports” button located under the port list is activated. 
   Enable the checkboxes for any available ports to open them. Monitor the log for incoming messages.
4. Click on the port names and messages in the log or port list to copy their declarations to the clipboard. 
   You can paste the declarations into your script.
5. Rewrite the template function to achieve desired functionality. Use `log('messages')` for debugging purposes.
6. Restart the script from the GUI to see how it performs.
7. Develop more complex scripts by utilizing additional inputs, outputs and functions (callables). 
   Subscribe new callables to input messages using the `@input_port.subscribe` decorator.

## License 
MIDI Scripter assets and code is under LGPL 3.0 license.  
That code that use it can have any license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "midiscripter",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "MIDI, OSC, automation, input, script",
    "author": "Maboroshy",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/76/aa/f504b9647c7ac2ac3b5a97beb4b493f20a1e714a46dd8d1ae3bafe6758c1/midiscripter-0.8.tar.gz",
    "platform": null,
    "description": "\n# <img src=\"https://raw.githubusercontent.com/Maboroshy/midi-scripter/master/docs/icon.svg\" width=\"23\"/> MIDI Scripter \u2023 [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/midiscripter?style=flat-square&logo=python&logoColor=yellow)](https://pypi.org/project/midiscripter/) ![GitHub License](https://img.shields.io/github/license/maboroshy/midi-scripter?style=flat-square&color=darkgreen) ![For](https://img.shields.io/badge/for-Windows%20|%20macOS%20|%20Linux-darkmagenta?style=flat-square)\n\nMIDI Scripter is a Python framework for filtering, modifying, routing and any other\nhandling of MIDI, Open Sound Control (OSC), keyboard and mouse input and output.\n\nIt works on Windows and Linux and should work on macOS.\n\nMIDI Scripter listens input ports and send incoming messages to subscribed callables such as functions or methods. \nThese callables, along with any other Python code, can send out modified or newly created messages through output ports. \nMIDI Scripter can serve as a proxy that filters, transforms, and converts incoming messages.\n\nIn addition, MIDI Scripter features a customizable graphical user interface (GUI) \nthat provides logging, coding assistance, various controls and indicators to use in the script.\n\nAll that with no boilerplate and only a few lines of code.\n\nAn octave transposer with GUI controls in 10 lines of code:\n\n``` python\nfrom midiscripter import *\n\nmidi_keyboard = MidiIn('MIDI Keyboard')  # GUI will provide you the port names\nproxy_output = MidiOut('To DAW', virtual=True)  # virtual proxy port for output\n\n# GUI widget in a single line\noctave_selector = GuiButtonSelectorH(('-2', '-1', '0', '+1', '+2'), select='0')\n\n@midi_keyboard.subscribe  # decorated function will receive port's messages\ndef transpose(msg: MidiMsg) -> None:\n\tif msg.type == MidiType.NOTE_ON or msg.type == MidiType.NOTE_OFF:  # filter\n\t\tmsg.data1 += 12 * int(octave_selector.selected_item_text)  # modify\n\tproxy_output.send(msg)  # route\n\nif __name__ == '__main__':\n\tstart_gui()  # opens helpful customizable GUI\n```\n\nScreenshot with only `octave_selector` widget enabled:\n\n![Screenshot with only octave_selector widget enabled](\nhttps://github.com/Maboroshy/midi-scripter/blob/master/examples/octave_transposer/screenshot_widget.png?raw=true)\n\nScreenshot with service Ports and Log and Message Sender widgets:\n\n![Screenshot with all the widget visible](\nhttps://github.com/Maboroshy/midi-scripter/blob/master/examples/octave_transposer/screenshot_full.png?raw=true)\n\nThe average latency for the script above is less than 0.25 milliseconds.\n\nCurrently MIDI Scripter is at \"beta\" development stage. \nIt's fully functional but needs more user feedback. \n\n## Use cases\n\n- Programming MIDI input/output handling scripts \n  that may also use OSC, keyboard and mouse input/output.\n- Mapping your MIDI controller in your own custom way, \n  from simple MIDI message filtering or conversion to mostly anything you can imagine.\n- Controlling Ableton Live with Python, without diving into \n  it's complex MIDI remote scripting or Max for Live.\n\n## Examples \n- [Add extra banks for the MIDI controllers.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/controls_banks)\n- [Launch an app or run any Python code with a MIDI message.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/start_daw_by_midi)\n- [Show pressed chord description.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/chord_info)\n- Control Ableton Live with [remote script](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_select_armed_track_with_remote_script) or [AbletonOSC.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_select_armed_track_with_osc)\n- [Make custom mapping overlay on top of Ableton Live built-in MIDI controller integration.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/launchpad_overlay)\n- [Run Python code with Ableton Live clips.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_clips_launch_code)\n- [Save and load global presets for Ableton Live devices.](https://github.com/Maboroshy/midi-scripter/tree/master/examples/ableton_global_preset)\n\n## Documentation\n\nMIDI Scripter has fully documented and type hinted API.  \n[Overview and API documentation is available here.](https://maboroshy.github.io/midi-scripter)\n\n## Installation\n\n1. Install [Python 3.11+](https://www.python.org/downloads/) including pip.\n2. Run `pip install midiscripter`.\n\nExtra steps for Windows:\n\n1. Enable `Add python .exe to PATH` option in Python installer.\n2. Install [loopMIDI](https://www.tobias-erichsen.de/software/loopmidi.html) for virtual MIDI port support.\n\n## Quick Start Guide\n\n1. Paste the [script template](examples/script_template.py) into your Python IDE or a plain text editor. Using IDE is recommended.\n2. Run the template script directly from the IDE or by `python your_script.py`. \n   This will open the GUI, providing information about available ports and incoming input.\n3. Ensure that the \u201cShow Unused Ports\u201d button located under the port list is activated. \n   Enable the checkboxes for any available ports to open them. Monitor the log for incoming messages.\n4. Click on the port names and messages in the log or port list to copy their declarations to the clipboard. \n   You can paste the declarations into your script.\n5. Rewrite the template function to achieve desired functionality. Use `log('messages')` for debugging purposes.\n6. Restart the script from the GUI to see how it performs.\n7. Develop more complex scripts by utilizing additional inputs, outputs and functions (callables). \n   Subscribe new callables to input messages using the `@input_port.subscribe` decorator.\n\n## License \nMIDI Scripter assets and code is under LGPL 3.0 license.  \nThat code that use it can have any license.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Framework for scripting MIDI, Open Sound Control, keyboard and mouse input and output",
    "version": "0.8",
    "project_urls": {
        "Documentation": "https://maboroshy.github.io/midi-scripter",
        "Issues": "https://github.com/Maboroshy/midi-scripter/issues",
        "Source": "https://github.com/Maboroshy/midi-scripter"
    },
    "split_keywords": [
        "midi",
        " osc",
        " automation",
        " input",
        " script"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a07902af553efded737fdb736d004653549340877da72130a46d4ebfcd6cf141",
                "md5": "d053bd0d6a07eb5de22dadfff3f4932b",
                "sha256": "ca8704c0d427aa4abfd556e72f1de2916500c7f308eee8fc8af74cdc721b5b61"
            },
            "downloads": -1,
            "filename": "midiscripter-0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d053bd0d6a07eb5de22dadfff3f4932b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 116090,
            "upload_time": "2025-08-16T13:21:32",
            "upload_time_iso_8601": "2025-08-16T13:21:32.962498Z",
            "url": "https://files.pythonhosted.org/packages/a0/79/02af553efded737fdb736d004653549340877da72130a46d4ebfcd6cf141/midiscripter-0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "76aaf504b9647c7ac2ac3b5a97beb4b493f20a1e714a46dd8d1ae3bafe6758c1",
                "md5": "848df9e979f42ca18d4763ab84fbef4d",
                "sha256": "08d08c84ae6479d5087368923c6964bfc7541137dedfd7cb005ec1316d4c5fca"
            },
            "downloads": -1,
            "filename": "midiscripter-0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "848df9e979f42ca18d4763ab84fbef4d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 94087,
            "upload_time": "2025-08-16T13:21:34",
            "upload_time_iso_8601": "2025-08-16T13:21:34.522324Z",
            "url": "https://files.pythonhosted.org/packages/76/aa/f504b9647c7ac2ac3b5a97beb4b493f20a1e714a46dd8d1ae3bafe6758c1/midiscripter-0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-16 13:21:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Maboroshy",
    "github_project": "midi-scripter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "midiscripter"
}
        
Elapsed time: 2.02571s