midiscripter


Namemidiscripter JSON
Version 0.6 PyPI version JSON
download
home_pageNone
SummaryFramework for scripting MIDI, keyboard and Open Sound Control input and output
upload_time2024-08-19 11:37:07
maintainerNone
docs_urlNone
authorMaboroshy
requires_python>=3.11
licenseGNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
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

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

MIDI Scripter monitors input ports and processes incoming messages 
by sending them 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. Essentially, MIDI Scripter 
serves as a proxy that can filter, transform, and convert incoming data.

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

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

``` python
from midiscripter import *

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

# GUI control 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__':  # combine multiple scripts by importing them
	start_gui()  # opens helpful customizable GUI
```

![Screenshot after some widget arrangement](https://github.com/Maboroshy/midi-scripter/blob/master/examples/octave_transposer/screenshot.png?raw=true)

The average measured roundtrip 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. It works on Windows and Linux and
should work on macOS.

## Documentation and Examples

[Overview and full API documentation is available here.](https://maboroshy.github.io/midi-scripter)

[You can find more examples here.](https://github.com/Maboroshy/midi-scripter/tree/master/examples)


## Features

#### Basic Functionality:

- Receive input messages from MIDI, OSC, keyboard and mouse.
- Filter, modify, and manipulate messages using Python.
- Send modified or newly generated MIDI, OSC, keyboard, and mouse messages.

#### For Music Performance MIDI Setups:

- Create additional banks and layers to enhance MIDI controllers.
- Organize mappings into sets or scenes using with GUI dashboard.
- Add overlay mappings on top of your MIDI controller’s DAW integration using proxies.
- Combine multiple MIDI controllers into a single unit with any logic.
- Control Ableton Live through a [special remote script or AbletonOSC]().

#### For Software Control and Automation:

- Map or convert messages to one another based on specific conditions and logic.
- Use MIDI controllers or keyboard shortcuts to run any Python code.
- Implement keyboard and mouse macros.

#### For Writing MIDI-Related Python Code:

- Prepare MIDI, OSC, keyboard, and mouse inputs and outputs with a single line of code, without boilerplate code.
- Use decorators to feed input messages to functions or other callables.
- Work with message objects rather than raw data, which varies by port type.
- Create GUI widgets with just one line of code and arrange them with mouse.
- Fully type-annotated API for better code clarity.

## 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)
   and set required virtual MIDI ports inside it.

## Quick Start Guide

1. Paste the [script template](examples/script_template.py) into your Python IDE or a plain text editor. Using an IDE is recommended.
2. Run the template script directly from the IDE or by `python your_script.py`. This will open the GUI (as shown in the screenshot below), 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 activate them, monitor the log for incoming messages.
4. Click on the port names and messages in the log to copy their 
   declarations to the clipboard. Paste the declarations into your script.
5. Adjust 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 callables to input messages using the `@input_port.subscribe` decorator.

![Screenshot](https://github.com/Maboroshy/midi-scripter/blob/master/docs/screenshot.png?raw=true)

            

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/02/20/82040c1aa6f8b45f3ab0554be039c3e783aebdfe72b840f8996a69a7bd65/midiscripter-0.6.tar.gz",
    "platform": null,
    "description": "# <img src=\"https://raw.githubusercontent.com/Maboroshy/midi-scripter/master/docs/icon.svg\" width=\"23\"/> MIDI Scripter\n\nMIDI Scripter is a framework for filtering, modifying, routing and any other\nscripting of MIDI, Open Sound Control (OSC), keyboard and mouse input and\noutput with Python.\n\nMIDI Scripter monitors input ports and processes incoming messages \nby sending them to subscribed callables such as functions or methods. \nThese callables, along with any other Python code, can send out modified \nor newly created messages through output ports. Essentially, MIDI Scripter \nserves as a proxy that can filter, transform, and convert incoming data.\n\nIn addition, MIDI Scripter features a customizable graphical user interface (GUI) \nthat provides message logging, coding assistance, \nand various controls and indicators to use in the script.\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 with port names\nproxy_output = MidiOut('To DAW')  # using virtual proxy port for output\n\n# GUI control 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__':  # combine multiple scripts by importing them\n\tstart_gui()  # opens helpful customizable GUI\n```\n\n![Screenshot after some widget arrangement](https://github.com/Maboroshy/midi-scripter/blob/master/examples/octave_transposer/screenshot.png?raw=true)\n\nThe average measured roundtrip latency for the script above is less than 0.25 \nmilliseconds.\n\nCurrently MIDI Scripter is at \"beta\" development stage. It's fully\nfunctional but needs more user feedback. It works on Windows and Linux and\nshould work on macOS.\n\n## Documentation and Examples\n\n[Overview and full API documentation is available here.](https://maboroshy.github.io/midi-scripter)\n\n[You can find more examples here.](https://github.com/Maboroshy/midi-scripter/tree/master/examples)\n\n\n## Features\n\n#### Basic Functionality:\n\n- Receive input messages from MIDI, OSC, keyboard and mouse.\n- Filter, modify, and manipulate messages using Python.\n- Send modified or newly generated MIDI, OSC, keyboard, and mouse messages.\n\n#### For Music Performance MIDI Setups:\n\n- Create additional banks and layers to enhance MIDI controllers.\n- Organize mappings into sets or scenes using with GUI dashboard.\n- Add overlay mappings on top of your MIDI controller\u2019s DAW integration using proxies.\n- Combine multiple MIDI controllers into a single unit with any logic.\n- Control Ableton Live through a [special remote script or AbletonOSC]().\n\n#### For Software Control and Automation:\n\n- Map or convert messages to one another based on specific conditions and logic.\n- Use MIDI controllers or keyboard shortcuts to run any Python code.\n- Implement keyboard and mouse macros.\n\n#### For Writing MIDI-Related Python Code:\n\n- Prepare MIDI, OSC, keyboard, and mouse inputs and outputs with a single line of code, without boilerplate code.\n- Use decorators to feed input messages to functions or other callables.\n- Work with message objects rather than raw data, which varies by port type.\n- Create GUI widgets with just one line of code and arrange them with mouse.\n- Fully type-annotated API for better code clarity.\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)\n   and set required virtual MIDI ports inside it.\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 an IDE is recommended.\n2. Run the template script directly from the IDE or by `python your_script.py`. This will open the GUI (as shown in the screenshot below), providing information about available ports and incoming input.\n3. Ensure that the \u201cShow Unused Ports\u201d button located under the port list is activated. Enable the checkboxes for any available ports to activate them, monitor the log for incoming messages.\n4. Click on the port names and messages in the log to copy their \n   declarations to the clipboard. Paste the declarations into your script.\n5. Adjust 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). Subscribe callables to input messages using the `@input_port.subscribe` decorator.\n\n![Screenshot](https://github.com/Maboroshy/midi-scripter/blob/master/docs/screenshot.png?raw=true)\n",
    "bugtrack_url": null,
    "license": "GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007  Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.   This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.  0. Additional Definitions.  As used herein, \"this License\" refers to version 3 of the GNU Lesser General Public License, and the \"GNU GPL\" refers to version 3 of the GNU General Public License.  \"The Library\" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.  An \"Application\" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.  A \"Combined Work\" is a work produced by combining or linking an Application with the Library.  The particular version of the Library with which the Combined Work was made is also called the \"Linked Version\".  The \"Minimal Corresponding Source\" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.  The \"Corresponding Application Code\" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.  1. Exception to Section 3 of the GNU GPL.  You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.  2. Conveying Modified Versions.  If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:  a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or  b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.  3. Object Code Incorporating Material from Library Header Files.  The object code form of an Application may incorporate material from a header file that is part of the Library.  You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:  a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.  b) Accompany the object code with a copy of the GNU GPL and this license document.  4. Combined Works.  You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:  a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.  b) Accompany the Combined Work with a copy of the GNU GPL and this license document.  c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.  d) Do one of the following:  0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.  1) Use a suitable shared library mechanism for linking with the Library.  A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.  e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)  5. Combined Libraries.  You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:  a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.  b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.  6. Revised Versions of the GNU Lesser General Public License.  The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.  Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License \"or any later version\" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.  If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.",
    "summary": "Framework for scripting MIDI, keyboard and Open Sound Control input and output",
    "version": "0.6",
    "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": "",
            "digests": {
                "blake2b_256": "268b638c4049bf201dd501f402bfc0a410e7264640aea0b4ed5ef0106b17f8f4",
                "md5": "1f90bec1046a5a8047bea54b514b4430",
                "sha256": "74942ae33b87cb293dec049cb8756d48869b2a8f392ce645d2b636ca92ea0f79"
            },
            "downloads": -1,
            "filename": "midiscripter-0.6-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1f90bec1046a5a8047bea54b514b4430",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 107768,
            "upload_time": "2024-08-19T11:37:06",
            "upload_time_iso_8601": "2024-08-19T11:37:06.455141Z",
            "url": "https://files.pythonhosted.org/packages/26/8b/638c4049bf201dd501f402bfc0a410e7264640aea0b4ed5ef0106b17f8f4/midiscripter-0.6-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "022082040c1aa6f8b45f3ab0554be039c3e783aebdfe72b840f8996a69a7bd65",
                "md5": "caf64b115b3bb12d994060918ad5727a",
                "sha256": "efe5a07e589905fae5bd7874ebe0649b82cd6b0e20a2a40d6ecc96c79be0f121"
            },
            "downloads": -1,
            "filename": "midiscripter-0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "caf64b115b3bb12d994060918ad5727a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 85851,
            "upload_time": "2024-08-19T11:37:07",
            "upload_time_iso_8601": "2024-08-19T11:37:07.726174Z",
            "url": "https://files.pythonhosted.org/packages/02/20/82040c1aa6f8b45f3ab0554be039c3e783aebdfe72b840f8996a69a7bd65/midiscripter-0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-19 11:37:07",
    "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: 1.00176s