Skip to main content

Interactive MIDI in Jupyter

Project description

logo

IpyMIDI

Interactive MIDI in Jupyter

IpyMIDI exposes the Web MIDI interface (Web MIDI API) to Python as Jupyter widgets via WEBMIDI.js. Connect your MIDI devices (e.g., keyboards, controllers, etc.) and start interacting with them in Jupyter!

Note: this is very much work in progress (nothing much to see yet)!

Usage Example

Create a Jupyter notebook and import the library.

import ipymidi

Get access to the Web MIDI interface.

midi = ipymidi.get_interface()

Enable the MIDI interface (your Web browser may ask you the permission to access it).

midi.enable()

Get the list of all connected MIDI input devices.

midi.inputs
MIDI Inputs (2)
0:
    id: 92212230
    name: Virtual MIDI
    manufacturer: Apple Inc.
    connection: open
    state: connected
1:
    id: -1491552641
    name: Arturia KeyStep 37
    manufacturer: Arturia
    connection: open
    state: connected

Track a specific MIDI event emitted from one input device (e.g., the "noteon" event emitted from a MIDI keyboard).

ev = midi.inputs["Arturia KeyStep 37"].track_event("noteon", ["note_identifier"])

Use the ev object like any other Jupyter widget, e.g., to print in an output widget the MIDI note that has just been played on the input device.

import ipywidgets

output = ipywidgets.Output()

@ev.observe
def print_message(change):
    output.clear_output()
    with output:
        print(f"Note {change["owner"].note_identifier} played!")

output

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

ipymidi-0.0.1.tar.gz (25.4 kB view hashes)

Uploaded Source

Built Distribution

ipymidi-0.0.1-py2.py3-none-any.whl (26.9 kB view hashes)

Uploaded Python 2 Python 3

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